diff --git a/oldstuff.tar b/oldstuff.tar new file mode 100644 index 0000000..55a19e7 Binary files /dev/null and b/oldstuff.tar differ diff --git a/oldstuff/PracticingAlgorithms/.gitignore b/oldstuff/PracticingAlgorithms/.gitignore deleted file mode 100644 index cc694be..0000000 --- a/oldstuff/PracticingAlgorithms/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin/* -*.o diff --git a/oldstuff/PracticingAlgorithms/Makefile b/oldstuff/PracticingAlgorithms/Makefile deleted file mode 100644 index b8d6031..0000000 --- a/oldstuff/PracticingAlgorithms/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -BINDIR := $(PWD)/bin -CFLAGS := -std=c99 -Wall -g - -export BINDIR CFLAGS - - -all: - cd src && $(MAKE) - -clean: - rm -f bin/* - - -.PHONY: all clean diff --git a/oldstuff/PracticingAlgorithms/README.md b/oldstuff/PracticingAlgorithms/README.md deleted file mode 100644 index e37292d..0000000 --- a/oldstuff/PracticingAlgorithms/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Practicing Algorithms - -I've been burned enough times when in a room with a bunch of CS Majors... -(grumble.) - -## MIT Open Courseware stuff - -It's just like bookmarks, but on github! - - - Intro. to Algorithms lecture 01 diff --git a/oldstuff/PracticingAlgorithms/bench b/oldstuff/PracticingAlgorithms/bench deleted file mode 100755 index 08808c7..0000000 --- a/oldstuff/PracticingAlgorithms/bench +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -SETUP="import sorting" -LIST="$(python -c "import random;l = list(range(0, ${1-5000}));random.shuffle(l);print(l)")" - -echo -n "insertion sort: " -python -m timeit -s "$SETUP" "sorting.insertion_sort($LIST)" - -echo -n "merge sort: " -python -m timeit -s "$SETUP" "sorting.merge_sort($LIST)" diff --git a/oldstuff/PracticingAlgorithms/bin/.keep b/oldstuff/PracticingAlgorithms/bin/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/PracticingAlgorithms/sorting.py b/oldstuff/PracticingAlgorithms/sorting.py deleted file mode 100644 index cbddb26..0000000 --- a/oldstuff/PracticingAlgorithms/sorting.py +++ /dev/null @@ -1,49 +0,0 @@ -# vim:fileencoding=utf-8 -import math - - -def insertion_sort(a): - """ Θ(n^2) """ - for j in range(1, len(a)): - key = a[j] - i = j - 1 - while i >= 0 and a[i] > key: - a[i + 1] = a[i] - i = i - 1 - a[i + 1] = key - - -def merge_sort(m): - n = len(m) - if n <= 1: - return m - - middle = math.ceil(n / 2) - - left = m[:middle] - right = m[middle:] - - left = merge_sort(left) - right = merge_sort(right) - - return merge(left, right) - - -def merge(left, right): - result = [] - - while len(left) > 0 or len(right) > 0: - if len(left) > 0 and len(right) > 0: - if left[0] <= right[0]: - result.append(left.pop(0)) - else: - result.append(right.pop(0)) - - elif len(left) > 0: - result.append(left.pop(0)) - - elif len(right) > 0: - result.append(right.pop(0)) - - return result - diff --git a/oldstuff/PracticingAlgorithms/sorting.rb b/oldstuff/PracticingAlgorithms/sorting.rb deleted file mode 100644 index f4f68fd..0000000 --- a/oldstuff/PracticingAlgorithms/sorting.rb +++ /dev/null @@ -1,12 +0,0 @@ -def insertion_sort(a) - (0..(a.length - 1)).each do |j| - key = a[j] - i = j - 1 - while (i >= 0) && (a[i] > key) - a[i + 1] = a[i] - i = i - 1 - end - a[i + 1] = key - end -end - diff --git a/oldstuff/PracticingAlgorithms/src/Makefile b/oldstuff/PracticingAlgorithms/src/Makefile deleted file mode 100644 index ae4a6d3..0000000 --- a/oldstuff/PracticingAlgorithms/src/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -all: $(BINDIR)/insertion-sort - - -$(BINDIR)/insertion-sort: insertion-sort.c - gcc -o $@ $(CFLAGS) $^ - - -.PHONY: all diff --git a/oldstuff/PracticingAlgorithms/src/insertion-sort.c b/oldstuff/PracticingAlgorithms/src/insertion-sort.c deleted file mode 100644 index be8594a..0000000 --- a/oldstuff/PracticingAlgorithms/src/insertion-sort.c +++ /dev/null @@ -1,38 +0,0 @@ -#include - -void insertion_sort(int * a, int len_a); - - -int -main(int argc, char ** argv) -{ - int i; - int l[] = {1, 4, 8, 9, 2, 3}; - - insertion_sort(l, 6); - - for (i = 0; i < 6; i++) { - printf("%d\n", l[i]); - } -} - - -void -insertion_sort(int * a, int len_a) -{ - int i, j, key; - - for (j = 1; j < len_a; j++) { - key = a[j]; - i = j - 1; - while ((i >= 0) && (a[i] > key)) { - a[i + 1] = a[i]; - i = i - 1; - } - a[i + 1] = key; - } -} - - -/* vim:filetype=c - */ diff --git a/oldstuff/PracticingAlgorithms/test_sorting.py b/oldstuff/PracticingAlgorithms/test_sorting.py deleted file mode 100644 index 55bcbf4..0000000 --- a/oldstuff/PracticingAlgorithms/test_sorting.py +++ /dev/null @@ -1,90 +0,0 @@ -import random -import unittest - -import sorting - - -class TestInsertionSort(unittest.TestCase): - - def test_example(self): - tmpl = [8, 2, 4, 9, 3, 6] - a = tmpl[:] - expected = [2, 3, 4, 6, 8, 9] - - sorting.insertion_sort(a) - - self.assertEqual(expected, a) - - def test_100_example(self): - tmpl = list(range(0, 1000)) - a = tmpl[:] - random.shuffle(a) - expected = tmpl[:] - - sorting.insertion_sort(a) - - self.assertEqual(expected, a) - - def test_reversed_100_example(self): - tmpl = list(range(0, 1000)) - a = list(reversed(tmpl[:])) - expected = tmpl[:] - - sorting.insertion_sort(a) - - self.assertEqual(expected, a) - - def test_1000_example(self): - tmpl = list(range(0, 1000)) - a = tmpl[:] - random.shuffle(a) - expected = tmpl[:] - - sorting.insertion_sort(a) - - self.assertEqual(expected, a) - - -class TestMergeSort(unittest.TestCase): - - def test_example(self): - tmpl = [8, 2, 4, 9, 3, 6] - a = tmpl[:] - expected = [2, 3, 4, 6, 8, 9] - - actual = sorting.merge_sort(a) - - self.assertEqual(expected, actual) - - def test_100_example(self): - tmpl = list(range(0, 1000)) - a = tmpl[:] - random.shuffle(a) - expected = tmpl[:] - - actual = sorting.merge_sort(a) - - self.assertEqual(expected, actual) - - def test_reversed_100_example(self): - tmpl = list(range(0, 1000)) - a = list(reversed(tmpl[:])) - expected = tmpl[:] - - actual = sorting.merge_sort(a) - - self.assertEqual(expected, actual) - - def test_1000_example(self): - tmpl = list(range(0, 1000)) - a = tmpl[:] - random.shuffle(a) - expected = tmpl[:] - - actual = sorting.merge_sort(a) - - self.assertEqual(expected, actual) - - -if __name__ == '__main__': - unittest.main() diff --git a/oldstuff/PracticingAlgorithms/test_sorting.rb b/oldstuff/PracticingAlgorithms/test_sorting.rb deleted file mode 100644 index 4253cf3..0000000 --- a/oldstuff/PracticingAlgorithms/test_sorting.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'test/unit' -require 'sorting' - - -class TestSorting < Test::Unit::TestCase - def test_insertion_sort - tmpl = [8, 2, 4, 9, 3, 6] - a = Array.new(tmpl) - expected = [2, 3, 4, 6, 8, 9] - - insertion_sort(a) - assert_equal(expected, a) - end -end diff --git a/oldstuff/PracticingAndroid/.env b/oldstuff/PracticingAndroid/.env deleted file mode 100644 index e97440c..0000000 --- a/oldstuff/PracticingAndroid/.env +++ /dev/null @@ -1,2 +0,0 @@ -export ANDROID_HOME="${ANDROID_HOME-"$HOME/opt/android-sdk-linux"}" -export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH" diff --git a/oldstuff/PracticingAndroid/HelloAndroid/.gitignore b/oldstuff/PracticingAndroid/HelloAndroid/.gitignore deleted file mode 100644 index e614fbb..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin -gen diff --git a/oldstuff/PracticingAndroid/HelloAndroid/AndroidManifest.xml b/oldstuff/PracticingAndroid/HelloAndroid/AndroidManifest.xml deleted file mode 100644 index a5f7d92..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/oldstuff/PracticingAndroid/HelloAndroid/ant.properties b/oldstuff/PracticingAndroid/HelloAndroid/ant.properties deleted file mode 100644 index ee52d86..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/ant.properties +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used to override default values used by the Ant build system. -# -# This file must be checked in Version Control Systems, as it is -# integral to the build system of your project. - -# This file is only used by the Ant script. - -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. - -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. - diff --git a/oldstuff/PracticingAndroid/HelloAndroid/build.xml b/oldstuff/PracticingAndroid/HelloAndroid/build.xml deleted file mode 100644 index 8e362c3..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/build.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/oldstuff/PracticingAndroid/HelloAndroid/local.properties b/oldstuff/PracticingAndroid/HelloAndroid/local.properties deleted file mode 100644 index e2dcd89..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/local.properties +++ /dev/null @@ -1,10 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must *NOT* be checked in Version Control Systems, -# as it contains information specific to your local configuration. - -# location of the SDK. This is only used by Ant -# For customization when using a Version Control System, please read the -# header note. -sdk.dir=/home/me/opt/android-sdk-linux diff --git a/oldstuff/PracticingAndroid/HelloAndroid/proguard.cfg b/oldstuff/PracticingAndroid/HelloAndroid/proguard.cfg deleted file mode 100644 index b1cdf17..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/proguard.cfg +++ /dev/null @@ -1,40 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/oldstuff/PracticingAndroid/HelloAndroid/project.properties b/oldstuff/PracticingAndroid/HelloAndroid/project.properties deleted file mode 100644 index f049142..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/project.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-10 diff --git a/oldstuff/PracticingAndroid/HelloAndroid/res/layout/main.xml b/oldstuff/PracticingAndroid/HelloAndroid/res/layout/main.xml deleted file mode 100644 index 15f4586..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/res/layout/main.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/oldstuff/PracticingAndroid/HelloAndroid/res/values/strings.xml b/oldstuff/PracticingAndroid/HelloAndroid/res/values/strings.xml deleted file mode 100644 index 7dabdc6..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - HelloAndroid - diff --git a/oldstuff/PracticingAndroid/HelloAndroid/src/com/mbh/HelloAndroid.java b/oldstuff/PracticingAndroid/HelloAndroid/src/com/mbh/HelloAndroid.java deleted file mode 100644 index c19432c..0000000 --- a/oldstuff/PracticingAndroid/HelloAndroid/src/com/mbh/HelloAndroid.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mbh; - -import android.app.Activity; -import android.os.Bundle; -import android.widget.TextView; - -public class HelloAndroid extends Activity { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - TextView tv = new TextView(this); - tv.setText("Hello, Android"); - setContentView(tv); - } -} diff --git a/oldstuff/PracticingC/.gitignore b/oldstuff/PracticingC/.gitignore deleted file mode 100644 index 640ef7a..0000000 --- a/oldstuff/PracticingC/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -* -!gowrikumar/bin -!gdbtut/bin -!*.i -!*.s -!*.c diff --git a/oldstuff/PracticingC/Makefile b/oldstuff/PracticingC/Makefile deleted file mode 100644 index 03c063e..0000000 --- a/oldstuff/PracticingC/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -CD = cd -RM = rm -v - -CC := gcc -CFLAGS := -std=c99 -Wall -g - -ALL_TARGETS := $(patsubst %.c,%,$(wildcard *.c)) - -export CD RM CFLAGS - - -all: $(ALL_TARGETS) - $(CD) gowrikumar && $(MAKE) - $(CD) gdbtut && $(MAKE) - -clean: - $(CD) gowrikumar && $(MAKE) clean - $(CD) gdbtut && $(MAKE) clean - - -.PHONY: all clean diff --git a/oldstuff/PracticingC/README b/oldstuff/PracticingC/README deleted file mode 100644 index 52b53eb..0000000 --- a/oldstuff/PracticingC/README +++ /dev/null @@ -1,3 +0,0 @@ -I don't get paid to write C for a living, so I have to sneak in practice here -and there. Maybe once the kiddo goes to college I can become a kernel hacker -:-P (assuming there's still such a thing as a kernel.) diff --git a/oldstuff/PracticingC/gdbtut/Makefile b/oldstuff/PracticingC/gdbtut/Makefile deleted file mode 100644 index d7d488d..0000000 --- a/oldstuff/PracticingC/gdbtut/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# tutorial exercises from http://www.unknownroad.com/rtfm/gdbtut/ - -BINDIR := $(PWD)/bin -export BINDIR - - -all: - $(CD) src && $(MAKE) - -clean: - $(RM) $(BINDIR)/* - - -.PHONY: all clean diff --git a/oldstuff/PracticingC/gdbtut/bin/.keep b/oldstuff/PracticingC/gdbtut/bin/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/PracticingC/gdbtut/src/Makefile b/oldstuff/PracticingC/gdbtut/src/Makefile deleted file mode 100644 index 854655b..0000000 --- a/oldstuff/PracticingC/gdbtut/src/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# tutorial exercises from http://www.unknownroad.com/rtfm/gdbtut/ - -ALL_BIN := $(patsubst %.c,$(BINDIR)/%,$(wildcard *.c)) - - -$(BINDIR)/%: %.c - $(CC) $(CFLAGS) -o $@ $< - -all: $(ALL_BIN) - - -.PHONY: all diff --git a/oldstuff/PracticingC/gdbtut/src/segfault.c b/oldstuff/PracticingC/gdbtut/src/segfault.c deleted file mode 100644 index 11e93a1..0000000 --- a/oldstuff/PracticingC/gdbtut/src/segfault.c +++ /dev/null @@ -1,28 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include -#include - -int main(int argc, char **argv) -{ - char *buf; - long long huge = 8000000000000000000; - /* Okay, so this is *not* going to segfault because - * the way memory is allocated has changed since - * the tutorial was written. The segfault is supposed - * to happen when more memory is allocated than is - * available on the machine. So much for that exercise. - */ - - buf = malloc(huge); - - fgets(buf, 1024, stdin); - printf("%s\n", buf); - - return 1; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/Makefile b/oldstuff/PracticingC/gowrikumar/Makefile deleted file mode 100644 index 37177b9..0000000 --- a/oldstuff/PracticingC/gowrikumar/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# puzzles from http://www.gowrikumar.com/c/ - -BINDIR := $(PWD)/bin -export BINDIR - - -all: - $(CD) src && $(MAKE) - -clean: - $(RM) $(BINDIR)/* - - -.PHONY: all clean diff --git a/oldstuff/PracticingC/gowrikumar/bin/.keep b/oldstuff/PracticingC/gowrikumar/bin/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/PracticingC/gowrikumar/src/00-sizeof.c b/oldstuff/PracticingC/gowrikumar/src/00-sizeof.c deleted file mode 100644 index 8981bfe..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/00-sizeof.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - - -int array[] = {23, 34, 12, 17, 204, 99, 16}; -#define TOTAL_ELEMENTS sizeof(array) / sizeof(array[0]) - - -int main() -{ - int d; - -#ifdef DEBUG - printf("sizeof(array) = %d\n", TOTAL_ELEMENTS); -#endif - - for (d = 0; d < TOTAL_ELEMENTS ; d++) - printf("%d\n", array[d]); - - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/02-dowhile.c b/oldstuff/PracticingC/gowrikumar/src/02-dowhile.c deleted file mode 100644 index eba0649..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/02-dowhile.c +++ /dev/null @@ -1,20 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -int main() -{ - int i = 1; - do - { - printf("%d\n", i); - } while(++i < 15); - return 0; -} - - - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/03-stdoutbuf.c b/oldstuff/PracticingC/gowrikumar/src/03-stdoutbuf.c deleted file mode 100644 index 4cf1fb1..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/03-stdoutbuf.c +++ /dev/null @@ -1,22 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include -#include - -int main() -{ - printf("(Hit ^C to stop the madness.)\n"); - while(1) - { - fprintf(stdout, "hello-out "); - fprintf(stderr, "hello-err "); - sleep(1); - } - return 0; -} - - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/03b-stdoutbuf.c b/oldstuff/PracticingC/gowrikumar/src/03b-stdoutbuf.c deleted file mode 100644 index deb9800..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/03b-stdoutbuf.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include -#include - -int main() -{ - printf("This time we'll include \\n!\n"); - printf("(Hit ^C to stop the madness.)\n"); - while(1) - { - fprintf(stdout, "hello-out\n"); - fprintf(stderr, "hello-err\n"); - sleep(1); - } - return 0; -} - - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/03c-stdoutbuf.c b/oldstuff/PracticingC/gowrikumar/src/03c-stdoutbuf.c deleted file mode 100644 index 0402ec2..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/03c-stdoutbuf.c +++ /dev/null @@ -1,24 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include -#include - -int main() -{ - printf("This time we'll flush stdout!\n"); - printf("(Hit ^C to stop the madness.)\n"); - while(1) - { - fprintf(stdout, "hello-out "); - fprintf(stderr, "hello-err "); - fflush(stdout); - sleep(1); - } - return 0; -} - - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/04-macrodef.c b/oldstuff/PracticingC/gowrikumar/src/04-macrodef.c deleted file mode 100644 index 30b641f..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/04-macrodef.c +++ /dev/null @@ -1,19 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -#define f(a, b) a##b -#define g(a) #a -#define h(a) g(a) - -int main() -{ - printf("%s\n", h(f(1, 2))); - printf("%s\n", g(f(1, 2))); - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/04b-macrodef.c b/oldstuff/PracticingC/gowrikumar/src/04b-macrodef.c deleted file mode 100644 index 3dd0bc4..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/04b-macrodef.c +++ /dev/null @@ -1,42 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -#define f(a, b) a##b -#define g(a) #a -#define h(a) g(a) -#define border(c) \ - for (int i = 0; i < 60; i++) { \ - printf(c); \ - } \ - printf("\n"); - -int main() -{ - printf("%s\n", h(f(1, 2))); - printf("%s\n", g(f(1, 2))); - - printf("%s\n", g(printf("dogs rule cats drool\n"))); - - char * hambones = "Cats! " g(ham); - char * bonesham = "Meats! " g(bones); - char * tmp; - - border("-"); - printf("bonesham = %s\n", bonesham); - printf("hambones = %s\n", hambones); - - border("-"); - tmp = f(ham, bones); - f(ham, bones) = f(bones, ham); - f(bones, ham) = tmp; - - printf("bonesham = %s\n", bonesham); - printf("hambones = %s\n", hambones); - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/05-switchint.c b/oldstuff/PracticingC/gowrikumar/src/05-switchint.c deleted file mode 100644 index 6a5b568..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/05-switchint.c +++ /dev/null @@ -1,24 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include -int main() -{ - int a=10; - switch(a) - { - case '1': - printf("ONE\n"); - break; - case '2': - printf("TWO\n"); - break; - defa1ut: - printf("NONE\n"); - } - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/05b-switchint.c b/oldstuff/PracticingC/gowrikumar/src/05b-switchint.c deleted file mode 100644 index 99368be..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/05b-switchint.c +++ /dev/null @@ -1,32 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#define MAGIC_NUMBER 10 - -#include -int main() -{ - int a = MAGIC_NUMBER; - switch(a) - { - case '1': - printf("ONE\n"); - break; - case '2': - printf("TWO\n"); - break; - defalut: - printf("NO CAN SPELL\n"); - break; - defau1t: - printf("SO CLOSE, YET SO FAR\n"); - break; - default: - printf("NONE\n"); - } - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/06-ia64segfault.c b/oldstuff/PracticingC/gowrikumar/src/06-ia64segfault.c deleted file mode 100644 index 6e35d74..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/06-ia64segfault.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -int main() -{ - int* p; - p = (int*)malloc(sizeof(int)); - *p = 10; - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/06b-ia64segfault.c b/oldstuff/PracticingC/gowrikumar/src/06b-ia64segfault.c deleted file mode 100644 index 57bc6f2..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/06b-ia64segfault.c +++ /dev/null @@ -1,29 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include -#include - -int main() -{ - int* p; - - size_t size_of_int = sizeof(int); - printf("sizeof(int) = %d\n", size_of_int); - - p = (int*)malloc(sizeof(int)); - - size_t size_of_p = sizeof(p); - printf("sizeof(p) = %d\n", size_of_p); - - *p = 10; - - size_t size_of_ptr_p = sizeof(*p); - printf("sizeof(*p) = %d\n", size_of_ptr_p); - - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/07-countbits.c b/oldstuff/PracticingC/gowrikumar/src/07-countbits.c deleted file mode 100644 index aad54a4..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/07-countbits.c +++ /dev/null @@ -1,40 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -static unsigned int mask[] = { - 0x55555555, - 0x33333333, - 0x0F0F0F0F, - 0x00FF00FF, - 0x0000FFFF -}; - - -int get_bit_count(unsigned int x) -{ - - int i; - int shift; /* Number of positions to shift to right*/ - for (i = 0, shift = 1; i < 5; i++, shift *= 2) { - x = (x & mask[i]) + ((x >> shift) & mask[i]); - } - return x; -} - - -int main() -{ - int to_test[] = {0, 5, 7}; - int current; - - for (int i = 0; i < 3 ; i++) { - current = to_test[i]; - printf("get_bit_count(%d) = %d\n", current, get_bit_count(current)); - } -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/07b-countbits.c b/oldstuff/PracticingC/gowrikumar/src/07b-countbits.c deleted file mode 100644 index e363587..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/07b-countbits.c +++ /dev/null @@ -1,67 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -static unsigned int mask[] = { - 0x55555555, - 0x33333333, - 0x0F0F0F0F, - 0x00FF00FF, - 0x0000FFFF -}; - - -int get_bit_count(unsigned int x) -{ - printf("get_bit_count(%d)\n", x); - - int i; - int x_and_mask; - int x_shifted; - int x_shifted_and_mask; - int shift; /* Number of positions to shift to right*/ - for (i = 0, shift = 1; i < 5; i++, shift *= 2) { - printf(" START loop\n"); - printf(" i = %d, x = %d, shift = %d\n", i, x, shift); - - x_and_mask = x & mask[i]; - printf(" x & mask[i] = %d\n", x_and_mask); - - x_shifted = x >> shift; - printf(" x >> shift = %d\n", x_shifted); - - x_shifted_and_mask = x_shifted & mask[i]; - printf(" (x >> shift) & mask[i] = %d\n", x_shifted_and_mask); - - x = x_and_mask + x_shifted_and_mask; - printf(" x = %d\n", x); - printf(" END loop\n"); - } - - return x; -} - - -int main() -{ - int to_test[] = {0, 5, 7}; - int current; - - /* - size_t mask_len = sizeof(mask) / sizeof(unsigned int); - - for (int i = 0; i < mask_len; i++) { - printf("mask[%d] = %d\n", i, mask[i]); - } - */ - - for (int i = 0; i < 3 ; i++) { - current = to_test[i]; - printf("get_bit_count(%d) -> %d\n", current, get_bit_count(current)); - } -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/08-incrfloat.c b/oldstuff/PracticingC/gowrikumar/src/08-incrfloat.c deleted file mode 100644 index cae6c20..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/08-incrfloat.c +++ /dev/null @@ -1,26 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -int main() -{ - float f = 0.0f; - int i; - - for (i = 0; i < 10; i++) { - f = f + 0.1f; - } - - if (f == 1.0f) { - printf("f is 1.0 \n"); - } else { - printf("f is NOT 1.0\n"); - } - - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/08b-incrfloat.c b/oldstuff/PracticingC/gowrikumar/src/08b-incrfloat.c deleted file mode 100644 index 782aedb..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/08b-incrfloat.c +++ /dev/null @@ -1,43 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include -#include - -int main() -{ - float f = 0.0f; - int i; - - for (i = 0; i < 10; i++) { - f = f + 0.1f; - } - - if (f == 1.0) { - printf("f is 1.0 \n"); - /* nope! */ - } - - if (f == 1.000000) { - printf("f is perhaps 1.000000?\n"); - /* nope again */ - } - - printf("f is neither 1.0 nor 1.000000\n"); - printf("(f is really %.24f)\n", f); - printf("OH NOES!\n"); - printf("But...\n"); - - double difference = fabs(f - 1.000000); - - if (difference < 0.00001) { - printf("f is close enough to 1.000000 (off by %.24f)\n", difference); - /* yes? */ - } - - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/09-multipleassignment.c b/oldstuff/PracticingC/gowrikumar/src/09-multipleassignment.c deleted file mode 100644 index 3cf7b4b..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/09-multipleassignment.c +++ /dev/null @@ -1,20 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -int main() -{ - /* FIXME: the comma after "a = 1" makes the compiler angry. Either the - * ", 2" should be removed or another assignment should be added. - int a = 1, 2; - */ - int a = 1, b = 2; - printf("a: %d\n", a); - printf("b: %d\n", b); - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/10-nestedprintf.c b/oldstuff/PracticingC/gowrikumar/src/10-nestedprintf.c deleted file mode 100644 index 857741c..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/10-nestedprintf.c +++ /dev/null @@ -1,15 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -int main() -{ - int i = 43; - printf("%d\n", printf("%d", printf("%d", i))); - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/10b-nestedprintf.c b/oldstuff/PracticingC/gowrikumar/src/10b-nestedprintf.c deleted file mode 100644 index 0e0304d..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/10b-nestedprintf.c +++ /dev/null @@ -1,17 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -int main() -{ - int i = 43, nprinted; - nprinted = printf("%d\n", printf("%d", printf("%d", i))); - nprinted = printf("(the last one was %d characters)\n", nprinted); - nprinted = printf("(and that was %d characters)\n", nprinted); - return 0; -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/11-duff.c b/oldstuff/PracticingC/gowrikumar/src/11-duff.c deleted file mode 100644 index bb7dbfd..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/11-duff.c +++ /dev/null @@ -1,37 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -void duff(register char *to, register char *from, register int count) -{ - register int n = (count + 7) / 8; - switch (count % 8) { - case 0: do { *to++ = *from++; - case 7: *to++ = *from++; - case 6: *to++ = *from++; - case 5: *to++ = *from++; - case 4: *to++ = *from++; - case 3: *to++ = *from++; - case 2: *to++ = *from++; - case 1: *to++ = *from++; - } while (--n > 0); - } -} - -int main() -{ - char * to = "dogs cats babies"; - char * from = "monkey hat pants"; - int i = 16; - printf("to = %s\n", to); - printf("from = %s\n", from); - /* And here comes the segfault... */ - duff(to, from, i); - printf("to = %s\n", to); - printf("from = %s\n", from); -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/11b-duff.c b/oldstuff/PracticingC/gowrikumar/src/11b-duff.c deleted file mode 100644 index 3139220..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/11b-duff.c +++ /dev/null @@ -1,40 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - -void duff(register char *to, register char *from, register int count) -{ - register int n; - - int remainder = count % 8; - if (remainder == 0) { - n = (count + 7) / 8; - do { - *to++ = *from++; - } while (--n > 0); - } else if (remainder <= 7 && remainder > 0) { - int i; - int c; - for (i = 0; (c = from[i] && c != EOF); i++) { - to[i] = c; - } - } -} - -int main() -{ - char * to = "dogs cats babies"; - char * from = "monkey hat pants"; - int i = 11; - printf("to = %s\n", to); - printf("from = %s\n", from); - /* And here comes the segfault... */ - duff(to, from, i); - printf("to = %s\n", to); - printf("from = %s\n", from); -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/12-countbits2.c b/oldstuff/PracticingC/gowrikumar/src/12-countbits2.c deleted file mode 100644 index d79e1ce..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/12-countbits2.c +++ /dev/null @@ -1,32 +0,0 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - -#include - - -int get_bit_count(unsigned int x) -{ - int count=0; - while(x) - { - count++; - x = x&(x-1); - } - return count; -} - - -int main() -{ - int to_test[] = {0, 5, 7}; - int current; - - for (int i = 0; i < 3 ; i++) { - current = to_test[i]; - printf("get_bit_count(%d) = %d\n", current, get_bit_count(current)); - } -} - -/* vim:filetype=c:fileencoding=utf-8 - */ diff --git a/oldstuff/PracticingC/gowrikumar/src/Makefile b/oldstuff/PracticingC/gowrikumar/src/Makefile deleted file mode 100644 index 738079a..0000000 --- a/oldstuff/PracticingC/gowrikumar/src/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# puzzles from http://www.gowrikumar.com/c/ - -ALL_BIN := $(patsubst %.c,$(BINDIR)/%,$(wildcard *.c)) - - -$(BINDIR)/%: %.c - $(CC) $(CFLAGS) -o $@ $< - -all: $(ALL_BIN) - - -.PHONY: all diff --git a/oldstuff/PracticingC/socky.c b/oldstuff/PracticingC/socky.c deleted file mode 100644 index cf27e98..0000000 --- a/oldstuff/PracticingC/socky.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include -#include -#include - -const char *SOCKNAME = "/tmp/socky"; -int sfd; -struct sockaddr_un addr; - - -int main(int argc, char *argv[]) -{ - sfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (sfd == -1) { - fprintf(stderr, "FAILED TO ALLOCATE SOCKET\n"); - goto error; - } - - memset(&addr, 0, sizeof(struct sockaddr_un)); - addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, SOCKNAME, sizeof(addr.sun_path) - 1); - - if (bind(sfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) == -1) { - fprintf(stderr, "FAILED TO BIND SOCKET TO ADDRESS\n"); - goto error; - } - - if (listen(sfd, 128) == -1) { - fprintf(stderr, "FAILED TO LISTEN ON ADDRESS\n"); - goto error; - } - - for (;;) { - fprintf(stdout, "ATTEMPTING TO WAIT FOR REQUEST ON %s\n", SOCKNAME); - if (accept(sfd, NULL, NULL) == -1) { - fprintf(stderr, "FAILED TO ACCEPT REQUEST ON ADDRESS\n"); - goto error; - } - } - - return 0; - -error: - return 1; - -} diff --git a/oldstuff/RubyFun/.gitignore b/oldstuff/RubyFun/.gitignore deleted file mode 100644 index f13477d..0000000 --- a/oldstuff/RubyFun/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.log -koans/.path_progress -*.sqlite3 -.rbenv-version -*.rbc diff --git a/oldstuff/RubyFun/README b/oldstuff/RubyFun/README deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/cookbook/007/01.rb b/oldstuff/RubyFun/cookbook/007/01.rb deleted file mode 100644 index 7d8b721..0000000 --- a/oldstuff/RubyFun/cookbook/007/01.rb +++ /dev/null @@ -1,28 +0,0 @@ -# WRONG -# aBlock = { |x| puts x } - -# RIGHT -aBlock = lambda { |x| puts x } - -aBlock.call "Hello World!" - - -def my_lambda(&aBlock) - aBlock -end - -b = my_lambda { puts "Hello World My Way!" } -b.call - -aBlock = Proc.new { |x| puts x } -aBlock = proc { |x| puts x } -aBlock = lambda { |x| puts x } - -add_lambda = lambda { |x,y| x + y } -# add_lambda.call(4) -# add_lambda.call(4,5,6) -puts add_lambda.call(4,2) - -add_procnew = Proc.new { |x,y| x + y } -# add_procnew.call(4) -puts add_procnew.call(4,5,6) diff --git a/oldstuff/RubyFun/cookbook/007/02.rb b/oldstuff/RubyFun/cookbook/007/02.rb deleted file mode 100644 index f77aeb4..0000000 --- a/oldstuff/RubyFun/cookbook/007/02.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'pp' - -def call_twice - puts "Calling your block." - ret1 = yield("very first") - puts "The value of your block: #{ret1}" - - puts "Calling your block again." - ret2 = yield("second") - puts "The value of your block: #{ret2}" -end - -call_twice do |which_time| - puts "I'm a code block, called for the #{which_time} time." - which_time == "very first" ? 1 : 2 -end - - -class Hash - def find_all - new_hash = Hash.new - each { |k,v| new_hash[k] = v if yield(k, v) } - new_hash - end -end - -squares = {0=>0, 1=>1, 2=>4, 3=>9} -print "squares = " -pp squares -(squares.find_all { |key, value| key > 1 }).each { |k,v| puts "#{k}: #{v}" } diff --git a/oldstuff/RubyFun/cookbook/007/intro.rb b/oldstuff/RubyFun/cookbook/007/intro.rb deleted file mode 100644 index e0efa46..0000000 --- a/oldstuff/RubyFun/cookbook/007/intro.rb +++ /dev/null @@ -1,39 +0,0 @@ -[1, 2, 3].each { |i| puts i } - -[1, 2, 3].each do |i| - if i % 2 == 0 - puts "#{i} is even." - else - puts "#{i} is odd." - end -end - -1.upto 3 do |x| - puts x -end - -1.upto(3) { |x| puts x } - -hello = lambda { "Hello" } -hello.call - -log = lambda { |str| puts "[LOG] #{str}" } -log.call("A test log message.") - -{1=>2, 2=>4}.each { |k,v| puts "Key #{k}, value #{v}" } - -def times_n(n) - lambda { |x| x * n } -end - -times_ten = times_n(10) -puts times_ten.call(5) -puts times_ten.call(1.25) - -circumference = times_n(2*Math::PI) -puts circumference.call(10) -puts circumference.call(3) -puts [1, 2, 3].collect(&circumference) - -ceiling = 50 -puts [1, 10, 49, 50.1, 200].select { |x| x < ceiling } diff --git a/oldstuff/RubyFun/cookbook/014/01.rb b/oldstuff/RubyFun/cookbook/014/01.rb deleted file mode 100644 index 74290ff..0000000 --- a/oldstuff/RubyFun/cookbook/014/01.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'open-uri' -puts 'using "open-uri"' -puts open('http://oreilly.com/').read(200) - -# ------------------------------------------------------------ -require 'net/http' -puts 'using "net/http"' -response = Net::HTTP.get_response('oreilly.com', '/about/') -puts 'response.code=' + response.code.to_s -puts 'response.body.size=' + response.body.size.to_s -puts 'response[\'Content-type\']=' + response['Content-type'] -puts 'response[0, 200]' + response.body[0, 200] - - -# ------------------------------------------------------------ -require 'uri' -puts 'using "net/http" with a URI' -puts 'request object:' + \ - Net::HTTP.get(URI.parse("http://oreilly.com")).to_s -response = Net::HTTP.get_response(URI.parse("http://oreilly.com/about/")) - -# ......... -puts "Success!" if response.is_a? Net::HTTPOK - -puts case response.code[0] - when ?1 then "Status code indicates an HTTP informational response." - when ?2 then "Status code indicates success." - when ?3 then "Status code indicates redirection." - when ?4 then "Status code indicates client error." - when ?5 then "Status code indicates server error." - else "Non-standard status code." -end - -puts 'Server=' + response['Server'] -puts 'SERVER=' + response['SERVER'] - -puts 'all keys:' -response.each_key { |key| puts " #{key}" } - -Net::HTTP.get_response('oreilly.com', '/about/') do |response| - response.read_body do |segment| - puts "Received segment of #{segment.size} byte(s)!" - end -end diff --git a/oldstuff/RubyFun/cookbook/014/02.rb b/oldstuff/RubyFun/cookbook/014/02.rb deleted file mode 100644 index 5f0ceea..0000000 --- a/oldstuff/RubyFun/cookbook/014/02.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'net/http' -require 'uri' - -uri = URI.parse("https://www.donotcall.gov/") -puts 'uri=' + uri.to_s - -request = Net::HTTP.new(uri.host, uri.port) -# response = request.get('/') -# ^--- would have resulted in an error - -require 'net/https' -puts 'making a request with use_ssl=true and verify_mode=VERIFY_NONE' -request.use_ssl = true -request.verify_mode = OpenSSL::SSL::VERIFY_NONE -response = request.get('/') - -puts 'response.body.size=' + response.body.size.to_s - - -request = Net::HTTP.new(uri.host, uri.port) -puts 'making a request with use_ssl=true, ' + \ - 'ca_path=/etc/ssl/certs and verify_mode=VERIFY_PEER' -request.use_ssl = true -request.ca_path = "/etc/ssl/certs/" -request.verify_mode = OpenSSL::SSL::VERIFY_PEER -response = request.get('/') - -puts 'response.body.size=' + response.body.size.to_s diff --git a/oldstuff/RubyFun/cookbook/014/03.rb b/oldstuff/RubyFun/cookbook/014/03.rb deleted file mode 100644 index a125699..0000000 --- a/oldstuff/RubyFun/cookbook/014/03.rb +++ /dev/null @@ -1,64 +0,0 @@ -require 'net/http' -require 'uri' - - -# A simple wrapper method that accepts either strings or URI objects -# and performs an HTTP GET. - -module Net - class HTTP - def HTTP.get_with_headers(uri, headers=nil) - uri = URI.parse(uri) if uri.respond_to? :to_str - start(uri.host, uri.port) do |http| - return http.get(uri.path, headers) - end - end - end -end - -# Let's get a web page in German. - -res = Net::HTTP.get_with_headers('http://www.google.com/', - {'Accept-Language' => 'de'}) - -# Check a bit of the body to make sure it's really in German -s = res.body.size -puts 'part of body in german=' + res.body[s-3670..s-3470].to_s - - -Net::HTTP.get_with_headers('http://www.google.com/', - {'User-Agent' => 'Ruby Web Browser v1.0'}) - - -uncompressed = Net::HTTP.get_with_headers('http://www.cnn.com/') -puts 'uncompressed body size=' + uncompressed.body.size.to_s - -gzipped = Net::HTTP.get_with_headers('http://www.cnn.com/', - {'Accept-Encoding' => 'gzip'}) -puts 'gzipped Content-Encoding=' + gzipped['Content-Encoding'] -puts 'gzipped body size=' + gzipped.body.size.to_s - -require 'zlib' -require 'stringio' - -body_io = StringIO.new(gzipped.body) -unzipped_body = Zlib::GzipReader.new(body_io).read() - -puts 'unzipped body size=' + unzipped_body.size.to_s - - -uri = URI.parse('http://www.google.com/') -request = Net::HTTP::Get.new(uri.path) -['en_us', 'en', 'en_gb', 'ja'].each do |language| - request.add_field('Accept-Language', language) -end -puts 'request[\'Accept-Language\']=' + request['Accept-Language'].to_s - -Net::HTTP.start(uri.host, uri.port) do |http| - response = http.request(request) - puts 'response[\'Content-Type\']=' + response['Content-Type'] - puts 'response headers:' - response.each_key do |key| - puts " #{key}" - end -end diff --git a/oldstuff/RubyFun/cookbook/014/04-list-a-to-z-domain-addrs-concurrent.rb b/oldstuff/RubyFun/cookbook/014/04-list-a-to-z-domain-addrs-concurrent.rb deleted file mode 100644 index 6065188..0000000 --- a/oldstuff/RubyFun/cookbook/014/04-list-a-to-z-domain-addrs-concurrent.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'resolv' -require 'resolv-replace' - - -def multiple_lookup(*names) - dns = Resolv::DNS.new - results = {} - threads = [] - names.each do |name| - threads << Thread.new(name) do |name| - begin - dns.each_address(name) { |a| (results[name] ||= []) << a } - rescue Resolv::ResolvError - results[name] = nil - end - end - end - threads.each { |t| t.join } - return results -end - - -domains = ("a".."z").collect { |l| l + '.com' } -multiple_lookup(*domains).sort.each do |name, addresses| - if addresses - puts "#{name}: #{addresses.size} " + \ - "address#{addresses.size == 1 ? "" : "es"}" - end -end diff --git a/oldstuff/RubyFun/cookbook/014/04-list-oreilly-mx-ns.rb b/oldstuff/RubyFun/cookbook/014/04-list-oreilly-mx-ns.rb deleted file mode 100644 index 25a91bd..0000000 --- a/oldstuff/RubyFun/cookbook/014/04-list-oreilly-mx-ns.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'resolv' - -dns = Resolv::DNS.new -domain = "oreilly.com" -dns.each_resource(domain, Resolv::DNS::Resource::IN::MX) do |mail_server| - puts mail_server.exchange -end - -dns.each_resource(domain, Resolv::DNS::Resource::IN::NS) do |nameserver| - puts nameserver.name -end diff --git a/oldstuff/RubyFun/cookbook/014/04.rb b/oldstuff/RubyFun/cookbook/014/04.rb deleted file mode 100644 index 93b1e3c..0000000 --- a/oldstuff/RubyFun/cookbook/014/04.rb +++ /dev/null @@ -1,3 +0,0 @@ -require 'resolv' - -Resolv::DNS.new.each_address('oreilly.com') { |addr| puts addr } diff --git a/oldstuff/RubyFun/cookbook/014/05-headerful-message.rb b/oldstuff/RubyFun/cookbook/014/05-headerful-message.rb deleted file mode 100644 index 074c18e..0000000 --- a/oldstuff/RubyFun/cookbook/014/05-headerful-message.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'rubygems' -require 'action_mailer' - - -class SimpleMailer < ActionMailer::Base - def headerful_message - @headers['X-custom-header'] = 'Its value' - body 'Body' - end -end - - -puts SimpleMailer.headerful_message diff --git a/oldstuff/RubyFun/cookbook/014/05-minimalist.rb b/oldstuff/RubyFun/cookbook/014/05-minimalist.rb deleted file mode 100644 index 128aecb..0000000 --- a/oldstuff/RubyFun/cookbook/014/05-minimalist.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'rubygems' -require 'net/smtp' -require 'smtp-tls' - - -body = < mime_type, - :encoding => ('quoted-printable' if content_type =~ /^text\//), - :content => File.read(path) - } - end - end - end -end - - -puts SimpleMailer.directory_dump_message('daniel.buch+rubytest@gmail.com', - '/tmp') diff --git a/oldstuff/RubyFun/cookbook/014/05.rb b/oldstuff/RubyFun/cookbook/014/05.rb deleted file mode 100644 index 57a70aa..0000000 --- a/oldstuff/RubyFun/cookbook/014/05.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'rubygems' -require 'action_mailer' - - -class SimpleMailer < ActionMailer::Base - def simple_message(recipient) - from 'daniel.buch@gmail.com' - recipients recipient - subject 'A single-part message for you' - body 'This message has a plain text body.' - end -end - - -puts 'generated message:' -puts SimpleMailer.simple_message('daniel.buch+rubytest@gmail.com') - - -ActionMailer::Base.smtp_settings = { - :tls => true, - :address => 'smtp.gmail.com', - :port => "587", - :domain => 'gmail.com', - :user_name => 'daniel.buch@gmail.com', - :password => STDIN.readline -} - -SimpleMailer.simple_message('daniel.buch+rubytest@gmail.com').deliver diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/.gitignore b/oldstuff/RubyFun/cookbook/015/hodgepodge/.gitignore deleted file mode 100644 index f0fa30c..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.bundle -db/*.sqlite3 -log/*.log -tmp/ diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/Gemfile b/oldstuff/RubyFun/cookbook/015/hodgepodge/Gemfile deleted file mode 100644 index 52969ce..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/Gemfile +++ /dev/null @@ -1,31 +0,0 @@ -source 'http://rubygems.org' - -gem 'rails', '3.0.9' - -# Bundle edge Rails instead: -# gem 'rails', :git => 'git://github.com/rails/rails.git' - -gem 'sqlite3' - -# Use unicorn as the web server -# gem 'unicorn' - -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) -# gem 'ruby-debug' -# gem 'ruby-debug19', :require => 'ruby-debug' - -# Bundle the extra gems: -# gem 'bj' -# gem 'nokogiri' -# gem 'sqlite3-ruby', :require => 'sqlite3' -# gem 'aws-s3', :require => 'aws/s3' - -# Bundle gems for the local environment. Make sure to -# put test-only gems in this group so their generators -# and rake tasks are available in development mode: -# group :development, :test do -# gem 'webrat' -# end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/Gemfile.lock b/oldstuff/RubyFun/cookbook/015/hodgepodge/Gemfile.lock deleted file mode 100644 index 95136d2..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/Gemfile.lock +++ /dev/null @@ -1,76 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - abstract (1.0.0) - actionmailer (3.0.9) - actionpack (= 3.0.9) - mail (~> 2.2.19) - actionpack (3.0.9) - activemodel (= 3.0.9) - activesupport (= 3.0.9) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.5.0) - rack (~> 1.2.1) - rack-mount (~> 0.6.14) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.9) - activesupport (= 3.0.9) - builder (~> 2.1.2) - i18n (~> 0.5.0) - activerecord (3.0.9) - activemodel (= 3.0.9) - activesupport (= 3.0.9) - arel (~> 2.0.10) - tzinfo (~> 0.3.23) - activeresource (3.0.9) - activemodel (= 3.0.9) - activesupport (= 3.0.9) - activesupport (3.0.9) - arel (2.0.10) - builder (2.1.2) - erubis (2.6.6) - abstract (>= 1.0.0) - i18n (0.5.0) - mail (2.2.19) - activesupport (>= 2.3.6) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.16) - polyglot (0.3.2) - rack (1.2.3) - rack-mount (0.6.14) - rack (>= 1.0.0) - rack-test (0.5.7) - rack (>= 1.0) - rails (3.0.9) - actionmailer (= 3.0.9) - actionpack (= 3.0.9) - activerecord (= 3.0.9) - activeresource (= 3.0.9) - activesupport (= 3.0.9) - bundler (~> 1.0) - railties (= 3.0.9) - railties (3.0.9) - actionpack (= 3.0.9) - activesupport (= 3.0.9) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.4) - rake (0.9.2) - rdoc (3.9.1) - sqlite3 (1.3.4) - thor (0.14.6) - treetop (1.4.10) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.29) - -PLATFORMS - ruby - -DEPENDENCIES - rails (= 3.0.9) - sqlite3 diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/README b/oldstuff/RubyFun/cookbook/015/hodgepodge/README deleted file mode 100644 index fe7013d..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/README +++ /dev/null @@ -1,256 +0,0 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, create a new Rails application: - rails new myapp (where myapp is the application name) - -2. Change directory to myapp and start the web server: - cd myapp; rails server (run with --help for options) - -3. Go to http://localhost:3000/ and you'll see: - "Welcome aboard: You're riding Ruby on Rails!" - -4. Follow the guidelines to start developing your application. You can find -the following resources handy: - -* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html -* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands -running on the server.log and development.log. Rails will automatically display -debugging and runtime information to these files. Debugging info will also be -shown in the browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code -using the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are -several books available online as well: - -* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two books will bring you up to speed on the Ruby language and also on -programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your -Mongrel or WEBrick server with --debugger. This means that you can break out of -execution at any point in the code, investigate and change the model, and then, -resume execution! You need to install ruby-debug to run the server in debugging -mode. With gems, use sudo gem install ruby-debug. Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.find(:all) - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#nil, "body"=>nil, "id"=>"1"}>, - #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better, you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you can enter "cont". - - -== Console - -The console is a Ruby shell, which allows you to interact with your -application's domain model. Here you'll have all parts of the application -configured, just like it is when the application is running. You can inspect -domain models, change values, and save to the database. Starting the script -without arguments will launch it in the development environment. - -To start the console, run rails console from the application -directory. - -Options: - -* Passing the -s, --sandbox argument will rollback any modifications - made to the database. -* Passing an environment name as an argument will load the corresponding - environment. Example: rails console production. - -To reload your controllers and models after launching the console run -reload! - -More information about irb can be found at: -link:http://www.rubycentral.com/pickaxe/irb.html - - -== dbconsole - -You can go to the command line of your database directly through rails -dbconsole. You would be connected to the database with the credentials -defined in database.yml. Starting the script without arguments will connect you -to the development database. Passing an argument will connect you to a different -database, like rails dbconsole production. Currently works for MySQL, -PostgreSQL and SQLite 3. - -== Description of Contents - -The default directory structure of a generated Ruby on Rails application: - - |-- app - | |-- controllers - | |-- helpers - | |-- mailers - | |-- models - | `-- views - | `-- layouts - |-- config - | |-- environments - | |-- initializers - | `-- locales - |-- db - |-- doc - |-- lib - | `-- tasks - |-- log - |-- public - | |-- images - | |-- javascripts - | `-- stylesheets - |-- script - |-- test - | |-- fixtures - | |-- functional - | |-- integration - | |-- performance - | `-- unit - |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets - `-- vendor - `-- plugins - -app - Holds all the code that's specific to this particular application. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from - ApplicationController which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. Models descend from - ActiveRecord::Base by default. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use - eRuby syntax by default. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the - common header/footer method of wrapping views. In your views, define a layout - using the layout :default and create a file named default.html.erb. - Inside default.html.erb, call <% yield %> to render the view using this - layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are - generated for you automatically when using generators for controllers. - Helpers can be used to wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, - and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all the - sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when - generated using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that - doesn't belong under controllers, models, or helpers. This directory is in - the load path. - -public - The directory available for the web server. Contains subdirectories for - images, stylesheets, and javascripts. Also contains the dispatchers and the - default HTML files. This should be set as the DOCUMENT_ROOT of your web - server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the rails generate - command, template test files will be generated for you and placed in this - directory. - -vendor - External libraries that the application depends on. Also includes the plugins - subdirectory. If the app has frozen rails, those gems also go here, under - vendor/rails/. This directory is in the load path. diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/Rakefile b/oldstuff/RubyFun/cookbook/015/hodgepodge/Rakefile deleted file mode 100644 index 2731041..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) -require 'rake' - -Hodgepodge::Application.load_tasks diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/application_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/application_controller.rb deleted file mode 100644 index 5aa3f72..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/application_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class ApplicationController < ActionController::Base - before_filter :set_user, :count_visits - protect_from_forgery - - private - def count_visits - value = (cookies[:visits] || '0').to_i - cookies[:visits] = (value + 1).to_s - @visits = cookies[:visits] - end - - protected - def set_user - @user = User.find(session[:id]) if @user.nil? && session[:id] - end - - def login_required - return true if @user - access_denied - return false - end - - def access_denied - session[:return_to] = request.fullpath - flash[:error] = 'Oops. You need to login before you can view that page.' - redirect_to :controller => 'user', :action => 'login' - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/foo_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/foo_controller.rb deleted file mode 100644 index 4a38782..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/foo_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -class FooController < ApplicationController - layout :figure_out_layout - - def index - end - - def pretty - end - - def figure_out_layout - if action_name =~ /pretty/ - 'pretty' - else - 'standard' - end - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/hello_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/hello_controller.rb deleted file mode 100644 index 6d366c7..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/hello_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class HelloController < ApplicationController - def world - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/index_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/index_controller.rb deleted file mode 100644 index c671af1..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/index_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class IndexController < ApplicationController - def index - session[:first_time] ||= Time.now - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/list_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/list_controller.rb deleted file mode 100644 index ba59ce2..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/list_controller.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'sha1' - -class ListController < ApplicationController - def index - @list = [1, "string", :symbol, ['list']] - end - - def shopping_list - @list = [ListItem.new(4, 'aspirin'), ListItem.new(199, 'succotash')] - end - -end - - -class ListItem - attr_accessor :name, :id - def initialize(id, name) - @id, @name = id, name - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/novel_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/novel_controller.rb deleted file mode 100644 index 6ead1d8..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/novel_controller.rb +++ /dev/null @@ -1,25 +0,0 @@ -$one = 1 - -class NovelController < ApplicationController - $two = 2 - - def index - @title = 'Shattered View: a Novel on Rails' - one_plus_one = 1 + 1 - increment_counter one_plus_one - end - - def helper_method - @help_message = "I see you've come to me for help." - end - - def increment_counter(by) - @counter ||= 0 - @counter += by - end - - def sequel - $three = 3 - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/people_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/people_controller.rb deleted file mode 100644 index 05b6e39..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/people_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class PeopleController < ApplicationController - def list - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/status_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/status_controller.rb deleted file mode 100644 index f15057f..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/status_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -class StatusController < ApplicationController - def index - @title = "System Status" - time = Time.now - @time = time - @ps = `ps aux` - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/user_controller.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/user_controller.rb deleted file mode 100644 index 12243d8..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/controllers/user_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class UserController < ApplicationController - before_filter :login_required, :only => :my_account - - def login - @user = User.new - @user.username = params[:username] - end - - def process_login - if user = User.authenticate(params[:user]) - session[:id] = user.id - redirect_to session[:return_to] || '/' - else - flash[:error] = 'Invalid login.' - redirect_to :action => 'login', :username => params[:user][:username] - end - end - - def logout - reset_session - flash[:message] = 'Logged out.' - redirect_to :action => 'login' - end - - def my_account - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/application_helper.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/foo_helper.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/foo_helper.rb deleted file mode 100644 index c3ad23b..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/foo_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module FooHelper -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/index_helper.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/index_helper.rb deleted file mode 100644 index cdc64c7..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/index_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module IndexHelper -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/list_helper.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/list_helper.rb deleted file mode 100644 index a42342b..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/list_helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'sha1' - - -module ListHelper - def create_li(item, i) - %{
  • #{i}: - #{SHA1.new(item.object_id.to_s)}
  • } - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/people_helper.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/people_helper.rb deleted file mode 100644 index b682fbf..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/people_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PeopleHelper -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/user_helper.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/user_helper.rb deleted file mode 100644 index 0147c3f..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/helpers/user_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module UserHelper -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/models/person.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/models/person.rb deleted file mode 100644 index 2f2e286..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/models/person.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Person < ActiveRecord::Base -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/models/user.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/models/user.rb deleted file mode 100644 index bae339d..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/models/user.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'sha1' - - -class User < ActiveRecord::Base - attr_accessor :password - attr_protected :hashed_password - validates_uniqueness_of :username - validates_confirmation_of :password, :if => lambda { |user| - user.new_record? or not user.password.blank? } - validates_length_of :password, :within => 5..40, :if => lambda { |user| - user.new_record? or not user.password.blank? } - - def self.hashed(str) - SHA1.new(str).to_s - end - - def self.authenticate(user_info) - user = find_by_username(user_info[:username]) - if user && user.hashed_password == hashed(user_info[:password]) - return user - end - end - - private - before_save :update_password - - def update_password - if not password.blank? - self.hashed_password = self.class.hashed(password) - end - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/count.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/count.html.erb deleted file mode 100644 index 989eaad..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/count.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Foo#count

    -

    Find me in app/views/foo/count.html.erb

    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/index.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/index.html.erb deleted file mode 100644 index 6bdfb2d..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/index.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Foo#index

    -

    Find me in app/views/foo/index.html.erb

    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/pretty.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/pretty.html.erb deleted file mode 100644 index bfdd816..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/foo/pretty.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Foo#pretty

    -

    Find me in app/views/foo/pretty.html.erb

    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/hello/world.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/hello/world.html.erb deleted file mode 100644 index 437bdda..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/hello/world.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -

    Several increasingly silly ways of displaying “Hello world!”:

    - -

    <%= "Hello world!" %>

    -

    <%= "Hello" + " world!" %>

    -

    <%= w = "world" - "Hello #{w}!" %>

    -

    <%= 'H' + ?e.chr + ('l' * 2) %><%= ('o word!').gsub('d', 'ld')%>

    - -<% hello = "Hello" %> -<% world = "world!" %> -<%= hello %> <%= world %> diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/index/index.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/index/index.html.erb deleted file mode 100644 index a9a9f1f..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/index/index.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -

    You first visited this site on <%= session[:first_time] %>.

    -

    That was <%= time_ago_in_words session[:first_time] %> ago.

    - -

    You have visited this website's pages <%= @visits %> time(s).

    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/application.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/application.html.erb deleted file mode 100644 index 14d6924..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/application.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - - My Website - <%= @title %> - - - <%= yield %> - - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/bar.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/bar.html.erb deleted file mode 100644 index 5dff588..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/bar.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - - BAR :: My Website - <%= @title %> - - - <%= yield %> - - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/count.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/count.html.erb deleted file mode 100644 index 3fa27c6..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/count.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - - COUNT :: My Website - <%= @title %> - - - <%= yield %> - - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/pretty.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/pretty.html.erb deleted file mode 100644 index 945a4c4..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/pretty.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - - - - My Pretty Website - <%= @title %> - - - - <%= yield %> - - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/standard.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/standard.html.erb deleted file mode 100644 index 18294ba..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/layouts/standard.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - - My Plain Website - <%= @title %> - - - <%= yield %> - - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/_new_item_form.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/_new_item_form.html.erb deleted file mode 100644 index 6337696..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/_new_item_form.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= form_tag :action => 'new' do %> - Item: <%= text_field "item", "value" %> - <%= submit_tag "Add new item" %> -<% end %> diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/index.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/index.html.erb deleted file mode 100644 index 0e91ea4..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/index.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -
      - <% @list.each_with_index do |item, i| %> - <%= create_li(item, i).html_safe %> - <% end %> -
    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/shopping_list.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/shopping_list.html.erb deleted file mode 100644 index ae9d336..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/list/shopping_list.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -

    My shopping list

    - -
      - <% @list.each do |item| %> -
    • <%= item.name %> - <%= link_to 'Delete', {:action => 'delete', :id => item.id} %> -
    • - <% end %> -
    - -<%= render :partial => 'new_item_form' %> diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/novel/index.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/novel/index.html.erb deleted file mode 100644 index 6a61a90..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/novel/index.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

    <%= @title %>

    - -

    I looked up, but saw only the number <%= @counter %>

    - -

    “What are you doing here?” I asked sharply. “Was it - <%= @counter.succ %> who sent you?”

    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/novel/sequel.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/novel/sequel.html.erb deleted file mode 100644 index fd320c7..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/novel/sequel.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Here they come, the counting numbers, -<%= $one %>, <%= $two %>, <%= $three %>.

    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/people/list.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/people/list.html.erb deleted file mode 100644 index 42bbdde..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/people/list.html.erb +++ /dev/null @@ -1,6 +0,0 @@ - -
      - <% Person.find(:all).each do |person| %> -
    • Name: <%= person.name %>, Email: <%= person.email %>
    • - <% end %> -
    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/status/index.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/status/index.html.erb deleted file mode 100644 index d25b601..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/status/index.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    Processes running at <%= @time %>

    -
    <%= @ps %>
    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/login.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/login.html.erb deleted file mode 100644 index 07519fd..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/login.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<% if @flash %> - <% if @flash[:message] %> -
    <%= @flash[:message] %>
    - <% end %> - <% if @flash[:error] %> -
    <%= @flash[:error] %>
    - <% end %> -<% end %> - -<%= form_tag :action => 'process_login' do %> - <%= text_field "user", "username" %> - <%= password_field "user", "password" %> - <%= submit_tag %> -<% end %> diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/logout.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/logout.html.erb deleted file mode 100644 index 50d0aac..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/logout.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    User#logout

    -

    Find me in app/views/user/logout.html.erb

    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/my_account.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/my_account.html.erb deleted file mode 100644 index b9a7734..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/my_account.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -

    Account Info

    - -

    Your username is <%= User.find(session[:id]).username %> diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/process_login.html.erb b/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/process_login.html.erb deleted file mode 100644 index 2042592..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/app/views/user/process_login.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    User#process_login

    -

    Find me in app/views/user/process_login.html.erb

    diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config.ru b/oldstuff/RubyFun/cookbook/015/hodgepodge/config.ru deleted file mode 100644 index 9b8483c..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Hodgepodge::Application diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/application.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/application.rb deleted file mode 100644 index 78294d5..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/application.rb +++ /dev/null @@ -1,42 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -# If you have a Gemfile, require the gems listed there, including any gems -# you've limited to :test, :development, or :production. -Bundler.require(:default, Rails.env) if defined?(Bundler) - -module Hodgepodge - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # JavaScript files you want as :defaults (application.js is always included). - # config.action_view.javascript_expansions[:defaults] = %w(jquery rails) - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/boot.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/boot.rb deleted file mode 100644 index 4489e58..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/boot.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'rubygems' - -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/database.yml b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/database.yml deleted file mode 100644 index 90d87cc..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/database.yml +++ /dev/null @@ -1,22 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environment.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environment.rb deleted file mode 100644 index 0ebe39d..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path('../application', __FILE__) - -# Initialize the rails application -Hodgepodge::Application.initialize! diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/development.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/development.rb deleted file mode 100644 index 9f7ed4e..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/development.rb +++ /dev/null @@ -1,26 +0,0 @@ -Hodgepodge::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the webserver when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_view.debug_rjs = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin -end - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/production.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/production.rb deleted file mode 100644 index b0e2787..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/production.rb +++ /dev/null @@ -1,49 +0,0 @@ -Hodgepodge::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The production environment is meant for finished, "live" apps. - # Code is not reloaded between requests - config.cache_classes = true - - # Full error reports are disabled and caching is turned on - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Specifies the header that your server uses for sending files - config.action_dispatch.x_sendfile_header = "X-Sendfile" - - # For nginx: - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' - - # If you have no front-end server that supports something like X-Sendfile, - # just comment this out and Rails will serve the files - - # See everything in the log (default is :info) - # config.log_level = :debug - - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new - - # Use a different cache store in production - # config.cache_store = :mem_cache_store - - # Disable Rails's static asset server - # In production, Apache or nginx will already do this - config.serve_static_assets = false - - # Enable serving of images, stylesheets, and javascripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false - - # Enable threaded mode - # config.threadsafe! - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/test.rb deleted file mode 100644 index b719a5c..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/environments/test.rb +++ /dev/null @@ -1,35 +0,0 @@ -Hodgepodge::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/backtrace_silencers.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cd..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/inflections.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/inflections.rb deleted file mode 100644 index 9e8b013..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/mime_types.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/secret_token.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/secret_token.rb deleted file mode 100644 index 3aa1a76..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/secret_token.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -Hodgepodge::Application.config.secret_token = '7a03f0ee88caeb9a34a9fca7377dfe9a75e7a6a6c5ecbf17509e64eb10ccb657c6de563ebe11070baa65c99d221555017a128364fd1dd0a08669a46e837dd0b6' diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/session_store.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/session_store.rb deleted file mode 100644 index 16b9f35..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Hodgepodge::Application.config.session_store :cookie_store, :key => '_hodgepodge_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# Hodgepodge::Application.config.session_store :active_record_store diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/locales/en.yml b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/locales/en.yml deleted file mode 100644 index a747bfa..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/routes.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/config/routes.rb deleted file mode 100644 index 0d8b2c0..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/config/routes.rb +++ /dev/null @@ -1,72 +0,0 @@ -Hodgepodge::Application.routes.draw do - get "list/shopping_list" - - get "list/index" - - get "foo/count" - get "foo/index" - get "foo/pretty" - get "index/index" - get "people/list" - get "user/login" - get "user/logout" - get "user/my_account" - get "user/process_login" - - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - root :to => "index#index" - - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - match ':controller(/:action(/:id(.:format)))' -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/dbinit.sql b/oldstuff/RubyFun/cookbook/015/hodgepodge/db/dbinit.sql deleted file mode 100644 index 1add2d0..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/dbinit.sql +++ /dev/null @@ -1,14 +0,0 @@ -DROP TABLE IF EXISTS 'people'; -CREATE TABLE 'people' ( - 'id' INTEGER PRIMARY KEY ASC AUTOINCREMENT, - 'name' VARCHAR(255), - 'email' VARCHAR(255) -); - - -DROP TABLE IF EXISTS 'users'; -CREATE TABLE 'users' ( - 'id' INTEGER PRIMARY KEY ASC AUTOINCREMENT, - 'username' VARCHAR(255) NOT NULL, - 'hashed_password' VARCHAR(40) NOT NULL -); diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/migrate/20110810010431_create_people.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/db/migrate/20110810010431_create_people.rb deleted file mode 100644 index e1aa6dd..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/migrate/20110810010431_create_people.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreatePeople < ActiveRecord::Migration - def self.up - create_table :people do |t| - - t.timestamps - end - end - - def self.down - drop_table :people - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/migrate/20110810013840_create_users.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/db/migrate/20110810013840_create_users.rb deleted file mode 100644 index 9199bb3..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/migrate/20110810013840_create_users.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def self.up - create_table :users do |t| - - t.timestamps - end - end - - def self.down - drop_table :users - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/schema.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/db/schema.rb deleted file mode 100644 index f32b703..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/schema.rb +++ /dev/null @@ -1,29 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20110810013840) do - - create_table "people", :force => true do |t| - t.string "name" - t.string "email" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "users", :force => true do |t| - t.string "username" - t.string "hashed_password" - t.datetime "created_at" - t.datetime "updated_at" - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/seeds.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/db/seeds.rb deleted file mode 100644 index 664d8c7..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/db/seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) -# Mayor.create(:name => 'Daley', :city => cities.first) diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/doc/README_FOR_APP b/oldstuff/RubyFun/cookbook/015/hodgepodge/doc/README_FOR_APP deleted file mode 100644 index fe41f5c..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/lib/tasks/.gitkeep b/oldstuff/RubyFun/cookbook/015/hodgepodge/lib/tasks/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/log/.gitkeep b/oldstuff/RubyFun/cookbook/015/hodgepodge/log/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/404.html b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/404.html deleted file mode 100644 index 9a48320..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
    -

    The page you were looking for doesn't exist.

    -

    You may have mistyped the address or the page may have moved.

    -
    - - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/422.html b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/422.html deleted file mode 100644 index 83660ab..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
    -

    The change you wanted was rejected.

    -

    Maybe you tried to change something you didn't have access to.

    -
    - - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/500.html b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/500.html deleted file mode 100644 index b80307f..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/500.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
    -

    We're sorry, but something went wrong.

    -

    We've been notified about this issue and we'll take a look at it shortly.

    -
    - - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/favicon.ico b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/images/rails.png b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/images/rails.png deleted file mode 100644 index d5edc04..0000000 Binary files a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/images/rails.png and /dev/null differ diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/application.js b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/application.js deleted file mode 100644 index fe45776..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/application.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place your application-specific JavaScript functions and classes here -// This file is automatically included by javascript_include_tag :defaults diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/controls.js b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/controls.js deleted file mode 100644 index 7392fb6..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/controls.js +++ /dev/null @@ -1,965 +0,0 @@ -// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 - -// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan) -// (c) 2005-2009 Jon Tirsen (http://www.tirsen.com) -// Contributors: -// Richard Livsey -// Rahul Bhargava -// Rob Wills -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// Autocompleter.Base handles all the autocompletion functionality -// that's independent of the data source for autocompletion. This -// includes drawing the autocompletion menu, observing keyboard -// and mouse events, and similar. -// -// Specific autocompleters need to provide, at the very least, -// a getUpdatedChoices function that will be invoked every time -// the text inside the monitored textbox changes. This method -// should get the text for which to provide autocompletion by -// invoking this.getToken(), NOT by directly accessing -// this.element.value. This is to allow incremental tokenized -// autocompletion. Specific auto-completion logic (AJAX, etc) -// belongs in getUpdatedChoices. -// -// Tokenized incremental autocompletion is enabled automatically -// when an autocompleter is instantiated with the 'tokens' option -// in the options parameter, e.g.: -// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); -// will incrementally autocomplete with a comma as the token. -// Additionally, ',' in the above example can be replaced with -// a token array, e.g. { tokens: [',', '\n'] } which -// enables autocompletion on multiple tokens. This is most -// useful when one of the tokens is \n (a newline), as it -// allows smart autocompletion after linebreaks. - -if(typeof Effect == 'undefined') - throw("controls.js requires including script.aculo.us' effects.js library"); - -var Autocompleter = { }; -Autocompleter.Base = Class.create({ - baseInitialize: function(element, update, options) { - element = $(element); - this.element = element; - this.update = $(update); - this.hasFocus = false; - this.changed = false; - this.active = false; - this.index = 0; - this.entryCount = 0; - this.oldElementValue = this.element.value; - - if(this.setOptions) - this.setOptions(options); - else - this.options = options || { }; - - this.options.paramName = this.options.paramName || this.element.name; - this.options.tokens = this.options.tokens || []; - this.options.frequency = this.options.frequency || 0.4; - this.options.minChars = this.options.minChars || 1; - this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - Position.clone(element, update, { - setHeight: false, - offsetTop: element.offsetHeight - }); - } - Effect.Appear(update,{duration:0.15}); - }; - this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - - if(typeof(this.options.tokens) == 'string') - this.options.tokens = new Array(this.options.tokens); - // Force carriage returns as token delimiters anyway - if (!this.options.tokens.include('\n')) - this.options.tokens.push('\n'); - - this.observer = null; - - this.element.setAttribute('autocomplete','off'); - - Element.hide(this.update); - - Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); - }, - - show: function() { - if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && - (Prototype.Browser.IE) && - (Element.getStyle(this.update, 'position')=='absolute')) { - new Insertion.After(this.update, - ''); - this.iefix = $(this.update.id+'_iefix'); - } - if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); - }, - - fixIEOverlapping: function() { - Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); - this.iefix.style.zIndex = 1; - this.update.style.zIndex = 2; - Element.show(this.iefix); - }, - - hide: function() { - this.stopIndicator(); - if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); - if(this.iefix) Element.hide(this.iefix); - }, - - startIndicator: function() { - if(this.options.indicator) Element.show(this.options.indicator); - }, - - stopIndicator: function() { - if(this.options.indicator) Element.hide(this.options.indicator); - }, - - onKeyPress: function(event) { - if(this.active) - switch(event.keyCode) { - case Event.KEY_TAB: - case Event.KEY_RETURN: - this.selectEntry(); - Event.stop(event); - case Event.KEY_ESC: - this.hide(); - this.active = false; - Event.stop(event); - return; - case Event.KEY_LEFT: - case Event.KEY_RIGHT: - return; - case Event.KEY_UP: - this.markPrevious(); - this.render(); - Event.stop(event); - return; - case Event.KEY_DOWN: - this.markNext(); - this.render(); - Event.stop(event); - return; - } - else - if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || - (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; - - this.changed = true; - this.hasFocus = true; - - if(this.observer) clearTimeout(this.observer); - this.observer = - setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); - }, - - activate: function() { - this.changed = false; - this.hasFocus = true; - this.getUpdatedChoices(); - }, - - onHover: function(event) { - var element = Event.findElement(event, 'LI'); - if(this.index != element.autocompleteIndex) - { - this.index = element.autocompleteIndex; - this.render(); - } - Event.stop(event); - }, - - onClick: function(event) { - var element = Event.findElement(event, 'LI'); - this.index = element.autocompleteIndex; - this.selectEntry(); - this.hide(); - }, - - onBlur: function(event) { - // needed to make click events working - setTimeout(this.hide.bind(this), 250); - this.hasFocus = false; - this.active = false; - }, - - render: function() { - if(this.entryCount > 0) { - for (var i = 0; i < this.entryCount; i++) - this.index==i ? - Element.addClassName(this.getEntry(i),"selected") : - Element.removeClassName(this.getEntry(i),"selected"); - if(this.hasFocus) { - this.show(); - this.active = true; - } - } else { - this.active = false; - this.hide(); - } - }, - - markPrevious: function() { - if(this.index > 0) this.index--; - else this.index = this.entryCount-1; - this.getEntry(this.index).scrollIntoView(true); - }, - - markNext: function() { - if(this.index < this.entryCount-1) this.index++; - else this.index = 0; - this.getEntry(this.index).scrollIntoView(false); - }, - - getEntry: function(index) { - return this.update.firstChild.childNodes[index]; - }, - - getCurrentEntry: function() { - return this.getEntry(this.index); - }, - - selectEntry: function() { - this.active = false; - this.updateElement(this.getCurrentEntry()); - }, - - updateElement: function(selectedElement) { - if (this.options.updateElement) { - this.options.updateElement(selectedElement); - return; - } - var value = ''; - if (this.options.select) { - var nodes = $(selectedElement).select('.' + this.options.select) || []; - if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); - } else - value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); - - var bounds = this.getTokenBounds(); - if (bounds[0] != -1) { - var newValue = this.element.value.substr(0, bounds[0]); - var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); - if (whitespace) - newValue += whitespace[0]; - this.element.value = newValue + value + this.element.value.substr(bounds[1]); - } else { - this.element.value = value; - } - this.oldElementValue = this.element.value; - this.element.focus(); - - if (this.options.afterUpdateElement) - this.options.afterUpdateElement(this.element, selectedElement); - }, - - updateChoices: function(choices) { - if(!this.changed && this.hasFocus) { - this.update.innerHTML = choices; - Element.cleanWhitespace(this.update); - Element.cleanWhitespace(this.update.down()); - - if(this.update.firstChild && this.update.down().childNodes) { - this.entryCount = - this.update.down().childNodes.length; - for (var i = 0; i < this.entryCount; i++) { - var entry = this.getEntry(i); - entry.autocompleteIndex = i; - this.addObservers(entry); - } - } else { - this.entryCount = 0; - } - - this.stopIndicator(); - this.index = 0; - - if(this.entryCount==1 && this.options.autoSelect) { - this.selectEntry(); - this.hide(); - } else { - this.render(); - } - } - }, - - addObservers: function(element) { - Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); - Event.observe(element, "click", this.onClick.bindAsEventListener(this)); - }, - - onObserverEvent: function() { - this.changed = false; - this.tokenBounds = null; - if(this.getToken().length>=this.options.minChars) { - this.getUpdatedChoices(); - } else { - this.active = false; - this.hide(); - } - this.oldElementValue = this.element.value; - }, - - getToken: function() { - var bounds = this.getTokenBounds(); - return this.element.value.substring(bounds[0], bounds[1]).strip(); - }, - - getTokenBounds: function() { - if (null != this.tokenBounds) return this.tokenBounds; - var value = this.element.value; - if (value.strip().empty()) return [-1, 0]; - var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); - var offset = (diff == this.oldElementValue.length ? 1 : 0); - var prevTokenPos = -1, nextTokenPos = value.length; - var tp; - for (var index = 0, l = this.options.tokens.length; index < l; ++index) { - tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); - if (tp > prevTokenPos) prevTokenPos = tp; - tp = value.indexOf(this.options.tokens[index], diff + offset); - if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; - } - return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); - } -}); - -Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { - var boundary = Math.min(newS.length, oldS.length); - for (var index = 0; index < boundary; ++index) - if (newS[index] != oldS[index]) - return index; - return boundary; -}; - -Ajax.Autocompleter = Class.create(Autocompleter.Base, { - initialize: function(element, update, url, options) { - this.baseInitialize(element, update, options); - this.options.asynchronous = true; - this.options.onComplete = this.onComplete.bind(this); - this.options.defaultParams = this.options.parameters || null; - this.url = url; - }, - - getUpdatedChoices: function() { - this.startIndicator(); - - var entry = encodeURIComponent(this.options.paramName) + '=' + - encodeURIComponent(this.getToken()); - - this.options.parameters = this.options.callback ? - this.options.callback(this.element, entry) : entry; - - if(this.options.defaultParams) - this.options.parameters += '&' + this.options.defaultParams; - - new Ajax.Request(this.url, this.options); - }, - - onComplete: function(request) { - this.updateChoices(request.responseText); - } -}); - -// The local array autocompleter. Used when you'd prefer to -// inject an array of autocompletion options into the page, rather -// than sending out Ajax queries, which can be quite slow sometimes. -// -// The constructor takes four parameters. The first two are, as usual, -// the id of the monitored textbox, and id of the autocompletion menu. -// The third is the array you want to autocomplete from, and the fourth -// is the options block. -// -// Extra local autocompletion options: -// - choices - How many autocompletion choices to offer -// -// - partialSearch - If false, the autocompleter will match entered -// text only at the beginning of strings in the -// autocomplete array. Defaults to true, which will -// match text at the beginning of any *word* in the -// strings in the autocomplete array. If you want to -// search anywhere in the string, additionally set -// the option fullSearch to true (default: off). -// -// - fullSsearch - Search anywhere in autocomplete array strings. -// -// - partialChars - How many characters to enter before triggering -// a partial match (unlike minChars, which defines -// how many characters are required to do any match -// at all). Defaults to 2. -// -// - ignoreCase - Whether to ignore case when autocompleting. -// Defaults to true. -// -// It's possible to pass in a custom function as the 'selector' -// option, if you prefer to write your own autocompletion logic. -// In that case, the other options above will not apply unless -// you support them. - -Autocompleter.Local = Class.create(Autocompleter.Base, { - initialize: function(element, update, array, options) { - this.baseInitialize(element, update, options); - this.options.array = array; - }, - - getUpdatedChoices: function() { - this.updateChoices(this.options.selector(this)); - }, - - setOptions: function(options) { - this.options = Object.extend({ - choices: 10, - partialSearch: true, - partialChars: 2, - ignoreCase: true, - fullSearch: false, - selector: function(instance) { - var ret = []; // Beginning matches - var partial = []; // Inside matches - var entry = instance.getToken(); - var count = 0; - - for (var i = 0; i < instance.options.array.length && - ret.length < instance.options.choices ; i++) { - - var elem = instance.options.array[i]; - var foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase()) : - elem.indexOf(entry); - - while (foundPos != -1) { - if (foundPos == 0 && elem.length != entry.length) { - ret.push("
  • " + elem.substr(0, entry.length) + "" + - elem.substr(entry.length) + "
  • "); - break; - } else if (entry.length >= instance.options.partialChars && - instance.options.partialSearch && foundPos != -1) { - if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { - partial.push("
  • " + elem.substr(0, foundPos) + "" + - elem.substr(foundPos, entry.length) + "" + elem.substr( - foundPos + entry.length) + "
  • "); - break; - } - } - - foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : - elem.indexOf(entry, foundPos + 1); - - } - } - if (partial.length) - ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)); - return "
      " + ret.join('') + "
    "; - } - }, options || { }); - } -}); - -// AJAX in-place editor and collection editor -// Full rewrite by Christophe Porteneuve (April 2007). - -// Use this if you notice weird scrolling problems on some browsers, -// the DOM might be a bit confused when this gets called so do this -// waits 1 ms (with setTimeout) until it does the activation -Field.scrollFreeActivate = function(field) { - setTimeout(function() { - Field.activate(field); - }, 1); -}; - -Ajax.InPlaceEditor = Class.create({ - initialize: function(element, url, options) { - this.url = url; - this.element = element = $(element); - this.prepareOptions(); - this._controls = { }; - arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! - Object.extend(this.options, options || { }); - if (!this.options.formId && this.element.id) { - this.options.formId = this.element.id + '-inplaceeditor'; - if ($(this.options.formId)) - this.options.formId = ''; - } - if (this.options.externalControl) - this.options.externalControl = $(this.options.externalControl); - if (!this.options.externalControl) - this.options.externalControlOnly = false; - this._originalBackground = this.element.getStyle('background-color') || 'transparent'; - this.element.title = this.options.clickToEditText; - this._boundCancelHandler = this.handleFormCancellation.bind(this); - this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); - this._boundFailureHandler = this.handleAJAXFailure.bind(this); - this._boundSubmitHandler = this.handleFormSubmission.bind(this); - this._boundWrapperHandler = this.wrapUp.bind(this); - this.registerListeners(); - }, - checkForEscapeOrReturn: function(e) { - if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; - if (Event.KEY_ESC == e.keyCode) - this.handleFormCancellation(e); - else if (Event.KEY_RETURN == e.keyCode) - this.handleFormSubmission(e); - }, - createControl: function(mode, handler, extraClasses) { - var control = this.options[mode + 'Control']; - var text = this.options[mode + 'Text']; - if ('button' == control) { - var btn = document.createElement('input'); - btn.type = 'submit'; - btn.value = text; - btn.className = 'editor_' + mode + '_button'; - if ('cancel' == mode) - btn.onclick = this._boundCancelHandler; - this._form.appendChild(btn); - this._controls[mode] = btn; - } else if ('link' == control) { - var link = document.createElement('a'); - link.href = '#'; - link.appendChild(document.createTextNode(text)); - link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; - link.className = 'editor_' + mode + '_link'; - if (extraClasses) - link.className += ' ' + extraClasses; - this._form.appendChild(link); - this._controls[mode] = link; - } - }, - createEditField: function() { - var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); - var fld; - if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { - fld = document.createElement('input'); - fld.type = 'text'; - var size = this.options.size || this.options.cols || 0; - if (0 < size) fld.size = size; - } else { - fld = document.createElement('textarea'); - fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); - fld.cols = this.options.cols || 40; - } - fld.name = this.options.paramName; - fld.value = text; // No HTML breaks conversion anymore - fld.className = 'editor_field'; - if (this.options.submitOnBlur) - fld.onblur = this._boundSubmitHandler; - this._controls.editor = fld; - if (this.options.loadTextURL) - this.loadExternalText(); - this._form.appendChild(this._controls.editor); - }, - createForm: function() { - var ipe = this; - function addText(mode, condition) { - var text = ipe.options['text' + mode + 'Controls']; - if (!text || condition === false) return; - ipe._form.appendChild(document.createTextNode(text)); - }; - this._form = $(document.createElement('form')); - this._form.id = this.options.formId; - this._form.addClassName(this.options.formClassName); - this._form.onsubmit = this._boundSubmitHandler; - this.createEditField(); - if ('textarea' == this._controls.editor.tagName.toLowerCase()) - this._form.appendChild(document.createElement('br')); - if (this.options.onFormCustomization) - this.options.onFormCustomization(this, this._form); - addText('Before', this.options.okControl || this.options.cancelControl); - this.createControl('ok', this._boundSubmitHandler); - addText('Between', this.options.okControl && this.options.cancelControl); - this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); - addText('After', this.options.okControl || this.options.cancelControl); - }, - destroy: function() { - if (this._oldInnerHTML) - this.element.innerHTML = this._oldInnerHTML; - this.leaveEditMode(); - this.unregisterListeners(); - }, - enterEditMode: function(e) { - if (this._saving || this._editing) return; - this._editing = true; - this.triggerCallback('onEnterEditMode'); - if (this.options.externalControl) - this.options.externalControl.hide(); - this.element.hide(); - this.createForm(); - this.element.parentNode.insertBefore(this._form, this.element); - if (!this.options.loadTextURL) - this.postProcessEditField(); - if (e) Event.stop(e); - }, - enterHover: function(e) { - if (this.options.hoverClassName) - this.element.addClassName(this.options.hoverClassName); - if (this._saving) return; - this.triggerCallback('onEnterHover'); - }, - getText: function() { - return this.element.innerHTML.unescapeHTML(); - }, - handleAJAXFailure: function(transport) { - this.triggerCallback('onFailure', transport); - if (this._oldInnerHTML) { - this.element.innerHTML = this._oldInnerHTML; - this._oldInnerHTML = null; - } - }, - handleFormCancellation: function(e) { - this.wrapUp(); - if (e) Event.stop(e); - }, - handleFormSubmission: function(e) { - var form = this._form; - var value = $F(this._controls.editor); - this.prepareSubmission(); - var params = this.options.callback(form, value) || ''; - if (Object.isString(params)) - params = params.toQueryParams(); - params.editorId = this.element.id; - if (this.options.htmlResponse) { - var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); - Object.extend(options, { - parameters: params, - onComplete: this._boundWrapperHandler, - onFailure: this._boundFailureHandler - }); - new Ajax.Updater({ success: this.element }, this.url, options); - } else { - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: params, - onComplete: this._boundWrapperHandler, - onFailure: this._boundFailureHandler - }); - new Ajax.Request(this.url, options); - } - if (e) Event.stop(e); - }, - leaveEditMode: function() { - this.element.removeClassName(this.options.savingClassName); - this.removeForm(); - this.leaveHover(); - this.element.style.backgroundColor = this._originalBackground; - this.element.show(); - if (this.options.externalControl) - this.options.externalControl.show(); - this._saving = false; - this._editing = false; - this._oldInnerHTML = null; - this.triggerCallback('onLeaveEditMode'); - }, - leaveHover: function(e) { - if (this.options.hoverClassName) - this.element.removeClassName(this.options.hoverClassName); - if (this._saving) return; - this.triggerCallback('onLeaveHover'); - }, - loadExternalText: function() { - this._form.addClassName(this.options.loadingClassName); - this._controls.editor.disabled = true; - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - this._form.removeClassName(this.options.loadingClassName); - var text = transport.responseText; - if (this.options.stripLoadedTextTags) - text = text.stripTags(); - this._controls.editor.value = text; - this._controls.editor.disabled = false; - this.postProcessEditField(); - }.bind(this), - onFailure: this._boundFailureHandler - }); - new Ajax.Request(this.options.loadTextURL, options); - }, - postProcessEditField: function() { - var fpc = this.options.fieldPostCreation; - if (fpc) - $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); - }, - prepareOptions: function() { - this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); - Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); - [this._extraDefaultOptions].flatten().compact().each(function(defs) { - Object.extend(this.options, defs); - }.bind(this)); - }, - prepareSubmission: function() { - this._saving = true; - this.removeForm(); - this.leaveHover(); - this.showSaving(); - }, - registerListeners: function() { - this._listeners = { }; - var listener; - $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { - listener = this[pair.value].bind(this); - this._listeners[pair.key] = listener; - if (!this.options.externalControlOnly) - this.element.observe(pair.key, listener); - if (this.options.externalControl) - this.options.externalControl.observe(pair.key, listener); - }.bind(this)); - }, - removeForm: function() { - if (!this._form) return; - this._form.remove(); - this._form = null; - this._controls = { }; - }, - showSaving: function() { - this._oldInnerHTML = this.element.innerHTML; - this.element.innerHTML = this.options.savingText; - this.element.addClassName(this.options.savingClassName); - this.element.style.backgroundColor = this._originalBackground; - this.element.show(); - }, - triggerCallback: function(cbName, arg) { - if ('function' == typeof this.options[cbName]) { - this.options[cbName](this, arg); - } - }, - unregisterListeners: function() { - $H(this._listeners).each(function(pair) { - if (!this.options.externalControlOnly) - this.element.stopObserving(pair.key, pair.value); - if (this.options.externalControl) - this.options.externalControl.stopObserving(pair.key, pair.value); - }.bind(this)); - }, - wrapUp: function(transport) { - this.leaveEditMode(); - // Can't use triggerCallback due to backward compatibility: requires - // binding + direct element - this._boundComplete(transport, this.element); - } -}); - -Object.extend(Ajax.InPlaceEditor.prototype, { - dispose: Ajax.InPlaceEditor.prototype.destroy -}); - -Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { - initialize: function($super, element, url, options) { - this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; - $super(element, url, options); - }, - - createEditField: function() { - var list = document.createElement('select'); - list.name = this.options.paramName; - list.size = 1; - this._controls.editor = list; - this._collection = this.options.collection || []; - if (this.options.loadCollectionURL) - this.loadCollection(); - else - this.checkForExternalText(); - this._form.appendChild(this._controls.editor); - }, - - loadCollection: function() { - this._form.addClassName(this.options.loadingClassName); - this.showLoadingText(this.options.loadingCollectionText); - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - var js = transport.responseText.strip(); - if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check - throw('Server returned an invalid collection representation.'); - this._collection = eval(js); - this.checkForExternalText(); - }.bind(this), - onFailure: this.onFailure - }); - new Ajax.Request(this.options.loadCollectionURL, options); - }, - - showLoadingText: function(text) { - this._controls.editor.disabled = true; - var tempOption = this._controls.editor.firstChild; - if (!tempOption) { - tempOption = document.createElement('option'); - tempOption.value = ''; - this._controls.editor.appendChild(tempOption); - tempOption.selected = true; - } - tempOption.update((text || '').stripScripts().stripTags()); - }, - - checkForExternalText: function() { - this._text = this.getText(); - if (this.options.loadTextURL) - this.loadExternalText(); - else - this.buildOptionList(); - }, - - loadExternalText: function() { - this.showLoadingText(this.options.loadingText); - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - this._text = transport.responseText.strip(); - this.buildOptionList(); - }.bind(this), - onFailure: this.onFailure - }); - new Ajax.Request(this.options.loadTextURL, options); - }, - - buildOptionList: function() { - this._form.removeClassName(this.options.loadingClassName); - this._collection = this._collection.map(function(entry) { - return 2 === entry.length ? entry : [entry, entry].flatten(); - }); - var marker = ('value' in this.options) ? this.options.value : this._text; - var textFound = this._collection.any(function(entry) { - return entry[0] == marker; - }.bind(this)); - this._controls.editor.update(''); - var option; - this._collection.each(function(entry, index) { - option = document.createElement('option'); - option.value = entry[0]; - option.selected = textFound ? entry[0] == marker : 0 == index; - option.appendChild(document.createTextNode(entry[1])); - this._controls.editor.appendChild(option); - }.bind(this)); - this._controls.editor.disabled = false; - Field.scrollFreeActivate(this._controls.editor); - } -}); - -//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** -//**** This only exists for a while, in order to let **** -//**** users adapt to the new API. Read up on the new **** -//**** API and convert your code to it ASAP! **** - -Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { - if (!options) return; - function fallback(name, expr) { - if (name in options || expr === undefined) return; - options[name] = expr; - }; - fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : - options.cancelLink == options.cancelButton == false ? false : undefined))); - fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : - options.okLink == options.okButton == false ? false : undefined))); - fallback('highlightColor', options.highlightcolor); - fallback('highlightEndColor', options.highlightendcolor); -}; - -Object.extend(Ajax.InPlaceEditor, { - DefaultOptions: { - ajaxOptions: { }, - autoRows: 3, // Use when multi-line w/ rows == 1 - cancelControl: 'link', // 'link'|'button'|false - cancelText: 'cancel', - clickToEditText: 'Click to edit', - externalControl: null, // id|elt - externalControlOnly: false, - fieldPostCreation: 'activate', // 'activate'|'focus'|false - formClassName: 'inplaceeditor-form', - formId: null, // id|elt - highlightColor: '#ffff99', - highlightEndColor: '#ffffff', - hoverClassName: '', - htmlResponse: true, - loadingClassName: 'inplaceeditor-loading', - loadingText: 'Loading...', - okControl: 'button', // 'link'|'button'|false - okText: 'ok', - paramName: 'value', - rows: 1, // If 1 and multi-line, uses autoRows - savingClassName: 'inplaceeditor-saving', - savingText: 'Saving...', - size: 0, - stripLoadedTextTags: false, - submitOnBlur: false, - textAfterControls: '', - textBeforeControls: '', - textBetweenControls: '' - }, - DefaultCallbacks: { - callback: function(form) { - return Form.serialize(form); - }, - onComplete: function(transport, element) { - // For backward compatibility, this one is bound to the IPE, and passes - // the element directly. It was too often customized, so we don't break it. - new Effect.Highlight(element, { - startcolor: this.options.highlightColor, keepBackgroundImage: true }); - }, - onEnterEditMode: null, - onEnterHover: function(ipe) { - ipe.element.style.backgroundColor = ipe.options.highlightColor; - if (ipe._effect) - ipe._effect.cancel(); - }, - onFailure: function(transport, ipe) { - alert('Error communication with the server: ' + transport.responseText.stripTags()); - }, - onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. - onLeaveEditMode: null, - onLeaveHover: function(ipe) { - ipe._effect = new Effect.Highlight(ipe.element, { - startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, - restorecolor: ipe._originalBackground, keepBackgroundImage: true - }); - } - }, - Listeners: { - click: 'enterEditMode', - keydown: 'checkForEscapeOrReturn', - mouseover: 'enterHover', - mouseout: 'leaveHover' - } -}); - -Ajax.InPlaceCollectionEditor.DefaultOptions = { - loadingCollectionText: 'Loading options...' -}; - -// Delayed observer, like Form.Element.Observer, -// but waits for delay after last key input -// Ideal for live-search fields - -Form.Element.DelayedObserver = Class.create({ - initialize: function(element, delay, callback) { - this.delay = delay || 0.5; - this.element = $(element); - this.callback = callback; - this.timer = null; - this.lastValue = $F(this.element); - Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); - }, - delayedListener: function(event) { - if(this.lastValue == $F(this.element)) return; - if(this.timer) clearTimeout(this.timer); - this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); - this.lastValue = $F(this.element); - }, - onTimerEvent: function() { - this.timer = null; - this.callback(this.element, $F(this.element)); - } -}); \ No newline at end of file diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/dragdrop.js b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/dragdrop.js deleted file mode 100644 index 15c6dbc..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/dragdrop.js +++ /dev/null @@ -1,974 +0,0 @@ -// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 - -// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -if(Object.isUndefined(Effect)) - throw("dragdrop.js requires including script.aculo.us' effects.js library"); - -var Droppables = { - drops: [], - - remove: function(element) { - this.drops = this.drops.reject(function(d) { return d.element==$(element) }); - }, - - add: function(element) { - element = $(element); - var options = Object.extend({ - greedy: true, - hoverclass: null, - tree: false - }, arguments[1] || { }); - - // cache containers - if(options.containment) { - options._containers = []; - var containment = options.containment; - if(Object.isArray(containment)) { - containment.each( function(c) { options._containers.push($(c)) }); - } else { - options._containers.push($(containment)); - } - } - - if(options.accept) options.accept = [options.accept].flatten(); - - Element.makePositioned(element); // fix IE - options.element = element; - - this.drops.push(options); - }, - - findDeepestChild: function(drops) { - deepest = drops[0]; - - for (i = 1; i < drops.length; ++i) - if (Element.isParent(drops[i].element, deepest.element)) - deepest = drops[i]; - - return deepest; - }, - - isContained: function(element, drop) { - var containmentNode; - if(drop.tree) { - containmentNode = element.treeNode; - } else { - containmentNode = element.parentNode; - } - return drop._containers.detect(function(c) { return containmentNode == c }); - }, - - isAffected: function(point, element, drop) { - return ( - (drop.element!=element) && - ((!drop._containers) || - this.isContained(element, drop)) && - ((!drop.accept) || - (Element.classNames(element).detect( - function(v) { return drop.accept.include(v) } ) )) && - Position.within(drop.element, point[0], point[1]) ); - }, - - deactivate: function(drop) { - if(drop.hoverclass) - Element.removeClassName(drop.element, drop.hoverclass); - this.last_active = null; - }, - - activate: function(drop) { - if(drop.hoverclass) - Element.addClassName(drop.element, drop.hoverclass); - this.last_active = drop; - }, - - show: function(point, element) { - if(!this.drops.length) return; - var drop, affected = []; - - this.drops.each( function(drop) { - if(Droppables.isAffected(point, element, drop)) - affected.push(drop); - }); - - if(affected.length>0) - drop = Droppables.findDeepestChild(affected); - - if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); - if (drop) { - Position.within(drop.element, point[0], point[1]); - if(drop.onHover) - drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); - - if (drop != this.last_active) Droppables.activate(drop); - } - }, - - fire: function(event, element) { - if(!this.last_active) return; - Position.prepare(); - - if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) - if (this.last_active.onDrop) { - this.last_active.onDrop(element, this.last_active.element, event); - return true; - } - }, - - reset: function() { - if(this.last_active) - this.deactivate(this.last_active); - } -}; - -var Draggables = { - drags: [], - observers: [], - - register: function(draggable) { - if(this.drags.length == 0) { - this.eventMouseUp = this.endDrag.bindAsEventListener(this); - this.eventMouseMove = this.updateDrag.bindAsEventListener(this); - this.eventKeypress = this.keyPress.bindAsEventListener(this); - - Event.observe(document, "mouseup", this.eventMouseUp); - Event.observe(document, "mousemove", this.eventMouseMove); - Event.observe(document, "keypress", this.eventKeypress); - } - this.drags.push(draggable); - }, - - unregister: function(draggable) { - this.drags = this.drags.reject(function(d) { return d==draggable }); - if(this.drags.length == 0) { - Event.stopObserving(document, "mouseup", this.eventMouseUp); - Event.stopObserving(document, "mousemove", this.eventMouseMove); - Event.stopObserving(document, "keypress", this.eventKeypress); - } - }, - - activate: function(draggable) { - if(draggable.options.delay) { - this._timeout = setTimeout(function() { - Draggables._timeout = null; - window.focus(); - Draggables.activeDraggable = draggable; - }.bind(this), draggable.options.delay); - } else { - window.focus(); // allows keypress events if window isn't currently focused, fails for Safari - this.activeDraggable = draggable; - } - }, - - deactivate: function() { - this.activeDraggable = null; - }, - - updateDrag: function(event) { - if(!this.activeDraggable) return; - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - // Mozilla-based browsers fire successive mousemove events with - // the same coordinates, prevent needless redrawing (moz bug?) - if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; - this._lastPointer = pointer; - - this.activeDraggable.updateDrag(event, pointer); - }, - - endDrag: function(event) { - if(this._timeout) { - clearTimeout(this._timeout); - this._timeout = null; - } - if(!this.activeDraggable) return; - this._lastPointer = null; - this.activeDraggable.endDrag(event); - this.activeDraggable = null; - }, - - keyPress: function(event) { - if(this.activeDraggable) - this.activeDraggable.keyPress(event); - }, - - addObserver: function(observer) { - this.observers.push(observer); - this._cacheObserverCallbacks(); - }, - - removeObserver: function(element) { // element instead of observer fixes mem leaks - this.observers = this.observers.reject( function(o) { return o.element==element }); - this._cacheObserverCallbacks(); - }, - - notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' - if(this[eventName+'Count'] > 0) - this.observers.each( function(o) { - if(o[eventName]) o[eventName](eventName, draggable, event); - }); - if(draggable.options[eventName]) draggable.options[eventName](draggable, event); - }, - - _cacheObserverCallbacks: function() { - ['onStart','onEnd','onDrag'].each( function(eventName) { - Draggables[eventName+'Count'] = Draggables.observers.select( - function(o) { return o[eventName]; } - ).length; - }); - } -}; - -/*--------------------------------------------------------------------------*/ - -var Draggable = Class.create({ - initialize: function(element) { - var defaults = { - handle: false, - reverteffect: function(element, top_offset, left_offset) { - var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; - new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, - queue: {scope:'_draggable', position:'end'} - }); - }, - endeffect: function(element) { - var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; - new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, - queue: {scope:'_draggable', position:'end'}, - afterFinish: function(){ - Draggable._dragging[element] = false - } - }); - }, - zindex: 1000, - revert: false, - quiet: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } - delay: 0 - }; - - if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) - Object.extend(defaults, { - starteffect: function(element) { - element._opacity = Element.getOpacity(element); - Draggable._dragging[element] = true; - new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); - } - }); - - var options = Object.extend(defaults, arguments[1] || { }); - - this.element = $(element); - - if(options.handle && Object.isString(options.handle)) - this.handle = this.element.down('.'+options.handle, 0); - - if(!this.handle) this.handle = $(options.handle); - if(!this.handle) this.handle = this.element; - - if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { - options.scroll = $(options.scroll); - this._isScrollChild = Element.childOf(this.element, options.scroll); - } - - Element.makePositioned(this.element); // fix IE - - this.options = options; - this.dragging = false; - - this.eventMouseDown = this.initDrag.bindAsEventListener(this); - Event.observe(this.handle, "mousedown", this.eventMouseDown); - - Draggables.register(this); - }, - - destroy: function() { - Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); - Draggables.unregister(this); - }, - - currentDelta: function() { - return([ - parseInt(Element.getStyle(this.element,'left') || '0'), - parseInt(Element.getStyle(this.element,'top') || '0')]); - }, - - initDrag: function(event) { - if(!Object.isUndefined(Draggable._dragging[this.element]) && - Draggable._dragging[this.element]) return; - if(Event.isLeftClick(event)) { - // abort on form elements, fixes a Firefox issue - var src = Event.element(event); - if((tag_name = src.tagName.toUpperCase()) && ( - tag_name=='INPUT' || - tag_name=='SELECT' || - tag_name=='OPTION' || - tag_name=='BUTTON' || - tag_name=='TEXTAREA')) return; - - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - var pos = this.element.cumulativeOffset(); - this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); - - Draggables.activate(this); - Event.stop(event); - } - }, - - startDrag: function(event) { - this.dragging = true; - if(!this.delta) - this.delta = this.currentDelta(); - - if(this.options.zindex) { - this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); - this.element.style.zIndex = this.options.zindex; - } - - if(this.options.ghosting) { - this._clone = this.element.cloneNode(true); - this._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); - if (!this._originallyAbsolute) - Position.absolutize(this.element); - this.element.parentNode.insertBefore(this._clone, this.element); - } - - if(this.options.scroll) { - if (this.options.scroll == window) { - var where = this._getWindowScroll(this.options.scroll); - this.originalScrollLeft = where.left; - this.originalScrollTop = where.top; - } else { - this.originalScrollLeft = this.options.scroll.scrollLeft; - this.originalScrollTop = this.options.scroll.scrollTop; - } - } - - Draggables.notify('onStart', this, event); - - if(this.options.starteffect) this.options.starteffect(this.element); - }, - - updateDrag: function(event, pointer) { - if(!this.dragging) this.startDrag(event); - - if(!this.options.quiet){ - Position.prepare(); - Droppables.show(pointer, this.element); - } - - Draggables.notify('onDrag', this, event); - - this.draw(pointer); - if(this.options.change) this.options.change(this); - - if(this.options.scroll) { - this.stopScrolling(); - - var p; - if (this.options.scroll == window) { - with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } - } else { - p = Position.page(this.options.scroll); - p[0] += this.options.scroll.scrollLeft + Position.deltaX; - p[1] += this.options.scroll.scrollTop + Position.deltaY; - p.push(p[0]+this.options.scroll.offsetWidth); - p.push(p[1]+this.options.scroll.offsetHeight); - } - var speed = [0,0]; - if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); - if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); - if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); - if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); - this.startScrolling(speed); - } - - // fix AppleWebKit rendering - if(Prototype.Browser.WebKit) window.scrollBy(0,0); - - Event.stop(event); - }, - - finishDrag: function(event, success) { - this.dragging = false; - - if(this.options.quiet){ - Position.prepare(); - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - Droppables.show(pointer, this.element); - } - - if(this.options.ghosting) { - if (!this._originallyAbsolute) - Position.relativize(this.element); - delete this._originallyAbsolute; - Element.remove(this._clone); - this._clone = null; - } - - var dropped = false; - if(success) { - dropped = Droppables.fire(event, this.element); - if (!dropped) dropped = false; - } - if(dropped && this.options.onDropped) this.options.onDropped(this.element); - Draggables.notify('onEnd', this, event); - - var revert = this.options.revert; - if(revert && Object.isFunction(revert)) revert = revert(this.element); - - var d = this.currentDelta(); - if(revert && this.options.reverteffect) { - if (dropped == 0 || revert != 'failure') - this.options.reverteffect(this.element, - d[1]-this.delta[1], d[0]-this.delta[0]); - } else { - this.delta = d; - } - - if(this.options.zindex) - this.element.style.zIndex = this.originalZ; - - if(this.options.endeffect) - this.options.endeffect(this.element); - - Draggables.deactivate(this); - Droppables.reset(); - }, - - keyPress: function(event) { - if(event.keyCode!=Event.KEY_ESC) return; - this.finishDrag(event, false); - Event.stop(event); - }, - - endDrag: function(event) { - if(!this.dragging) return; - this.stopScrolling(); - this.finishDrag(event, true); - Event.stop(event); - }, - - draw: function(point) { - var pos = this.element.cumulativeOffset(); - if(this.options.ghosting) { - var r = Position.realOffset(this.element); - pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; - } - - var d = this.currentDelta(); - pos[0] -= d[0]; pos[1] -= d[1]; - - if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { - pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; - pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; - } - - var p = [0,1].map(function(i){ - return (point[i]-pos[i]-this.offset[i]) - }.bind(this)); - - if(this.options.snap) { - if(Object.isFunction(this.options.snap)) { - p = this.options.snap(p[0],p[1],this); - } else { - if(Object.isArray(this.options.snap)) { - p = p.map( function(v, i) { - return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)); - } else { - p = p.map( function(v) { - return (v/this.options.snap).round()*this.options.snap }.bind(this)); - } - }} - - var style = this.element.style; - if((!this.options.constraint) || (this.options.constraint=='horizontal')) - style.left = p[0] + "px"; - if((!this.options.constraint) || (this.options.constraint=='vertical')) - style.top = p[1] + "px"; - - if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering - }, - - stopScrolling: function() { - if(this.scrollInterval) { - clearInterval(this.scrollInterval); - this.scrollInterval = null; - Draggables._lastScrollPointer = null; - } - }, - - startScrolling: function(speed) { - if(!(speed[0] || speed[1])) return; - this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; - this.lastScrolled = new Date(); - this.scrollInterval = setInterval(this.scroll.bind(this), 10); - }, - - scroll: function() { - var current = new Date(); - var delta = current - this.lastScrolled; - this.lastScrolled = current; - if(this.options.scroll == window) { - with (this._getWindowScroll(this.options.scroll)) { - if (this.scrollSpeed[0] || this.scrollSpeed[1]) { - var d = delta / 1000; - this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); - } - } - } else { - this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; - this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; - } - - Position.prepare(); - Droppables.show(Draggables._lastPointer, this.element); - Draggables.notify('onDrag', this); - if (this._isScrollChild) { - Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); - Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; - Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; - if (Draggables._lastScrollPointer[0] < 0) - Draggables._lastScrollPointer[0] = 0; - if (Draggables._lastScrollPointer[1] < 0) - Draggables._lastScrollPointer[1] = 0; - this.draw(Draggables._lastScrollPointer); - } - - if(this.options.change) this.options.change(this); - }, - - _getWindowScroll: function(w) { - var T, L, W, H; - with (w.document) { - if (w.document.documentElement && documentElement.scrollTop) { - T = documentElement.scrollTop; - L = documentElement.scrollLeft; - } else if (w.document.body) { - T = body.scrollTop; - L = body.scrollLeft; - } - if (w.innerWidth) { - W = w.innerWidth; - H = w.innerHeight; - } else if (w.document.documentElement && documentElement.clientWidth) { - W = documentElement.clientWidth; - H = documentElement.clientHeight; - } else { - W = body.offsetWidth; - H = body.offsetHeight; - } - } - return { top: T, left: L, width: W, height: H }; - } -}); - -Draggable._dragging = { }; - -/*--------------------------------------------------------------------------*/ - -var SortableObserver = Class.create({ - initialize: function(element, observer) { - this.element = $(element); - this.observer = observer; - this.lastValue = Sortable.serialize(this.element); - }, - - onStart: function() { - this.lastValue = Sortable.serialize(this.element); - }, - - onEnd: function() { - Sortable.unmark(); - if(this.lastValue != Sortable.serialize(this.element)) - this.observer(this.element) - } -}); - -var Sortable = { - SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, - - sortables: { }, - - _findRootElement: function(element) { - while (element.tagName.toUpperCase() != "BODY") { - if(element.id && Sortable.sortables[element.id]) return element; - element = element.parentNode; - } - }, - - options: function(element) { - element = Sortable._findRootElement($(element)); - if(!element) return; - return Sortable.sortables[element.id]; - }, - - destroy: function(element){ - element = $(element); - var s = Sortable.sortables[element.id]; - - if(s) { - Draggables.removeObserver(s.element); - s.droppables.each(function(d){ Droppables.remove(d) }); - s.draggables.invoke('destroy'); - - delete Sortable.sortables[s.element.id]; - } - }, - - create: function(element) { - element = $(element); - var options = Object.extend({ - element: element, - tag: 'li', // assumes li children, override with tag: 'tagname' - dropOnEmpty: false, - tree: false, - treeTag: 'ul', - overlap: 'vertical', // one of 'vertical', 'horizontal' - constraint: 'vertical', // one of 'vertical', 'horizontal', false - containment: element, // also takes array of elements (or id's); or false - handle: false, // or a CSS class - only: false, - delay: 0, - hoverclass: null, - ghosting: false, - quiet: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - format: this.SERIALIZE_RULE, - - // these take arrays of elements or ids and can be - // used for better initialization performance - elements: false, - handles: false, - - onChange: Prototype.emptyFunction, - onUpdate: Prototype.emptyFunction - }, arguments[1] || { }); - - // clear any old sortable with same element - this.destroy(element); - - // build options for the draggables - var options_for_draggable = { - revert: true, - quiet: options.quiet, - scroll: options.scroll, - scrollSpeed: options.scrollSpeed, - scrollSensitivity: options.scrollSensitivity, - delay: options.delay, - ghosting: options.ghosting, - constraint: options.constraint, - handle: options.handle }; - - if(options.starteffect) - options_for_draggable.starteffect = options.starteffect; - - if(options.reverteffect) - options_for_draggable.reverteffect = options.reverteffect; - else - if(options.ghosting) options_for_draggable.reverteffect = function(element) { - element.style.top = 0; - element.style.left = 0; - }; - - if(options.endeffect) - options_for_draggable.endeffect = options.endeffect; - - if(options.zindex) - options_for_draggable.zindex = options.zindex; - - // build options for the droppables - var options_for_droppable = { - overlap: options.overlap, - containment: options.containment, - tree: options.tree, - hoverclass: options.hoverclass, - onHover: Sortable.onHover - }; - - var options_for_tree = { - onHover: Sortable.onEmptyHover, - overlap: options.overlap, - containment: options.containment, - hoverclass: options.hoverclass - }; - - // fix for gecko engine - Element.cleanWhitespace(element); - - options.draggables = []; - options.droppables = []; - - // drop on empty handling - if(options.dropOnEmpty || options.tree) { - Droppables.add(element, options_for_tree); - options.droppables.push(element); - } - - (options.elements || this.findElements(element, options) || []).each( function(e,i) { - var handle = options.handles ? $(options.handles[i]) : - (options.handle ? $(e).select('.' + options.handle)[0] : e); - options.draggables.push( - new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); - Droppables.add(e, options_for_droppable); - if(options.tree) e.treeNode = element; - options.droppables.push(e); - }); - - if(options.tree) { - (Sortable.findTreeElements(element, options) || []).each( function(e) { - Droppables.add(e, options_for_tree); - e.treeNode = element; - options.droppables.push(e); - }); - } - - // keep reference - this.sortables[element.identify()] = options; - - // for onupdate - Draggables.addObserver(new SortableObserver(element, options.onUpdate)); - - }, - - // return all suitable-for-sortable elements in a guaranteed order - findElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.tag); - }, - - findTreeElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.treeTag); - }, - - onHover: function(element, dropon, overlap) { - if(Element.isParent(dropon, element)) return; - - if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { - return; - } else if(overlap>0.5) { - Sortable.mark(dropon, 'before'); - if(dropon.previousSibling != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, dropon); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } else { - Sortable.mark(dropon, 'after'); - var nextElement = dropon.nextSibling || null; - if(nextElement != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, nextElement); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } - }, - - onEmptyHover: function(element, dropon, overlap) { - var oldParentNode = element.parentNode; - var droponOptions = Sortable.options(dropon); - - if(!Element.isParent(dropon, element)) { - var index; - - var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); - var child = null; - - if(children) { - var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); - - for (index = 0; index < children.length; index += 1) { - if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { - offset -= Element.offsetSize (children[index], droponOptions.overlap); - } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { - child = index + 1 < children.length ? children[index + 1] : null; - break; - } else { - child = children[index]; - break; - } - } - } - - dropon.insertBefore(element, child); - - Sortable.options(oldParentNode).onChange(element); - droponOptions.onChange(element); - } - }, - - unmark: function() { - if(Sortable._marker) Sortable._marker.hide(); - }, - - mark: function(dropon, position) { - // mark on ghosting only - var sortable = Sortable.options(dropon.parentNode); - if(sortable && !sortable.ghosting) return; - - if(!Sortable._marker) { - Sortable._marker = - ($('dropmarker') || Element.extend(document.createElement('DIV'))). - hide().addClassName('dropmarker').setStyle({position:'absolute'}); - document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); - } - var offsets = dropon.cumulativeOffset(); - Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); - - if(position=='after') - if(sortable.overlap == 'horizontal') - Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); - else - Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); - - Sortable._marker.show(); - }, - - _tree: function(element, options, parent) { - var children = Sortable.findElements(element, options) || []; - - for (var i = 0; i < children.length; ++i) { - var match = children[i].id.match(options.format); - - if (!match) continue; - - var child = { - id: encodeURIComponent(match ? match[1] : null), - element: element, - parent: parent, - children: [], - position: parent.children.length, - container: $(children[i]).down(options.treeTag) - }; - - /* Get the element containing the children and recurse over it */ - if (child.container) - this._tree(child.container, options, child); - - parent.children.push (child); - } - - return parent; - }, - - tree: function(element) { - element = $(element); - var sortableOptions = this.options(element); - var options = Object.extend({ - tag: sortableOptions.tag, - treeTag: sortableOptions.treeTag, - only: sortableOptions.only, - name: element.id, - format: sortableOptions.format - }, arguments[1] || { }); - - var root = { - id: null, - parent: null, - children: [], - container: element, - position: 0 - }; - - return Sortable._tree(element, options, root); - }, - - /* Construct a [i] index for a particular node */ - _constructIndex: function(node) { - var index = ''; - do { - if (node.id) index = '[' + node.position + ']' + index; - } while ((node = node.parent) != null); - return index; - }, - - sequence: function(element) { - element = $(element); - var options = Object.extend(this.options(element), arguments[1] || { }); - - return $(this.findElements(element, options) || []).map( function(item) { - return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; - }); - }, - - setSequence: function(element, new_sequence) { - element = $(element); - var options = Object.extend(this.options(element), arguments[2] || { }); - - var nodeMap = { }; - this.findElements(element, options).each( function(n) { - if (n.id.match(options.format)) - nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; - n.parentNode.removeChild(n); - }); - - new_sequence.each(function(ident) { - var n = nodeMap[ident]; - if (n) { - n[1].appendChild(n[0]); - delete nodeMap[ident]; - } - }); - }, - - serialize: function(element) { - element = $(element); - var options = Object.extend(Sortable.options(element), arguments[1] || { }); - var name = encodeURIComponent( - (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); - - if (options.tree) { - return Sortable.tree(element, arguments[1]).children.map( function (item) { - return [name + Sortable._constructIndex(item) + "[id]=" + - encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); - }).flatten().join('&'); - } else { - return Sortable.sequence(element, arguments[1]).map( function(item) { - return name + "[]=" + encodeURIComponent(item); - }).join('&'); - } - } -}; - -// Returns true if child is contained within element -Element.isParent = function(child, element) { - if (!child.parentNode || child == element) return false; - if (child.parentNode == element) return true; - return Element.isParent(child.parentNode, element); -}; - -Element.findChildren = function(element, only, recursive, tagName) { - if(!element.hasChildNodes()) return null; - tagName = tagName.toUpperCase(); - if(only) only = [only].flatten(); - var elements = []; - $A(element.childNodes).each( function(e) { - if(e.tagName && e.tagName.toUpperCase()==tagName && - (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) - elements.push(e); - if(recursive) { - var grandchildren = Element.findChildren(e, only, recursive, tagName); - if(grandchildren) elements.push(grandchildren); - } - }); - - return (elements.length>0 ? elements.flatten() : []); -}; - -Element.offsetSize = function (element, type) { - return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; -}; \ No newline at end of file diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/effects.js b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/effects.js deleted file mode 100644 index c81e6c7..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/effects.js +++ /dev/null @@ -1,1123 +0,0 @@ -// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 - -// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// Contributors: -// Justin Palmer (http://encytemedia.com/) -// Mark Pilgrim (http://diveintomark.org/) -// Martin Bialasinki -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// converts rgb() and #xxx to #xxxxxx format, -// returns self (or first argument) if not convertable -String.prototype.parseColor = function() { - var color = '#'; - if (this.slice(0,4) == 'rgb(') { - var cols = this.slice(4,this.length-1).split(','); - var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); - } else { - if (this.slice(0,1) == '#') { - if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); - if (this.length==7) color = this.toLowerCase(); - } - } - return (color.length==7 ? color : (arguments[0] || this)); -}; - -/*--------------------------------------------------------------------------*/ - -Element.collectTextNodes = function(element) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); - }).flatten().join(''); -}; - -Element.collectTextNodesIgnoreClass = function(element, className) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? - Element.collectTextNodesIgnoreClass(node, className) : '')); - }).flatten().join(''); -}; - -Element.setContentZoom = function(element, percent) { - element = $(element); - element.setStyle({fontSize: (percent/100) + 'em'}); - if (Prototype.Browser.WebKit) window.scrollBy(0,0); - return element; -}; - -Element.getInlineOpacity = function(element){ - return $(element).style.opacity || ''; -}; - -Element.forceRerendering = function(element) { - try { - element = $(element); - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch(e) { } -}; - -/*--------------------------------------------------------------------------*/ - -var Effect = { - _elementDoesNotExistError: { - name: 'ElementDoesNotExistError', - message: 'The specified DOM element does not exist, but is required for this effect to operate' - }, - Transitions: { - linear: Prototype.K, - sinoidal: function(pos) { - return (-Math.cos(pos*Math.PI)/2) + .5; - }, - reverse: function(pos) { - return 1-pos; - }, - flicker: function(pos) { - var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4; - return pos > 1 ? 1 : pos; - }, - wobble: function(pos) { - return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5; - }, - pulse: function(pos, pulses) { - return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5; - }, - spring: function(pos) { - return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); - }, - none: function(pos) { - return 0; - }, - full: function(pos) { - return 1; - } - }, - DefaultOptions: { - duration: 1.0, // seconds - fps: 100, // 100= assume 66fps max. - sync: false, // true for combining - from: 0.0, - to: 1.0, - delay: 0.0, - queue: 'parallel' - }, - tagifyText: function(element) { - var tagifyStyle = 'position:relative'; - if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; - - element = $(element); - $A(element.childNodes).each( function(child) { - if (child.nodeType==3) { - child.nodeValue.toArray().each( function(character) { - element.insertBefore( - new Element('span', {style: tagifyStyle}).update( - character == ' ' ? String.fromCharCode(160) : character), - child); - }); - Element.remove(child); - } - }); - }, - multiple: function(element, effect) { - var elements; - if (((typeof element == 'object') || - Object.isFunction(element)) && - (element.length)) - elements = element; - else - elements = $(element).childNodes; - - var options = Object.extend({ - speed: 0.1, - delay: 0.0 - }, arguments[2] || { }); - var masterDelay = options.delay; - - $A(elements).each( function(element, index) { - new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); - }); - }, - PAIRS: { - 'slide': ['SlideDown','SlideUp'], - 'blind': ['BlindDown','BlindUp'], - 'appear': ['Appear','Fade'] - }, - toggle: function(element, effect, options) { - element = $(element); - effect = (effect || 'appear').toLowerCase(); - - return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({ - queue: { position:'end', scope:(element.id || 'global'), limit: 1 } - }, options || {})); - } -}; - -Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; - -/* ------------- core effects ------------- */ - -Effect.ScopedQueue = Class.create(Enumerable, { - initialize: function() { - this.effects = []; - this.interval = null; - }, - _each: function(iterator) { - this.effects._each(iterator); - }, - add: function(effect) { - var timestamp = new Date().getTime(); - - var position = Object.isString(effect.options.queue) ? - effect.options.queue : effect.options.queue.position; - - switch(position) { - case 'front': - // move unstarted effects after this effect - this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { - e.startOn += effect.finishOn; - e.finishOn += effect.finishOn; - }); - break; - case 'with-last': - timestamp = this.effects.pluck('startOn').max() || timestamp; - break; - case 'end': - // start effect after last queued effect has finished - timestamp = this.effects.pluck('finishOn').max() || timestamp; - break; - } - - effect.startOn += timestamp; - effect.finishOn += timestamp; - - if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) - this.effects.push(effect); - - if (!this.interval) - this.interval = setInterval(this.loop.bind(this), 15); - }, - remove: function(effect) { - this.effects = this.effects.reject(function(e) { return e==effect }); - if (this.effects.length == 0) { - clearInterval(this.interval); - this.interval = null; - } - }, - loop: function() { - var timePos = new Date().getTime(); - for(var i=0, len=this.effects.length;i= this.startOn) { - if (timePos >= this.finishOn) { - this.render(1.0); - this.cancel(); - this.event('beforeFinish'); - if (this.finish) this.finish(); - this.event('afterFinish'); - return; - } - var pos = (timePos - this.startOn) / this.totalTime, - frame = (pos * this.totalFrames).round(); - if (frame > this.currentFrame) { - this.render(pos); - this.currentFrame = frame; - } - } - }, - cancel: function() { - if (!this.options.sync) - Effect.Queues.get(Object.isString(this.options.queue) ? - 'global' : this.options.queue.scope).remove(this); - this.state = 'finished'; - }, - event: function(eventName) { - if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); - if (this.options[eventName]) this.options[eventName](this); - }, - inspect: function() { - var data = $H(); - for(property in this) - if (!Object.isFunction(this[property])) data.set(property, this[property]); - return '#'; - } -}); - -Effect.Parallel = Class.create(Effect.Base, { - initialize: function(effects) { - this.effects = effects || []; - this.start(arguments[1]); - }, - update: function(position) { - this.effects.invoke('render', position); - }, - finish: function(position) { - this.effects.each( function(effect) { - effect.render(1.0); - effect.cancel(); - effect.event('beforeFinish'); - if (effect.finish) effect.finish(position); - effect.event('afterFinish'); - }); - } -}); - -Effect.Tween = Class.create(Effect.Base, { - initialize: function(object, from, to) { - object = Object.isString(object) ? $(object) : object; - var args = $A(arguments), method = args.last(), - options = args.length == 5 ? args[3] : null; - this.method = Object.isFunction(method) ? method.bind(object) : - Object.isFunction(object[method]) ? object[method].bind(object) : - function(value) { object[method] = value }; - this.start(Object.extend({ from: from, to: to }, options || { })); - }, - update: function(position) { - this.method(position); - } -}); - -Effect.Event = Class.create(Effect.Base, { - initialize: function() { - this.start(Object.extend({ duration: 0 }, arguments[0] || { })); - }, - update: Prototype.emptyFunction -}); - -Effect.Opacity = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - // make this work on IE on elements without 'layout' - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - var options = Object.extend({ - from: this.element.getOpacity() || 0.0, - to: 1.0 - }, arguments[1] || { }); - this.start(options); - }, - update: function(position) { - this.element.setOpacity(position); - } -}); - -Effect.Move = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - x: 0, - y: 0, - mode: 'relative' - }, arguments[1] || { }); - this.start(options); - }, - setup: function() { - this.element.makePositioned(); - this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); - this.originalTop = parseFloat(this.element.getStyle('top') || '0'); - if (this.options.mode == 'absolute') { - this.options.x = this.options.x - this.originalLeft; - this.options.y = this.options.y - this.originalTop; - } - }, - update: function(position) { - this.element.setStyle({ - left: (this.options.x * position + this.originalLeft).round() + 'px', - top: (this.options.y * position + this.originalTop).round() + 'px' - }); - } -}); - -// for backwards compatibility -Effect.MoveBy = function(element, toTop, toLeft) { - return new Effect.Move(element, - Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); -}; - -Effect.Scale = Class.create(Effect.Base, { - initialize: function(element, percent) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - scaleX: true, - scaleY: true, - scaleContent: true, - scaleFromCenter: false, - scaleMode: 'box', // 'box' or 'contents' or { } with provided values - scaleFrom: 100.0, - scaleTo: percent - }, arguments[2] || { }); - this.start(options); - }, - setup: function() { - this.restoreAfterFinish = this.options.restoreAfterFinish || false; - this.elementPositioning = this.element.getStyle('position'); - - this.originalStyle = { }; - ['top','left','width','height','fontSize'].each( function(k) { - this.originalStyle[k] = this.element.style[k]; - }.bind(this)); - - this.originalTop = this.element.offsetTop; - this.originalLeft = this.element.offsetLeft; - - var fontSize = this.element.getStyle('font-size') || '100%'; - ['em','px','%','pt'].each( function(fontSizeType) { - if (fontSize.indexOf(fontSizeType)>0) { - this.fontSize = parseFloat(fontSize); - this.fontSizeType = fontSizeType; - } - }.bind(this)); - - this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; - - this.dims = null; - if (this.options.scaleMode=='box') - this.dims = [this.element.offsetHeight, this.element.offsetWidth]; - if (/^content/.test(this.options.scaleMode)) - this.dims = [this.element.scrollHeight, this.element.scrollWidth]; - if (!this.dims) - this.dims = [this.options.scaleMode.originalHeight, - this.options.scaleMode.originalWidth]; - }, - update: function(position) { - var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); - if (this.options.scaleContent && this.fontSize) - this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); - this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); - }, - finish: function(position) { - if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); - }, - setDimensions: function(height, width) { - var d = { }; - if (this.options.scaleX) d.width = width.round() + 'px'; - if (this.options.scaleY) d.height = height.round() + 'px'; - if (this.options.scaleFromCenter) { - var topd = (height - this.dims[0])/2; - var leftd = (width - this.dims[1])/2; - if (this.elementPositioning == 'absolute') { - if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; - if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; - } else { - if (this.options.scaleY) d.top = -topd + 'px'; - if (this.options.scaleX) d.left = -leftd + 'px'; - } - } - this.element.setStyle(d); - } -}); - -Effect.Highlight = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); - this.start(options); - }, - setup: function() { - // Prevent executing on elements not in the layout flow - if (this.element.getStyle('display')=='none') { this.cancel(); return; } - // Disable background image during the effect - this.oldStyle = { }; - if (!this.options.keepBackgroundImage) { - this.oldStyle.backgroundImage = this.element.getStyle('background-image'); - this.element.setStyle({backgroundImage: 'none'}); - } - if (!this.options.endcolor) - this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); - if (!this.options.restorecolor) - this.options.restorecolor = this.element.getStyle('background-color'); - // init color calculations - this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); - this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); - }, - update: function(position) { - this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ - return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); - }, - finish: function() { - this.element.setStyle(Object.extend(this.oldStyle, { - backgroundColor: this.options.restorecolor - })); - } -}); - -Effect.ScrollTo = function(element) { - var options = arguments[1] || { }, - scrollOffsets = document.viewport.getScrollOffsets(), - elementOffsets = $(element).cumulativeOffset(); - - if (options.offset) elementOffsets[1] += options.offset; - - return new Effect.Tween(null, - scrollOffsets.top, - elementOffsets[1], - options, - function(p){ scrollTo(scrollOffsets.left, p.round()); } - ); -}; - -/* ------------- combination effects ------------- */ - -Effect.Fade = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - var options = Object.extend({ - from: element.getOpacity() || 1.0, - to: 0.0, - afterFinishInternal: function(effect) { - if (effect.options.to!=0) return; - effect.element.hide().setStyle({opacity: oldOpacity}); - } - }, arguments[1] || { }); - return new Effect.Opacity(element,options); -}; - -Effect.Appear = function(element) { - element = $(element); - var options = Object.extend({ - from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), - to: 1.0, - // force Safari to render floated elements properly - afterFinishInternal: function(effect) { - effect.element.forceRerendering(); - }, - beforeSetup: function(effect) { - effect.element.setOpacity(effect.options.from).show(); - }}, arguments[1] || { }); - return new Effect.Opacity(element,options); -}; - -Effect.Puff = function(element) { - element = $(element); - var oldStyle = { - opacity: element.getInlineOpacity(), - position: element.getStyle('position'), - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height - }; - return new Effect.Parallel( - [ new Effect.Scale(element, 200, - { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], - Object.extend({ duration: 1.0, - beforeSetupInternal: function(effect) { - Position.absolutize(effect.effects[0].element); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().setStyle(oldStyle); } - }, arguments[1] || { }) - ); -}; - -Effect.BlindUp = function(element) { - element = $(element); - element.makeClipping(); - return new Effect.Scale(element, 0, - Object.extend({ scaleContent: false, - scaleX: false, - restoreAfterFinish: true, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }, arguments[1] || { }) - ); -}; - -Effect.BlindDown = function(element) { - element = $(element); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: 0, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping(); - } - }, arguments[1] || { })); -}; - -Effect.SwitchOff = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - return new Effect.Appear(element, Object.extend({ - duration: 0.4, - from: 0, - transition: Effect.Transitions.flicker, - afterFinishInternal: function(effect) { - new Effect.Scale(effect.element, 1, { - duration: 0.3, scaleFromCenter: true, - scaleX: false, scaleContent: false, restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); - } - }); - } - }, arguments[1] || { })); -}; - -Effect.DropOut = function(element) { - element = $(element); - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left'), - opacity: element.getInlineOpacity() }; - return new Effect.Parallel( - [ new Effect.Move(element, {x: 0, y: 100, sync: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 }) ], - Object.extend( - { duration: 0.5, - beforeSetup: function(effect) { - effect.effects[0].element.makePositioned(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); - } - }, arguments[1] || { })); -}; - -Effect.Shake = function(element) { - element = $(element); - var options = Object.extend({ - distance: 20, - duration: 0.5 - }, arguments[1] || {}); - var distance = parseFloat(options.distance); - var split = parseFloat(options.duration) / 10.0; - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left') }; - return new Effect.Move(element, - { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { - effect.element.undoPositioned().setStyle(oldStyle); - }}); }}); }}); }}); }}); }}); -}; - -Effect.SlideDown = function(element) { - element = $(element).cleanWhitespace(); - // SlideDown need to have the content of the element wrapped in a container element with fixed height! - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: window.opera ? 0 : 1, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } - }, arguments[1] || { }) - ); -}; - -Effect.SlideUp = function(element) { - element = $(element).cleanWhitespace(); - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, window.opera ? 0 : 1, - Object.extend({ scaleContent: false, - scaleX: false, - scaleMode: 'box', - scaleFrom: 100, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); - } - }, arguments[1] || { }) - ); -}; - -// Bug in opera makes the TD containing this element expand for a instance after finish -Effect.Squish = function(element) { - return new Effect.Scale(element, window.opera ? 1 : 0, { - restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }); -}; - -Effect.Grow = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.full - }, arguments[1] || { }); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var initialMoveX, initialMoveY; - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - initialMoveX = initialMoveY = moveX = moveY = 0; - break; - case 'top-right': - initialMoveX = dims.width; - initialMoveY = moveY = 0; - moveX = -dims.width; - break; - case 'bottom-left': - initialMoveX = moveX = 0; - initialMoveY = dims.height; - moveY = -dims.height; - break; - case 'bottom-right': - initialMoveX = dims.width; - initialMoveY = dims.height; - moveX = -dims.width; - moveY = -dims.height; - break; - case 'center': - initialMoveX = dims.width / 2; - initialMoveY = dims.height / 2; - moveX = -dims.width / 2; - moveY = -dims.height / 2; - break; - } - - return new Effect.Move(element, { - x: initialMoveX, - y: initialMoveY, - duration: 0.01, - beforeSetup: function(effect) { - effect.element.hide().makeClipping().makePositioned(); - }, - afterFinishInternal: function(effect) { - new Effect.Parallel( - [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), - new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), - new Effect.Scale(effect.element, 100, { - scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, - sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) - ], Object.extend({ - beforeSetup: function(effect) { - effect.effects[0].element.setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); - } - }, options) - ); - } - }); -}; - -Effect.Shrink = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.none - }, arguments[1] || { }); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - moveX = moveY = 0; - break; - case 'top-right': - moveX = dims.width; - moveY = 0; - break; - case 'bottom-left': - moveX = 0; - moveY = dims.height; - break; - case 'bottom-right': - moveX = dims.width; - moveY = dims.height; - break; - case 'center': - moveX = dims.width / 2; - moveY = dims.height / 2; - break; - } - - return new Effect.Parallel( - [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), - new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), - new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) - ], Object.extend({ - beforeStartInternal: function(effect) { - effect.effects[0].element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } - }, options) - ); -}; - -Effect.Pulsate = function(element) { - element = $(element); - var options = arguments[1] || { }, - oldOpacity = element.getInlineOpacity(), - transition = options.transition || Effect.Transitions.linear, - reverser = function(pos){ - return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5); - }; - - return new Effect.Opacity(element, - Object.extend(Object.extend({ duration: 2.0, from: 0, - afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } - }, options), {transition: reverser})); -}; - -Effect.Fold = function(element) { - element = $(element); - var oldStyle = { - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height }; - element.makeClipping(); - return new Effect.Scale(element, 5, Object.extend({ - scaleContent: false, - scaleX: false, - afterFinishInternal: function(effect) { - new Effect.Scale(element, 1, { - scaleContent: false, - scaleY: false, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().setStyle(oldStyle); - } }); - }}, arguments[1] || { })); -}; - -Effect.Morph = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - style: { } - }, arguments[1] || { }); - - if (!Object.isString(options.style)) this.style = $H(options.style); - else { - if (options.style.include(':')) - this.style = options.style.parseStyle(); - else { - this.element.addClassName(options.style); - this.style = $H(this.element.getStyles()); - this.element.removeClassName(options.style); - var css = this.element.getStyles(); - this.style = this.style.reject(function(style) { - return style.value == css[style.key]; - }); - options.afterFinishInternal = function(effect) { - effect.element.addClassName(effect.options.style); - effect.transforms.each(function(transform) { - effect.element.style[transform.style] = ''; - }); - }; - } - } - this.start(options); - }, - - setup: function(){ - function parseColor(color){ - if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; - color = color.parseColor(); - return $R(0,2).map(function(i){ - return parseInt( color.slice(i*2+1,i*2+3), 16 ); - }); - } - this.transforms = this.style.map(function(pair){ - var property = pair[0], value = pair[1], unit = null; - - if (value.parseColor('#zzzzzz') != '#zzzzzz') { - value = value.parseColor(); - unit = 'color'; - } else if (property == 'opacity') { - value = parseFloat(value); - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - } else if (Element.CSS_LENGTH.test(value)) { - var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); - value = parseFloat(components[1]); - unit = (components.length == 3) ? components[2] : null; - } - - var originalValue = this.element.getStyle(property); - return { - style: property.camelize(), - originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), - targetValue: unit=='color' ? parseColor(value) : value, - unit: unit - }; - }.bind(this)).reject(function(transform){ - return ( - (transform.originalValue == transform.targetValue) || - ( - transform.unit != 'color' && - (isNaN(transform.originalValue) || isNaN(transform.targetValue)) - ) - ); - }); - }, - update: function(position) { - var style = { }, transform, i = this.transforms.length; - while(i--) - style[(transform = this.transforms[i]).style] = - transform.unit=='color' ? '#'+ - (Math.round(transform.originalValue[0]+ - (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + - (Math.round(transform.originalValue[1]+ - (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + - (Math.round(transform.originalValue[2]+ - (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : - (transform.originalValue + - (transform.targetValue - transform.originalValue) * position).toFixed(3) + - (transform.unit === null ? '' : transform.unit); - this.element.setStyle(style, true); - } -}); - -Effect.Transform = Class.create({ - initialize: function(tracks){ - this.tracks = []; - this.options = arguments[1] || { }; - this.addTracks(tracks); - }, - addTracks: function(tracks){ - tracks.each(function(track){ - track = $H(track); - var data = track.values().first(); - this.tracks.push($H({ - ids: track.keys().first(), - effect: Effect.Morph, - options: { style: data } - })); - }.bind(this)); - return this; - }, - play: function(){ - return new Effect.Parallel( - this.tracks.map(function(track){ - var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); - var elements = [$(ids) || $$(ids)].flatten(); - return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); - }).flatten(), - this.options - ); - } -}); - -Element.CSS_PROPERTIES = $w( - 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + - 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + - 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + - 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + - 'fontSize fontWeight height left letterSpacing lineHeight ' + - 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ - 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + - 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + - 'right textIndent top width wordSpacing zIndex'); - -Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; - -String.__parseStyleElement = document.createElement('div'); -String.prototype.parseStyle = function(){ - var style, styleRules = $H(); - if (Prototype.Browser.WebKit) - style = new Element('div',{style:this}).style; - else { - String.__parseStyleElement.innerHTML = '
    '; - style = String.__parseStyleElement.childNodes[0].style; - } - - Element.CSS_PROPERTIES.each(function(property){ - if (style[property]) styleRules.set(property, style[property]); - }); - - if (Prototype.Browser.IE && this.include('opacity')) - styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); - - return styleRules; -}; - -if (document.defaultView && document.defaultView.getComputedStyle) { - Element.getStyles = function(element) { - var css = document.defaultView.getComputedStyle($(element), null); - return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { - styles[property] = css[property]; - return styles; - }); - }; -} else { - Element.getStyles = function(element) { - element = $(element); - var css = element.currentStyle, styles; - styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { - results[property] = css[property]; - return results; - }); - if (!styles.opacity) styles.opacity = element.getOpacity(); - return styles; - }; -} - -Effect.Methods = { - morph: function(element, style) { - element = $(element); - new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); - return element; - }, - visualEffect: function(element, effect, options) { - element = $(element); - var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); - new Effect[klass](element, options); - return element; - }, - highlight: function(element, options) { - element = $(element); - new Effect.Highlight(element, options); - return element; - } -}; - -$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ - 'pulsate shake puff squish switchOff dropOut').each( - function(effect) { - Effect.Methods[effect] = function(element, options){ - element = $(element); - Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); - return element; - }; - } -); - -$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( - function(f) { Effect.Methods[f] = Element[f]; } -); - -Element.addMethods(Effect.Methods); \ No newline at end of file diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/prototype.js b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/prototype.js deleted file mode 100644 index 06249a6..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/prototype.js +++ /dev/null @@ -1,6001 +0,0 @@ -/* Prototype JavaScript framework, version 1.7_rc2 - * (c) 2005-2010 Sam Stephenson - * - * Prototype is freely distributable under the terms of an MIT-style license. - * For details, see the Prototype web site: http://www.prototypejs.org/ - * - *--------------------------------------------------------------------------*/ - -var Prototype = { - - Version: '1.7_rc2', - - Browser: (function(){ - var ua = navigator.userAgent; - var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]'; - return { - IE: !!window.attachEvent && !isOpera, - Opera: isOpera, - WebKit: ua.indexOf('AppleWebKit/') > -1, - Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1, - MobileSafari: /Apple.*Mobile/.test(ua) - } - })(), - - BrowserFeatures: { - XPath: !!document.evaluate, - - SelectorsAPI: !!document.querySelector, - - ElementExtensions: (function() { - var constructor = window.Element || window.HTMLElement; - return !!(constructor && constructor.prototype); - })(), - SpecificElementExtensions: (function() { - if (typeof window.HTMLDivElement !== 'undefined') - return true; - - var div = document.createElement('div'), - form = document.createElement('form'), - isSupported = false; - - if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) { - isSupported = true; - } - - div = form = null; - - return isSupported; - })() - }, - - ScriptFragment: ']*>([\\S\\s]*?)<\/script>', - JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, - - emptyFunction: function() { }, - - K: function(x) { return x } -}; - -if (Prototype.Browser.MobileSafari) - Prototype.BrowserFeatures.SpecificElementExtensions = false; - - -var Abstract = { }; - - -var Try = { - these: function() { - var returnValue; - - for (var i = 0, length = arguments.length; i < length; i++) { - var lambda = arguments[i]; - try { - returnValue = lambda(); - break; - } catch (e) { } - } - - return returnValue; - } -}; - -/* Based on Alex Arnell's inheritance implementation. */ - -var Class = (function() { - - var IS_DONTENUM_BUGGY = (function(){ - for (var p in { toString: 1 }) { - if (p === 'toString') return false; - } - return true; - })(); - - function subclass() {}; - function create() { - var parent = null, properties = $A(arguments); - if (Object.isFunction(properties[0])) - parent = properties.shift(); - - function klass() { - this.initialize.apply(this, arguments); - } - - Object.extend(klass, Class.Methods); - klass.superclass = parent; - klass.subclasses = []; - - if (parent) { - subclass.prototype = parent.prototype; - klass.prototype = new subclass; - parent.subclasses.push(klass); - } - - for (var i = 0, length = properties.length; i < length; i++) - klass.addMethods(properties[i]); - - if (!klass.prototype.initialize) - klass.prototype.initialize = Prototype.emptyFunction; - - klass.prototype.constructor = klass; - return klass; - } - - function addMethods(source) { - var ancestor = this.superclass && this.superclass.prototype, - properties = Object.keys(source); - - if (IS_DONTENUM_BUGGY) { - if (source.toString != Object.prototype.toString) - properties.push("toString"); - if (source.valueOf != Object.prototype.valueOf) - properties.push("valueOf"); - } - - for (var i = 0, length = properties.length; i < length; i++) { - var property = properties[i], value = source[property]; - if (ancestor && Object.isFunction(value) && - value.argumentNames()[0] == "$super") { - var method = value; - value = (function(m) { - return function() { return ancestor[m].apply(this, arguments); }; - })(property).wrap(method); - - value.valueOf = method.valueOf.bind(method); - value.toString = method.toString.bind(method); - } - this.prototype[property] = value; - } - - return this; - } - - return { - create: create, - Methods: { - addMethods: addMethods - } - }; -})(); -(function() { - - var _toString = Object.prototype.toString, - NULL_TYPE = 'Null', - UNDEFINED_TYPE = 'Undefined', - BOOLEAN_TYPE = 'Boolean', - NUMBER_TYPE = 'Number', - STRING_TYPE = 'String', - OBJECT_TYPE = 'Object', - BOOLEAN_CLASS = '[object Boolean]', - NUMBER_CLASS = '[object Number]', - STRING_CLASS = '[object String]', - ARRAY_CLASS = '[object Array]', - NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON && - typeof JSON.stringify === 'function' && - JSON.stringify(0) === '0' && - typeof JSON.stringify(Prototype.K) === 'undefined'; - - function Type(o) { - switch(o) { - case null: return NULL_TYPE; - case (void 0): return UNDEFINED_TYPE; - } - var type = typeof o; - switch(type) { - case 'boolean': return BOOLEAN_TYPE; - case 'number': return NUMBER_TYPE; - case 'string': return STRING_TYPE; - } - return OBJECT_TYPE; - } - - function extend(destination, source) { - for (var property in source) - destination[property] = source[property]; - return destination; - } - - function inspect(object) { - try { - if (isUndefined(object)) return 'undefined'; - if (object === null) return 'null'; - return object.inspect ? object.inspect() : String(object); - } catch (e) { - if (e instanceof RangeError) return '...'; - throw e; - } - } - - function toJSON(value) { - return Str('', { '': value }, []); - } - - function Str(key, holder, stack) { - var value = holder[key], - type = typeof value; - - if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - - var _class = _toString.call(value); - - switch (_class) { - case NUMBER_CLASS: - case BOOLEAN_CLASS: - case STRING_CLASS: - value = value.valueOf(); - } - - switch (value) { - case null: return 'null'; - case true: return 'true'; - case false: return 'false'; - } - - type = typeof value; - switch (type) { - case 'string': - return value.inspect(true); - case 'number': - return isFinite(value) ? String(value) : 'null'; - case 'object': - - for (var i = 0, length = stack.length; i < length; i++) { - if (stack[i] === value) { throw new TypeError(); } - } - stack.push(value); - - var partial = []; - if (_class === ARRAY_CLASS) { - for (var i = 0, length = value.length; i < length; i++) { - var str = Str(i, value, stack); - partial.push(typeof str === 'undefined' ? 'null' : str); - } - partial = '[' + partial.join(',') + ']'; - } else { - var keys = Object.keys(value); - for (var i = 0, length = keys.length; i < length; i++) { - var key = keys[i], str = Str(key, value, stack); - if (typeof str !== "undefined") { - partial.push(key.inspect(true)+ ':' + str); - } - } - partial = '{' + partial.join(',') + '}'; - } - stack.pop(); - return partial; - } - } - - function stringify(object) { - return JSON.stringify(object); - } - - function toQueryString(object) { - return $H(object).toQueryString(); - } - - function toHTML(object) { - return object && object.toHTML ? object.toHTML() : String.interpret(object); - } - - function keys(object) { - if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); } - var results = []; - for (var property in object) { - if (object.hasOwnProperty(property)) { - results.push(property); - } - } - return results; - } - - function values(object) { - var results = []; - for (var property in object) - results.push(object[property]); - return results; - } - - function clone(object) { - return extend({ }, object); - } - - function isElement(object) { - return !!(object && object.nodeType == 1); - } - - function isArray(object) { - return _toString.call(object) === ARRAY_CLASS; - } - - var hasNativeIsArray = (typeof Array.isArray == 'function') - && Array.isArray([]) && !Array.isArray({}); - - if (hasNativeIsArray) { - isArray = Array.isArray; - } - - function isHash(object) { - return object instanceof Hash; - } - - function isFunction(object) { - return typeof object === "function"; - } - - function isString(object) { - return _toString.call(object) === STRING_CLASS; - } - - function isNumber(object) { - return _toString.call(object) === NUMBER_CLASS; - } - - function isUndefined(object) { - return typeof object === "undefined"; - } - - extend(Object, { - extend: extend, - inspect: inspect, - toJSON: NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON, - toQueryString: toQueryString, - toHTML: toHTML, - keys: Object.keys || keys, - values: values, - clone: clone, - isElement: isElement, - isArray: isArray, - isHash: isHash, - isFunction: isFunction, - isString: isString, - isNumber: isNumber, - isUndefined: isUndefined - }); -})(); -Object.extend(Function.prototype, (function() { - var slice = Array.prototype.slice; - - function update(array, args) { - var arrayLength = array.length, length = args.length; - while (length--) array[arrayLength + length] = args[length]; - return array; - } - - function merge(array, args) { - array = slice.call(array, 0); - return update(array, args); - } - - function argumentNames() { - var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1] - .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '') - .replace(/\s+/g, '').split(','); - return names.length == 1 && !names[0] ? [] : names; - } - - function bind(context) { - if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; - var __method = this, args = slice.call(arguments, 1); - return function() { - var a = merge(args, arguments); - return __method.apply(context, a); - } - } - - function bindAsEventListener(context) { - var __method = this, args = slice.call(arguments, 1); - return function(event) { - var a = update([event || window.event], args); - return __method.apply(context, a); - } - } - - function curry() { - if (!arguments.length) return this; - var __method = this, args = slice.call(arguments, 0); - return function() { - var a = merge(args, arguments); - return __method.apply(this, a); - } - } - - function delay(timeout) { - var __method = this, args = slice.call(arguments, 1); - timeout = timeout * 1000; - return window.setTimeout(function() { - return __method.apply(__method, args); - }, timeout); - } - - function defer() { - var args = update([0.01], arguments); - return this.delay.apply(this, args); - } - - function wrap(wrapper) { - var __method = this; - return function() { - var a = update([__method.bind(this)], arguments); - return wrapper.apply(this, a); - } - } - - function methodize() { - if (this._methodized) return this._methodized; - var __method = this; - return this._methodized = function() { - var a = update([this], arguments); - return __method.apply(null, a); - }; - } - - return { - argumentNames: argumentNames, - bind: bind, - bindAsEventListener: bindAsEventListener, - curry: curry, - delay: delay, - defer: defer, - wrap: wrap, - methodize: methodize - } -})()); - - - -(function(proto) { - - - function toISOString() { - return this.getUTCFullYear() + '-' + - (this.getUTCMonth() + 1).toPaddedString(2) + '-' + - this.getUTCDate().toPaddedString(2) + 'T' + - this.getUTCHours().toPaddedString(2) + ':' + - this.getUTCMinutes().toPaddedString(2) + ':' + - this.getUTCSeconds().toPaddedString(2) + 'Z'; - } - - - function toJSON() { - return this.toISOString(); - } - - if (!proto.toISOString) proto.toISOString = toISOString; - if (!proto.toJSON) proto.toJSON = toJSON; - -})(Date.prototype); - - -RegExp.prototype.match = RegExp.prototype.test; - -RegExp.escape = function(str) { - return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); -}; -var PeriodicalExecuter = Class.create({ - initialize: function(callback, frequency) { - this.callback = callback; - this.frequency = frequency; - this.currentlyExecuting = false; - - this.registerCallback(); - }, - - registerCallback: function() { - this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - execute: function() { - this.callback(this); - }, - - stop: function() { - if (!this.timer) return; - clearInterval(this.timer); - this.timer = null; - }, - - onTimerEvent: function() { - if (!this.currentlyExecuting) { - try { - this.currentlyExecuting = true; - this.execute(); - this.currentlyExecuting = false; - } catch(e) { - this.currentlyExecuting = false; - throw e; - } - } - } -}); -Object.extend(String, { - interpret: function(value) { - return value == null ? '' : String(value); - }, - specialChar: { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '\\': '\\\\' - } -}); - -Object.extend(String.prototype, (function() { - var NATIVE_JSON_PARSE_SUPPORT = window.JSON && - typeof JSON.parse === 'function' && - JSON.parse('{"test": true}').test; - - function prepareReplacement(replacement) { - if (Object.isFunction(replacement)) return replacement; - var template = new Template(replacement); - return function(match) { return template.evaluate(match) }; - } - - function gsub(pattern, replacement) { - var result = '', source = this, match; - replacement = prepareReplacement(replacement); - - if (Object.isString(pattern)) - pattern = RegExp.escape(pattern); - - if (!(pattern.length || pattern.source)) { - replacement = replacement(''); - return replacement + source.split('').join(replacement) + replacement; - } - - while (source.length > 0) { - if (match = source.match(pattern)) { - result += source.slice(0, match.index); - result += String.interpret(replacement(match)); - source = source.slice(match.index + match[0].length); - } else { - result += source, source = ''; - } - } - return result; - } - - function sub(pattern, replacement, count) { - replacement = prepareReplacement(replacement); - count = Object.isUndefined(count) ? 1 : count; - - return this.gsub(pattern, function(match) { - if (--count < 0) return match[0]; - return replacement(match); - }); - } - - function scan(pattern, iterator) { - this.gsub(pattern, iterator); - return String(this); - } - - function truncate(length, truncation) { - length = length || 30; - truncation = Object.isUndefined(truncation) ? '...' : truncation; - return this.length > length ? - this.slice(0, length - truncation.length) + truncation : String(this); - } - - function strip() { - return this.replace(/^\s+/, '').replace(/\s+$/, ''); - } - - function stripTags() { - return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, ''); - } - - function stripScripts() { - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); - } - - function extractScripts() { - var matchAll = new RegExp(Prototype.ScriptFragment, 'img'), - matchOne = new RegExp(Prototype.ScriptFragment, 'im'); - return (this.match(matchAll) || []).map(function(scriptTag) { - return (scriptTag.match(matchOne) || ['', ''])[1]; - }); - } - - function evalScripts() { - return this.extractScripts().map(function(script) { return eval(script) }); - } - - function escapeHTML() { - return this.replace(/&/g,'&').replace(//g,'>'); - } - - function unescapeHTML() { - return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&'); - } - - - function toQueryParams(separator) { - var match = this.strip().match(/([^?#]*)(#.*)?$/); - if (!match) return { }; - - return match[1].split(separator || '&').inject({ }, function(hash, pair) { - if ((pair = pair.split('='))[0]) { - var key = decodeURIComponent(pair.shift()), - value = pair.length > 1 ? pair.join('=') : pair[0]; - - if (value != undefined) value = decodeURIComponent(value); - - if (key in hash) { - if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; - hash[key].push(value); - } - else hash[key] = value; - } - return hash; - }); - } - - function toArray() { - return this.split(''); - } - - function succ() { - return this.slice(0, this.length - 1) + - String.fromCharCode(this.charCodeAt(this.length - 1) + 1); - } - - function times(count) { - return count < 1 ? '' : new Array(count + 1).join(this); - } - - function camelize() { - return this.replace(/-+(.)?/g, function(match, chr) { - return chr ? chr.toUpperCase() : ''; - }); - } - - function capitalize() { - return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); - } - - function underscore() { - return this.replace(/::/g, '/') - .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') - .replace(/([a-z\d])([A-Z])/g, '$1_$2') - .replace(/-/g, '_') - .toLowerCase(); - } - - function dasherize() { - return this.replace(/_/g, '-'); - } - - function inspect(useDoubleQuotes) { - var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) { - if (character in String.specialChar) { - return String.specialChar[character]; - } - return '\\u00' + character.charCodeAt().toPaddedString(2, 16); - }); - if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; - return "'" + escapedString.replace(/'/g, '\\\'') + "'"; - } - - function unfilterJSON(filter) { - return this.replace(filter || Prototype.JSONFilter, '$1'); - } - - function isJSON() { - var str = this; - if (str.blank()) return false; - str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'); - str = str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'); - str = str.replace(/(?:^|:|,)(?:\s*\[)+/g, ''); - return (/^[\],:{}\s]*$/).test(str); - } - - function evalJSON(sanitize) { - var json = this.unfilterJSON(), - cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; - if (cx.test(json)) { - json = json.replace(cx, function (a) { - return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - try { - if (!sanitize || json.isJSON()) return eval('(' + json + ')'); - } catch (e) { } - throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); - } - - function parseJSON() { - var json = this.unfilterJSON(); - return JSON.parse(json); - } - - function include(pattern) { - return this.indexOf(pattern) > -1; - } - - function startsWith(pattern) { - return this.lastIndexOf(pattern, 0) === 0; - } - - function endsWith(pattern) { - var d = this.length - pattern.length; - return d >= 0 && this.indexOf(pattern, d) === d; - } - - function empty() { - return this == ''; - } - - function blank() { - return /^\s*$/.test(this); - } - - function interpolate(object, pattern) { - return new Template(this, pattern).evaluate(object); - } - - return { - gsub: gsub, - sub: sub, - scan: scan, - truncate: truncate, - strip: String.prototype.trim || strip, - stripTags: stripTags, - stripScripts: stripScripts, - extractScripts: extractScripts, - evalScripts: evalScripts, - escapeHTML: escapeHTML, - unescapeHTML: unescapeHTML, - toQueryParams: toQueryParams, - parseQuery: toQueryParams, - toArray: toArray, - succ: succ, - times: times, - camelize: camelize, - capitalize: capitalize, - underscore: underscore, - dasherize: dasherize, - inspect: inspect, - unfilterJSON: unfilterJSON, - isJSON: isJSON, - evalJSON: NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON, - include: include, - startsWith: startsWith, - endsWith: endsWith, - empty: empty, - blank: blank, - interpolate: interpolate - }; -})()); - -var Template = Class.create({ - initialize: function(template, pattern) { - this.template = template.toString(); - this.pattern = pattern || Template.Pattern; - }, - - evaluate: function(object) { - if (object && Object.isFunction(object.toTemplateReplacements)) - object = object.toTemplateReplacements(); - - return this.template.gsub(this.pattern, function(match) { - if (object == null) return (match[1] + ''); - - var before = match[1] || ''; - if (before == '\\') return match[2]; - - var ctx = object, expr = match[3], - pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; - - match = pattern.exec(expr); - if (match == null) return before; - - while (match != null) { - var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1]; - ctx = ctx[comp]; - if (null == ctx || '' == match[3]) break; - expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); - match = pattern.exec(expr); - } - - return before + String.interpret(ctx); - }); - } -}); -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; - -var $break = { }; - -var Enumerable = (function() { - function each(iterator, context) { - var index = 0; - try { - this._each(function(value) { - iterator.call(context, value, index++); - }); - } catch (e) { - if (e != $break) throw e; - } - return this; - } - - function eachSlice(number, iterator, context) { - var index = -number, slices = [], array = this.toArray(); - if (number < 1) return array; - while ((index += number) < array.length) - slices.push(array.slice(index, index+number)); - return slices.collect(iterator, context); - } - - function all(iterator, context) { - iterator = iterator || Prototype.K; - var result = true; - this.each(function(value, index) { - result = result && !!iterator.call(context, value, index); - if (!result) throw $break; - }); - return result; - } - - function any(iterator, context) { - iterator = iterator || Prototype.K; - var result = false; - this.each(function(value, index) { - if (result = !!iterator.call(context, value, index)) - throw $break; - }); - return result; - } - - function collect(iterator, context) { - iterator = iterator || Prototype.K; - var results = []; - this.each(function(value, index) { - results.push(iterator.call(context, value, index)); - }); - return results; - } - - function detect(iterator, context) { - var result; - this.each(function(value, index) { - if (iterator.call(context, value, index)) { - result = value; - throw $break; - } - }); - return result; - } - - function findAll(iterator, context) { - var results = []; - this.each(function(value, index) { - if (iterator.call(context, value, index)) - results.push(value); - }); - return results; - } - - function grep(filter, iterator, context) { - iterator = iterator || Prototype.K; - var results = []; - - if (Object.isString(filter)) - filter = new RegExp(RegExp.escape(filter)); - - this.each(function(value, index) { - if (filter.match(value)) - results.push(iterator.call(context, value, index)); - }); - return results; - } - - function include(object) { - if (Object.isFunction(this.indexOf)) - if (this.indexOf(object) != -1) return true; - - var found = false; - this.each(function(value) { - if (value == object) { - found = true; - throw $break; - } - }); - return found; - } - - function inGroupsOf(number, fillWith) { - fillWith = Object.isUndefined(fillWith) ? null : fillWith; - return this.eachSlice(number, function(slice) { - while(slice.length < number) slice.push(fillWith); - return slice; - }); - } - - function inject(memo, iterator, context) { - this.each(function(value, index) { - memo = iterator.call(context, memo, value, index); - }); - return memo; - } - - function invoke(method) { - var args = $A(arguments).slice(1); - return this.map(function(value) { - return value[method].apply(value, args); - }); - } - - function max(iterator, context) { - iterator = iterator || Prototype.K; - var result; - this.each(function(value, index) { - value = iterator.call(context, value, index); - if (result == null || value >= result) - result = value; - }); - return result; - } - - function min(iterator, context) { - iterator = iterator || Prototype.K; - var result; - this.each(function(value, index) { - value = iterator.call(context, value, index); - if (result == null || value < result) - result = value; - }); - return result; - } - - function partition(iterator, context) { - iterator = iterator || Prototype.K; - var trues = [], falses = []; - this.each(function(value, index) { - (iterator.call(context, value, index) ? - trues : falses).push(value); - }); - return [trues, falses]; - } - - function pluck(property) { - var results = []; - this.each(function(value) { - results.push(value[property]); - }); - return results; - } - - function reject(iterator, context) { - var results = []; - this.each(function(value, index) { - if (!iterator.call(context, value, index)) - results.push(value); - }); - return results; - } - - function sortBy(iterator, context) { - return this.map(function(value, index) { - return { - value: value, - criteria: iterator.call(context, value, index) - }; - }).sort(function(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }).pluck('value'); - } - - function toArray() { - return this.map(); - } - - function zip() { - var iterator = Prototype.K, args = $A(arguments); - if (Object.isFunction(args.last())) - iterator = args.pop(); - - var collections = [this].concat(args).map($A); - return this.map(function(value, index) { - return iterator(collections.pluck(index)); - }); - } - - function size() { - return this.toArray().length; - } - - function inspect() { - return '#'; - } - - - - - - - - - - return { - each: each, - eachSlice: eachSlice, - all: all, - every: all, - any: any, - some: any, - collect: collect, - map: collect, - detect: detect, - findAll: findAll, - select: findAll, - filter: findAll, - grep: grep, - include: include, - member: include, - inGroupsOf: inGroupsOf, - inject: inject, - invoke: invoke, - max: max, - min: min, - partition: partition, - pluck: pluck, - reject: reject, - sortBy: sortBy, - toArray: toArray, - entries: toArray, - zip: zip, - size: size, - inspect: inspect, - find: detect - }; -})(); - -function $A(iterable) { - if (!iterable) return []; - if ('toArray' in Object(iterable)) return iterable.toArray(); - var length = iterable.length || 0, results = new Array(length); - while (length--) results[length] = iterable[length]; - return results; -} - - -function $w(string) { - if (!Object.isString(string)) return []; - string = string.strip(); - return string ? string.split(/\s+/) : []; -} - -Array.from = $A; - - -(function() { - var arrayProto = Array.prototype, - slice = arrayProto.slice, - _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available - - function each(iterator) { - for (var i = 0, length = this.length; i < length; i++) - iterator(this[i]); - } - if (!_each) _each = each; - - function clear() { - this.length = 0; - return this; - } - - function first() { - return this[0]; - } - - function last() { - return this[this.length - 1]; - } - - function compact() { - return this.select(function(value) { - return value != null; - }); - } - - function flatten() { - return this.inject([], function(array, value) { - if (Object.isArray(value)) - return array.concat(value.flatten()); - array.push(value); - return array; - }); - } - - function without() { - var values = slice.call(arguments, 0); - return this.select(function(value) { - return !values.include(value); - }); - } - - function reverse(inline) { - return (inline === false ? this.toArray() : this)._reverse(); - } - - function uniq(sorted) { - return this.inject([], function(array, value, index) { - if (0 == index || (sorted ? array.last() != value : !array.include(value))) - array.push(value); - return array; - }); - } - - function intersect(array) { - return this.uniq().findAll(function(item) { - return array.detect(function(value) { return item === value }); - }); - } - - - function clone() { - return slice.call(this, 0); - } - - function size() { - return this.length; - } - - function inspect() { - return '[' + this.map(Object.inspect).join(', ') + ']'; - } - - function indexOf(item, i) { - i || (i = 0); - var length = this.length; - if (i < 0) i = length + i; - for (; i < length; i++) - if (this[i] === item) return i; - return -1; - } - - function lastIndexOf(item, i) { - i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; - var n = this.slice(0, i).reverse().indexOf(item); - return (n < 0) ? n : i - n - 1; - } - - function concat() { - var array = slice.call(this, 0), item; - for (var i = 0, length = arguments.length; i < length; i++) { - item = arguments[i]; - if (Object.isArray(item) && !('callee' in item)) { - for (var j = 0, arrayLength = item.length; j < arrayLength; j++) - array.push(item[j]); - } else { - array.push(item); - } - } - return array; - } - - Object.extend(arrayProto, Enumerable); - - if (!arrayProto._reverse) - arrayProto._reverse = arrayProto.reverse; - - Object.extend(arrayProto, { - _each: _each, - clear: clear, - first: first, - last: last, - compact: compact, - flatten: flatten, - without: without, - reverse: reverse, - uniq: uniq, - intersect: intersect, - clone: clone, - toArray: clone, - size: size, - inspect: inspect - }); - - var CONCAT_ARGUMENTS_BUGGY = (function() { - return [].concat(arguments)[0][0] !== 1; - })(1,2) - - if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat; - - if (!arrayProto.indexOf) arrayProto.indexOf = indexOf; - if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf; -})(); -function $H(object) { - return new Hash(object); -}; - -var Hash = Class.create(Enumerable, (function() { - function initialize(object) { - this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); - } - - - function _each(iterator) { - for (var key in this._object) { - var value = this._object[key], pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); - } - } - - function set(key, value) { - return this._object[key] = value; - } - - function get(key) { - if (this._object[key] !== Object.prototype[key]) - return this._object[key]; - } - - function unset(key) { - var value = this._object[key]; - delete this._object[key]; - return value; - } - - function toObject() { - return Object.clone(this._object); - } - - - - function keys() { - return this.pluck('key'); - } - - function values() { - return this.pluck('value'); - } - - function index(value) { - var match = this.detect(function(pair) { - return pair.value === value; - }); - return match && match.key; - } - - function merge(object) { - return this.clone().update(object); - } - - function update(object) { - return new Hash(object).inject(this, function(result, pair) { - result.set(pair.key, pair.value); - return result; - }); - } - - function toQueryPair(key, value) { - if (Object.isUndefined(value)) return key; - return key + '=' + encodeURIComponent(String.interpret(value)); - } - - function toQueryString() { - return this.inject([], function(results, pair) { - var key = encodeURIComponent(pair.key), values = pair.value; - - if (values && typeof values == 'object') { - if (Object.isArray(values)) - return results.concat(values.map(toQueryPair.curry(key))); - } else results.push(toQueryPair(key, values)); - return results; - }).join('&'); - } - - function inspect() { - return '#'; - } - - function clone() { - return new Hash(this); - } - - return { - initialize: initialize, - _each: _each, - set: set, - get: get, - unset: unset, - toObject: toObject, - toTemplateReplacements: toObject, - keys: keys, - values: values, - index: index, - merge: merge, - update: update, - toQueryString: toQueryString, - inspect: inspect, - toJSON: toObject, - clone: clone - }; -})()); - -Hash.from = $H; -Object.extend(Number.prototype, (function() { - function toColorPart() { - return this.toPaddedString(2, 16); - } - - function succ() { - return this + 1; - } - - function times(iterator, context) { - $R(0, this, true).each(iterator, context); - return this; - } - - function toPaddedString(length, radix) { - var string = this.toString(radix || 10); - return '0'.times(length - string.length) + string; - } - - function abs() { - return Math.abs(this); - } - - function round() { - return Math.round(this); - } - - function ceil() { - return Math.ceil(this); - } - - function floor() { - return Math.floor(this); - } - - return { - toColorPart: toColorPart, - succ: succ, - times: times, - toPaddedString: toPaddedString, - abs: abs, - round: round, - ceil: ceil, - floor: floor - }; -})()); - -function $R(start, end, exclusive) { - return new ObjectRange(start, end, exclusive); -} - -var ObjectRange = Class.create(Enumerable, (function() { - function initialize(start, end, exclusive) { - this.start = start; - this.end = end; - this.exclusive = exclusive; - } - - function _each(iterator) { - var value = this.start; - while (this.include(value)) { - iterator(value); - value = value.succ(); - } - } - - function include(value) { - if (value < this.start) - return false; - if (this.exclusive) - return value < this.end; - return value <= this.end; - } - - return { - initialize: initialize, - _each: _each, - include: include - }; -})()); - - - -var Ajax = { - getTransport: function() { - return Try.these( - function() {return new XMLHttpRequest()}, - function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')} - ) || false; - }, - - activeRequestCount: 0 -}; - -Ajax.Responders = { - responders: [], - - _each: function(iterator) { - this.responders._each(iterator); - }, - - register: function(responder) { - if (!this.include(responder)) - this.responders.push(responder); - }, - - unregister: function(responder) { - this.responders = this.responders.without(responder); - }, - - dispatch: function(callback, request, transport, json) { - this.each(function(responder) { - if (Object.isFunction(responder[callback])) { - try { - responder[callback].apply(responder, [request, transport, json]); - } catch (e) { } - } - }); - } -}; - -Object.extend(Ajax.Responders, Enumerable); - -Ajax.Responders.register({ - onCreate: function() { Ajax.activeRequestCount++ }, - onComplete: function() { Ajax.activeRequestCount-- } -}); -Ajax.Base = Class.create({ - initialize: function(options) { - this.options = { - method: 'post', - asynchronous: true, - contentType: 'application/x-www-form-urlencoded', - encoding: 'UTF-8', - parameters: '', - evalJSON: true, - evalJS: true - }; - Object.extend(this.options, options || { }); - - this.options.method = this.options.method.toLowerCase(); - - if (Object.isString(this.options.parameters)) - this.options.parameters = this.options.parameters.toQueryParams(); - else if (Object.isHash(this.options.parameters)) - this.options.parameters = this.options.parameters.toObject(); - } -}); -Ajax.Request = Class.create(Ajax.Base, { - _complete: false, - - initialize: function($super, url, options) { - $super(options); - this.transport = Ajax.getTransport(); - this.request(url); - }, - - request: function(url) { - this.url = url; - this.method = this.options.method; - var params = Object.clone(this.options.parameters); - - if (!['get', 'post'].include(this.method)) { - params['_method'] = this.method; - this.method = 'post'; - } - - this.parameters = params; - - if (params = Object.toQueryString(params)) { - if (this.method == 'get') - this.url += (this.url.include('?') ? '&' : '?') + params; - else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) - params += '&_='; - } - - try { - var response = new Ajax.Response(this); - if (this.options.onCreate) this.options.onCreate(response); - Ajax.Responders.dispatch('onCreate', this, response); - - this.transport.open(this.method.toUpperCase(), this.url, - this.options.asynchronous); - - if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); - - this.transport.onreadystatechange = this.onStateChange.bind(this); - this.setRequestHeaders(); - - this.body = this.method == 'post' ? (this.options.postBody || params) : null; - this.transport.send(this.body); - - /* Force Firefox to handle ready state 4 for synchronous requests */ - if (!this.options.asynchronous && this.transport.overrideMimeType) - this.onStateChange(); - - } - catch (e) { - this.dispatchException(e); - } - }, - - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState > 1 && !((readyState == 4) && this._complete)) - this.respondToReadyState(this.transport.readyState); - }, - - setRequestHeaders: function() { - var headers = { - 'X-Requested-With': 'XMLHttpRequest', - 'X-Prototype-Version': Prototype.Version, - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - }; - - if (this.method == 'post') { - headers['Content-type'] = this.options.contentType + - (this.options.encoding ? '; charset=' + this.options.encoding : ''); - - /* Force "Connection: close" for older Mozilla browsers to work - * around a bug where XMLHttpRequest sends an incorrect - * Content-length header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType && - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) - headers['Connection'] = 'close'; - } - - if (typeof this.options.requestHeaders == 'object') { - var extras = this.options.requestHeaders; - - if (Object.isFunction(extras.push)) - for (var i = 0, length = extras.length; i < length; i += 2) - headers[extras[i]] = extras[i+1]; - else - $H(extras).each(function(pair) { headers[pair.key] = pair.value }); - } - - for (var name in headers) - this.transport.setRequestHeader(name, headers[name]); - }, - - success: function() { - var status = this.getStatus(); - return !status || (status >= 200 && status < 300); - }, - - getStatus: function() { - try { - return this.transport.status || 0; - } catch (e) { return 0 } - }, - - respondToReadyState: function(readyState) { - var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); - - if (state == 'Complete') { - try { - this._complete = true; - (this.options['on' + response.status] - || this.options['on' + (this.success() ? 'Success' : 'Failure')] - || Prototype.emptyFunction)(response, response.headerJSON); - } catch (e) { - this.dispatchException(e); - } - - var contentType = response.getHeader('Content-type'); - if (this.options.evalJS == 'force' - || (this.options.evalJS && this.isSameOrigin() && contentType - && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) - this.evalResponse(); - } - - try { - (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); - Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); - } catch (e) { - this.dispatchException(e); - } - - if (state == 'Complete') { - this.transport.onreadystatechange = Prototype.emptyFunction; - } - }, - - isSameOrigin: function() { - var m = this.url.match(/^\s*https?:\/\/[^\/]*/); - return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ - protocol: location.protocol, - domain: document.domain, - port: location.port ? ':' + location.port : '' - })); - }, - - getHeader: function(name) { - try { - return this.transport.getResponseHeader(name) || null; - } catch (e) { return null; } - }, - - evalResponse: function() { - try { - return eval((this.transport.responseText || '').unfilterJSON()); - } catch (e) { - this.dispatchException(e); - } - }, - - dispatchException: function(exception) { - (this.options.onException || Prototype.emptyFunction)(this, exception); - Ajax.Responders.dispatch('onException', this, exception); - } -}); - -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - - - - - - - - -Ajax.Response = Class.create({ - initialize: function(request){ - this.request = request; - var transport = this.transport = request.transport, - readyState = this.readyState = transport.readyState; - - if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { - this.status = this.getStatus(); - this.statusText = this.getStatusText(); - this.responseText = String.interpret(transport.responseText); - this.headerJSON = this._getHeaderJSON(); - } - - if (readyState == 4) { - var xml = transport.responseXML; - this.responseXML = Object.isUndefined(xml) ? null : xml; - this.responseJSON = this._getResponseJSON(); - } - }, - - status: 0, - - statusText: '', - - getStatus: Ajax.Request.prototype.getStatus, - - getStatusText: function() { - try { - return this.transport.statusText || ''; - } catch (e) { return '' } - }, - - getHeader: Ajax.Request.prototype.getHeader, - - getAllHeaders: function() { - try { - return this.getAllResponseHeaders(); - } catch (e) { return null } - }, - - getResponseHeader: function(name) { - return this.transport.getResponseHeader(name); - }, - - getAllResponseHeaders: function() { - return this.transport.getAllResponseHeaders(); - }, - - _getHeaderJSON: function() { - var json = this.getHeader('X-JSON'); - if (!json) return null; - json = decodeURIComponent(escape(json)); - try { - return json.evalJSON(this.request.options.sanitizeJSON || - !this.request.isSameOrigin()); - } catch (e) { - this.request.dispatchException(e); - } - }, - - _getResponseJSON: function() { - var options = this.request.options; - if (!options.evalJSON || (options.evalJSON != 'force' && - !(this.getHeader('Content-type') || '').include('application/json')) || - this.responseText.blank()) - return null; - try { - return this.responseText.evalJSON(options.sanitizeJSON || - !this.request.isSameOrigin()); - } catch (e) { - this.request.dispatchException(e); - } - } -}); - -Ajax.Updater = Class.create(Ajax.Request, { - initialize: function($super, container, url, options) { - this.container = { - success: (container.success || container), - failure: (container.failure || (container.success ? null : container)) - }; - - options = Object.clone(options); - var onComplete = options.onComplete; - options.onComplete = (function(response, json) { - this.updateContent(response.responseText); - if (Object.isFunction(onComplete)) onComplete(response, json); - }).bind(this); - - $super(url, options); - }, - - updateContent: function(responseText) { - var receiver = this.container[this.success() ? 'success' : 'failure'], - options = this.options; - - if (!options.evalScripts) responseText = responseText.stripScripts(); - - if (receiver = $(receiver)) { - if (options.insertion) { - if (Object.isString(options.insertion)) { - var insertion = { }; insertion[options.insertion] = responseText; - receiver.insert(insertion); - } - else options.insertion(receiver, responseText); - } - else receiver.update(responseText); - } - } -}); - -Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { - initialize: function($super, container, url, options) { - $super(options); - this.onComplete = this.options.onComplete; - - this.frequency = (this.options.frequency || 2); - this.decay = (this.options.decay || 1); - - this.updater = { }; - this.container = container; - this.url = url; - - this.start(); - }, - - start: function() { - this.options.onComplete = this.updateComplete.bind(this); - this.onTimerEvent(); - }, - - stop: function() { - this.updater.options.onComplete = undefined; - clearTimeout(this.timer); - (this.onComplete || Prototype.emptyFunction).apply(this, arguments); - }, - - updateComplete: function(response) { - if (this.options.decay) { - this.decay = (response.responseText == this.lastText ? - this.decay * this.options.decay : 1); - - this.lastText = response.responseText; - } - this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); - }, - - onTimerEvent: function() { - this.updater = new Ajax.Updater(this.container, this.url, this.options); - } -}); - - -function $(element) { - if (arguments.length > 1) { - for (var i = 0, elements = [], length = arguments.length; i < length; i++) - elements.push($(arguments[i])); - return elements; - } - if (Object.isString(element)) - element = document.getElementById(element); - return Element.extend(element); -} - -if (Prototype.BrowserFeatures.XPath) { - document._getElementsByXPath = function(expression, parentElement) { - var results = []; - var query = document.evaluate(expression, $(parentElement) || document, - null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); - for (var i = 0, length = query.snapshotLength; i < length; i++) - results.push(Element.extend(query.snapshotItem(i))); - return results; - }; -} - -/*--------------------------------------------------------------------------*/ - -if (!Node) var Node = { }; - -if (!Node.ELEMENT_NODE) { - Object.extend(Node, { - ELEMENT_NODE: 1, - ATTRIBUTE_NODE: 2, - TEXT_NODE: 3, - CDATA_SECTION_NODE: 4, - ENTITY_REFERENCE_NODE: 5, - ENTITY_NODE: 6, - PROCESSING_INSTRUCTION_NODE: 7, - COMMENT_NODE: 8, - DOCUMENT_NODE: 9, - DOCUMENT_TYPE_NODE: 10, - DOCUMENT_FRAGMENT_NODE: 11, - NOTATION_NODE: 12 - }); -} - - - -(function(global) { - - var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){ - try { - var el = document.createElement(''); - return el.tagName.toLowerCase() === 'input' && el.name === 'x'; - } - catch(err) { - return false; - } - })(); - - var element = global.Element; - - global.Element = function(tagName, attributes) { - attributes = attributes || { }; - tagName = tagName.toLowerCase(); - var cache = Element.cache; - if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) { - tagName = '<' + tagName + ' name="' + attributes.name + '">'; - delete attributes.name; - return Element.writeAttribute(document.createElement(tagName), attributes); - } - if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); - return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); - }; - - Object.extend(global.Element, element || { }); - if (element) global.Element.prototype = element.prototype; - -})(this); - -Element.idCounter = 1; -Element.cache = { }; - -function purgeElement(element) { - var uid = element._prototypeUID; - if (uid) { - Element.stopObserving(element); - element._prototypeUID = void 0; - delete Element.Storage[uid]; - } -} - -Element.Methods = { - visible: function(element) { - return $(element).style.display != 'none'; - }, - - toggle: function(element) { - element = $(element); - Element[Element.visible(element) ? 'hide' : 'show'](element); - return element; - }, - - hide: function(element) { - element = $(element); - element.style.display = 'none'; - return element; - }, - - show: function(element) { - element = $(element); - element.style.display = ''; - return element; - }, - - remove: function(element) { - element = $(element); - element.parentNode.removeChild(element); - return element; - }, - - update: (function(){ - - var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){ - var el = document.createElement("select"), - isBuggy = true; - el.innerHTML = ""; - if (el.options && el.options[0]) { - isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION"; - } - el = null; - return isBuggy; - })(); - - var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){ - try { - var el = document.createElement("table"); - if (el && el.tBodies) { - el.innerHTML = "test"; - var isBuggy = typeof el.tBodies[0] == "undefined"; - el = null; - return isBuggy; - } - } catch (e) { - return true; - } - })(); - - var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () { - var s = document.createElement("script"), - isBuggy = false; - try { - s.appendChild(document.createTextNode("")); - isBuggy = !s.firstChild || - s.firstChild && s.firstChild.nodeType !== 3; - } catch (e) { - isBuggy = true; - } - s = null; - return isBuggy; - })(); - - function update(element, content) { - element = $(element); - - var descendants = element.getElementsByTagName('*'), - i = descendants.length; - while (i--) purgeElement(descendants[i]); - - if (content && content.toElement) - content = content.toElement(); - - if (Object.isElement(content)) - return element.update().insert(content); - - content = Object.toHTML(content); - - var tagName = element.tagName.toUpperCase(); - - if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) { - element.text = content; - return element; - } - - if (SELECT_ELEMENT_INNERHTML_BUGGY || TABLE_ELEMENT_INNERHTML_BUGGY) { - if (tagName in Element._insertionTranslations.tags) { - while (element.firstChild) { - element.removeChild(element.firstChild); - } - Element._getContentFromAnonymousElement(tagName, content.stripScripts()) - .each(function(node) { - element.appendChild(node) - }); - } - else { - element.innerHTML = content.stripScripts(); - } - } - else { - element.innerHTML = content.stripScripts(); - } - - content.evalScripts.bind(content).defer(); - return element; - } - - return update; - })(), - - replace: function(element, content) { - element = $(element); - if (content && content.toElement) content = content.toElement(); - else if (!Object.isElement(content)) { - content = Object.toHTML(content); - var range = element.ownerDocument.createRange(); - range.selectNode(element); - content.evalScripts.bind(content).defer(); - content = range.createContextualFragment(content.stripScripts()); - } - element.parentNode.replaceChild(content, element); - return element; - }, - - insert: function(element, insertions) { - element = $(element); - - if (Object.isString(insertions) || Object.isNumber(insertions) || - Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) - insertions = {bottom:insertions}; - - var content, insert, tagName, childNodes; - - for (var position in insertions) { - content = insertions[position]; - position = position.toLowerCase(); - insert = Element._insertionTranslations[position]; - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) { - insert(element, content); - continue; - } - - content = Object.toHTML(content); - - tagName = ((position == 'before' || position == 'after') - ? element.parentNode : element).tagName.toUpperCase(); - - childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); - - if (position == 'top' || position == 'after') childNodes.reverse(); - childNodes.each(insert.curry(element)); - - content.evalScripts.bind(content).defer(); - } - - return element; - }, - - wrap: function(element, wrapper, attributes) { - element = $(element); - if (Object.isElement(wrapper)) - $(wrapper).writeAttribute(attributes || { }); - else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); - else wrapper = new Element('div', wrapper); - if (element.parentNode) - element.parentNode.replaceChild(wrapper, element); - wrapper.appendChild(element); - return wrapper; - }, - - inspect: function(element) { - element = $(element); - var result = '<' + element.tagName.toLowerCase(); - $H({'id': 'id', 'className': 'class'}).each(function(pair) { - var property = pair.first(), - attribute = pair.last(), - value = (element[property] || '').toString(); - if (value) result += ' ' + attribute + '=' + value.inspect(true); - }); - return result + '>'; - }, - - recursivelyCollect: function(element, property, maximumLength) { - element = $(element); - maximumLength = maximumLength || -1; - var elements = []; - - while (element = element[property]) { - if (element.nodeType == 1) - elements.push(Element.extend(element)); - if (elements.length == maximumLength) - break; - } - - return elements; - }, - - ancestors: function(element) { - return Element.recursivelyCollect(element, 'parentNode'); - }, - - descendants: function(element) { - return Element.select(element, "*"); - }, - - firstDescendant: function(element) { - element = $(element).firstChild; - while (element && element.nodeType != 1) element = element.nextSibling; - return $(element); - }, - - immediateDescendants: function(element) { - var results = [], child = $(element).firstChild; - while (child) { - if (child.nodeType === 1) { - results.push(Element.extend(child)); - } - child = child.nextSibling; - } - return results; - }, - - previousSiblings: function(element, maximumLength) { - return Element.recursivelyCollect(element, 'previousSibling'); - }, - - nextSiblings: function(element) { - return Element.recursivelyCollect(element, 'nextSibling'); - }, - - siblings: function(element) { - element = $(element); - return Element.previousSiblings(element).reverse() - .concat(Element.nextSiblings(element)); - }, - - match: function(element, selector) { - element = $(element); - if (Object.isString(selector)) - return Prototype.Selector.match(element, selector); - return selector.match(element); - }, - - up: function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return $(element.parentNode); - var ancestors = Element.ancestors(element); - return Object.isNumber(expression) ? ancestors[expression] : - Prototype.Selector.find(ancestors, expression, index); - }, - - down: function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return Element.firstDescendant(element); - return Object.isNumber(expression) ? Element.descendants(element)[expression] : - Element.select(element, expression)[index || 0]; - }, - - previous: function(element, expression, index) { - element = $(element); - if (Object.isNumber(expression)) index = expression, expression = false; - if (!Object.isNumber(index)) index = 0; - - if (expression) { - return Prototype.Selector.find(element.previousSiblings(), expression, index); - } else { - return element.recursivelyCollect("previousSibling", index + 1)[index]; - } - }, - - next: function(element, expression, index) { - element = $(element); - if (Object.isNumber(expression)) index = expression, expression = false; - if (!Object.isNumber(index)) index = 0; - - if (expression) { - return Prototype.Selector.find(element.nextSiblings(), expression, index); - } else { - var maximumLength = Object.isNumber(index) ? index + 1 : 1; - return element.recursivelyCollect("nextSibling", index + 1)[index]; - } - }, - - - select: function(element) { - element = $(element); - var expressions = Array.prototype.slice.call(arguments, 1).join(', '); - return Prototype.Selector.select(expressions, element); - }, - - adjacent: function(element) { - element = $(element); - var expressions = Array.prototype.slice.call(arguments, 1).join(', '); - return Prototype.Selector.select(expressions, element.parentNode).without(element); - }, - - identify: function(element) { - element = $(element); - var id = Element.readAttribute(element, 'id'); - if (id) return id; - do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id)); - Element.writeAttribute(element, 'id', id); - return id; - }, - - readAttribute: function(element, name) { - element = $(element); - if (Prototype.Browser.IE) { - var t = Element._attributeTranslations.read; - if (t.values[name]) return t.values[name](element, name); - if (t.names[name]) name = t.names[name]; - if (name.include(':')) { - return (!element.attributes || !element.attributes[name]) ? null : - element.attributes[name].value; - } - } - return element.getAttribute(name); - }, - - writeAttribute: function(element, name, value) { - element = $(element); - var attributes = { }, t = Element._attributeTranslations.write; - - if (typeof name == 'object') attributes = name; - else attributes[name] = Object.isUndefined(value) ? true : value; - - for (var attr in attributes) { - name = t.names[attr] || attr; - value = attributes[attr]; - if (t.values[attr]) name = t.values[attr](element, value); - if (value === false || value === null) - element.removeAttribute(name); - else if (value === true) - element.setAttribute(name, name); - else element.setAttribute(name, value); - } - return element; - }, - - getHeight: function(element) { - return Element.getDimensions(element).height; - }, - - getWidth: function(element) { - return Element.getDimensions(element).width; - }, - - classNames: function(element) { - return new Element.ClassNames(element); - }, - - hasClassName: function(element, className) { - if (!(element = $(element))) return; - var elementClassName = element.className; - return (elementClassName.length > 0 && (elementClassName == className || - new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); - }, - - addClassName: function(element, className) { - if (!(element = $(element))) return; - if (!Element.hasClassName(element, className)) - element.className += (element.className ? ' ' : '') + className; - return element; - }, - - removeClassName: function(element, className) { - if (!(element = $(element))) return; - element.className = element.className.replace( - new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); - return element; - }, - - toggleClassName: function(element, className) { - if (!(element = $(element))) return; - return Element[Element.hasClassName(element, className) ? - 'removeClassName' : 'addClassName'](element, className); - }, - - cleanWhitespace: function(element) { - element = $(element); - var node = element.firstChild; - while (node) { - var nextNode = node.nextSibling; - if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) - element.removeChild(node); - node = nextNode; - } - return element; - }, - - empty: function(element) { - return $(element).innerHTML.blank(); - }, - - descendantOf: function(element, ancestor) { - element = $(element), ancestor = $(ancestor); - - if (element.compareDocumentPosition) - return (element.compareDocumentPosition(ancestor) & 8) === 8; - - if (ancestor.contains) - return ancestor.contains(element) && ancestor !== element; - - while (element = element.parentNode) - if (element == ancestor) return true; - - return false; - }, - - scrollTo: function(element) { - element = $(element); - var pos = Element.cumulativeOffset(element); - window.scrollTo(pos[0], pos[1]); - return element; - }, - - getStyle: function(element, style) { - element = $(element); - style = style == 'float' ? 'cssFloat' : style.camelize(); - var value = element.style[style]; - if (!value || value == 'auto') { - var css = document.defaultView.getComputedStyle(element, null); - value = css ? css[style] : null; - } - if (style == 'opacity') return value ? parseFloat(value) : 1.0; - return value == 'auto' ? null : value; - }, - - getOpacity: function(element) { - return $(element).getStyle('opacity'); - }, - - setStyle: function(element, styles) { - element = $(element); - var elementStyle = element.style, match; - if (Object.isString(styles)) { - element.style.cssText += ';' + styles; - return styles.include('opacity') ? - element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; - } - for (var property in styles) - if (property == 'opacity') element.setOpacity(styles[property]); - else - elementStyle[(property == 'float' || property == 'cssFloat') ? - (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : - property] = styles[property]; - - return element; - }, - - setOpacity: function(element, value) { - element = $(element); - element.style.opacity = (value == 1 || value === '') ? '' : - (value < 0.00001) ? 0 : value; - return element; - }, - - makePositioned: function(element) { - element = $(element); - var pos = Element.getStyle(element, 'position'); - if (pos == 'static' || !pos) { - element._madePositioned = true; - element.style.position = 'relative'; - if (Prototype.Browser.Opera) { - element.style.top = 0; - element.style.left = 0; - } - } - return element; - }, - - undoPositioned: function(element) { - element = $(element); - if (element._madePositioned) { - element._madePositioned = undefined; - element.style.position = - element.style.top = - element.style.left = - element.style.bottom = - element.style.right = ''; - } - return element; - }, - - makeClipping: function(element) { - element = $(element); - if (element._overflow) return element; - element._overflow = Element.getStyle(element, 'overflow') || 'auto'; - if (element._overflow !== 'hidden') - element.style.overflow = 'hidden'; - return element; - }, - - undoClipping: function(element) { - element = $(element); - if (!element._overflow) return element; - element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; - element._overflow = null; - return element; - }, - - cumulativeOffset: function(element) { - var valueT = 0, valueL = 0; - if (element.parentNode) { - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - } - return Element._returnOffset(valueL, valueT); - }, - - positionedOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - if (element.tagName.toUpperCase() == 'BODY') break; - var p = Element.getStyle(element, 'position'); - if (p !== 'static') break; - } - } while (element); - return Element._returnOffset(valueL, valueT); - }, - - absolutize: function(element) { - element = $(element); - if (Element.getStyle(element, 'position') == 'absolute') return element; - - var offsets = Element.positionedOffset(element), - top = offsets[1], - left = offsets[0], - width = element.clientWidth, - height = element.clientHeight; - - element._originalLeft = left - parseFloat(element.style.left || 0); - element._originalTop = top - parseFloat(element.style.top || 0); - element._originalWidth = element.style.width; - element._originalHeight = element.style.height; - - element.style.position = 'absolute'; - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.width = width + 'px'; - element.style.height = height + 'px'; - return element; - }, - - relativize: function(element) { - element = $(element); - if (Element.getStyle(element, 'position') == 'relative') return element; - - element.style.position = 'relative'; - var top = parseFloat(element.style.top || 0) - (element._originalTop || 0), - left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); - - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.height = element._originalHeight; - element.style.width = element._originalWidth; - return element; - }, - - cumulativeScrollOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return Element._returnOffset(valueL, valueT); - }, - - getOffsetParent: function(element) { - if (element.offsetParent) return $(element.offsetParent); - if (element == document.body) return $(element); - - while ((element = element.parentNode) && element != document.body) - if (Element.getStyle(element, 'position') != 'static') - return $(element); - - return $(document.body); - }, - - viewportOffset: function(forElement) { - var valueT = 0, - valueL = 0, - element = forElement; - - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - - if (element.offsetParent == document.body && - Element.getStyle(element, 'position') == 'absolute') break; - - } while (element = element.offsetParent); - - element = forElement; - do { - if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } - } while (element = element.parentNode); - - return Element._returnOffset(valueL, valueT); - }, - - clonePosition: function(element, source) { - var options = Object.extend({ - setLeft: true, - setTop: true, - setWidth: true, - setHeight: true, - offsetTop: 0, - offsetLeft: 0 - }, arguments[2] || { }); - - source = $(source); - var p = Element.viewportOffset(source), delta = [0, 0], parent = null; - - element = $(element); - - if (Element.getStyle(element, 'position') == 'absolute') { - parent = Element.getOffsetParent(element); - delta = Element.viewportOffset(parent); - } - - if (parent == document.body) { - delta[0] -= document.body.offsetLeft; - delta[1] -= document.body.offsetTop; - } - - if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; - if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; - if (options.setWidth) element.style.width = source.offsetWidth + 'px'; - if (options.setHeight) element.style.height = source.offsetHeight + 'px'; - return element; - } -}; - -Object.extend(Element.Methods, { - getElementsBySelector: Element.Methods.select, - - childElements: Element.Methods.immediateDescendants -}); - -Element._attributeTranslations = { - write: { - names: { - className: 'class', - htmlFor: 'for' - }, - values: { } - } -}; - -if (Prototype.Browser.Opera) { - Element.Methods.getStyle = Element.Methods.getStyle.wrap( - function(proceed, element, style) { - switch (style) { - case 'left': case 'top': case 'right': case 'bottom': - if (proceed(element, 'position') === 'static') return null; - case 'height': case 'width': - if (!Element.visible(element)) return null; - - var dim = parseInt(proceed(element, style), 10); - - if (dim !== element['offset' + style.capitalize()]) - return dim + 'px'; - - var properties; - if (style === 'height') { - properties = ['border-top-width', 'padding-top', - 'padding-bottom', 'border-bottom-width']; - } - else { - properties = ['border-left-width', 'padding-left', - 'padding-right', 'border-right-width']; - } - return properties.inject(dim, function(memo, property) { - var val = proceed(element, property); - return val === null ? memo : memo - parseInt(val, 10); - }) + 'px'; - default: return proceed(element, style); - } - } - ); - - Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( - function(proceed, element, attribute) { - if (attribute === 'title') return element.title; - return proceed(element, attribute); - } - ); -} - -else if (Prototype.Browser.IE) { - Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( - function(proceed, element) { - element = $(element); - if (!element.parentNode) return $(document.body); - var position = element.getStyle('position'); - if (position !== 'static') return proceed(element); - element.setStyle({ position: 'relative' }); - var value = proceed(element); - element.setStyle({ position: position }); - return value; - } - ); - - $w('positionedOffset viewportOffset').each(function(method) { - Element.Methods[method] = Element.Methods[method].wrap( - function(proceed, element) { - element = $(element); - if (!element.parentNode) return Element._returnOffset(0, 0); - var position = element.getStyle('position'); - if (position !== 'static') return proceed(element); - var offsetParent = element.getOffsetParent(); - if (offsetParent && offsetParent.getStyle('position') === 'fixed') - offsetParent.setStyle({ zoom: 1 }); - element.setStyle({ position: 'relative' }); - var value = proceed(element); - element.setStyle({ position: position }); - return value; - } - ); - }); - - Element.Methods.getStyle = function(element, style) { - element = $(element); - style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); - var value = element.style[style]; - if (!value && element.currentStyle) value = element.currentStyle[style]; - - if (style == 'opacity') { - if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) - if (value[1]) return parseFloat(value[1]) / 100; - return 1.0; - } - - if (value == 'auto') { - if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) - return element['offset' + style.capitalize()] + 'px'; - return null; - } - return value; - }; - - Element.Methods.setOpacity = function(element, value) { - function stripAlpha(filter){ - return filter.replace(/alpha\([^\)]*\)/gi,''); - } - element = $(element); - var currentStyle = element.currentStyle; - if ((currentStyle && !currentStyle.hasLayout) || - (!currentStyle && element.style.zoom == 'normal')) - element.style.zoom = 1; - - var filter = element.getStyle('filter'), style = element.style; - if (value == 1 || value === '') { - (filter = stripAlpha(filter)) ? - style.filter = filter : style.removeAttribute('filter'); - return element; - } else if (value < 0.00001) value = 0; - style.filter = stripAlpha(filter) + - 'alpha(opacity=' + (value * 100) + ')'; - return element; - }; - - Element._attributeTranslations = (function(){ - - var classProp = 'className', - forProp = 'for', - el = document.createElement('div'); - - el.setAttribute(classProp, 'x'); - - if (el.className !== 'x') { - el.setAttribute('class', 'x'); - if (el.className === 'x') { - classProp = 'class'; - } - } - el = null; - - el = document.createElement('label'); - el.setAttribute(forProp, 'x'); - if (el.htmlFor !== 'x') { - el.setAttribute('htmlFor', 'x'); - if (el.htmlFor === 'x') { - forProp = 'htmlFor'; - } - } - el = null; - - return { - read: { - names: { - 'class': classProp, - 'className': classProp, - 'for': forProp, - 'htmlFor': forProp - }, - values: { - _getAttr: function(element, attribute) { - return element.getAttribute(attribute); - }, - _getAttr2: function(element, attribute) { - return element.getAttribute(attribute, 2); - }, - _getAttrNode: function(element, attribute) { - var node = element.getAttributeNode(attribute); - return node ? node.value : ""; - }, - _getEv: (function(){ - - var el = document.createElement('div'), f; - el.onclick = Prototype.emptyFunction; - var value = el.getAttribute('onclick'); - - if (String(value).indexOf('{') > -1) { - f = function(element, attribute) { - attribute = element.getAttribute(attribute); - if (!attribute) return null; - attribute = attribute.toString(); - attribute = attribute.split('{')[1]; - attribute = attribute.split('}')[0]; - return attribute.strip(); - }; - } - else if (value === '') { - f = function(element, attribute) { - attribute = element.getAttribute(attribute); - if (!attribute) return null; - return attribute.strip(); - }; - } - el = null; - return f; - })(), - _flag: function(element, attribute) { - return $(element).hasAttribute(attribute) ? attribute : null; - }, - style: function(element) { - return element.style.cssText.toLowerCase(); - }, - title: function(element) { - return element.title; - } - } - } - } - })(); - - Element._attributeTranslations.write = { - names: Object.extend({ - cellpadding: 'cellPadding', - cellspacing: 'cellSpacing' - }, Element._attributeTranslations.read.names), - values: { - checked: function(element, value) { - element.checked = !!value; - }, - - style: function(element, value) { - element.style.cssText = value ? value : ''; - } - } - }; - - Element._attributeTranslations.has = {}; - - $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + - 'encType maxLength readOnly longDesc frameBorder').each(function(attr) { - Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; - Element._attributeTranslations.has[attr.toLowerCase()] = attr; - }); - - (function(v) { - Object.extend(v, { - href: v._getAttr2, - src: v._getAttr2, - type: v._getAttr, - action: v._getAttrNode, - disabled: v._flag, - checked: v._flag, - readonly: v._flag, - multiple: v._flag, - onload: v._getEv, - onunload: v._getEv, - onclick: v._getEv, - ondblclick: v._getEv, - onmousedown: v._getEv, - onmouseup: v._getEv, - onmouseover: v._getEv, - onmousemove: v._getEv, - onmouseout: v._getEv, - onfocus: v._getEv, - onblur: v._getEv, - onkeypress: v._getEv, - onkeydown: v._getEv, - onkeyup: v._getEv, - onsubmit: v._getEv, - onreset: v._getEv, - onselect: v._getEv, - onchange: v._getEv - }); - })(Element._attributeTranslations.read.values); - - if (Prototype.BrowserFeatures.ElementExtensions) { - (function() { - function _descendants(element) { - var nodes = element.getElementsByTagName('*'), results = []; - for (var i = 0, node; node = nodes[i]; i++) - if (node.tagName !== "!") // Filter out comment nodes. - results.push(node); - return results; - } - - Element.Methods.down = function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return element.firstDescendant(); - return Object.isNumber(expression) ? _descendants(element)[expression] : - Element.select(element, expression)[index || 0]; - } - })(); - } - -} - -else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { - Element.Methods.setOpacity = function(element, value) { - element = $(element); - element.style.opacity = (value == 1) ? 0.999999 : - (value === '') ? '' : (value < 0.00001) ? 0 : value; - return element; - }; -} - -else if (Prototype.Browser.WebKit) { - Element.Methods.setOpacity = function(element, value) { - element = $(element); - element.style.opacity = (value == 1 || value === '') ? '' : - (value < 0.00001) ? 0 : value; - - if (value == 1) - if (element.tagName.toUpperCase() == 'IMG' && element.width) { - element.width++; element.width--; - } else try { - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch (e) { } - - return element; - }; - - Element.Methods.cumulativeOffset = function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == document.body) - if (Element.getStyle(element, 'position') == 'absolute') break; - - element = element.offsetParent; - } while (element); - - return Element._returnOffset(valueL, valueT); - }; -} - -if ('outerHTML' in document.documentElement) { - Element.Methods.replace = function(element, content) { - element = $(element); - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) { - element.parentNode.replaceChild(content, element); - return element; - } - - content = Object.toHTML(content); - var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); - - if (Element._insertionTranslations.tags[tagName]) { - var nextSibling = element.next(), - fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); - parent.removeChild(element); - if (nextSibling) - fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); - else - fragments.each(function(node) { parent.appendChild(node) }); - } - else element.outerHTML = content.stripScripts(); - - content.evalScripts.bind(content).defer(); - return element; - }; -} - -Element._returnOffset = function(l, t) { - var result = [l, t]; - result.left = l; - result.top = t; - return result; -}; - -Element._getContentFromAnonymousElement = function(tagName, html) { - var div = new Element('div'), - t = Element._insertionTranslations.tags[tagName]; - if (t) { - div.innerHTML = t[0] + html + t[1]; - for (var i = t[2]; i--; ) { - div = div.firstChild; - } - } - else { - div.innerHTML = html; - } - return $A(div.childNodes); -}; - -Element._insertionTranslations = { - before: function(element, node) { - element.parentNode.insertBefore(node, element); - }, - top: function(element, node) { - element.insertBefore(node, element.firstChild); - }, - bottom: function(element, node) { - element.appendChild(node); - }, - after: function(element, node) { - element.parentNode.insertBefore(node, element.nextSibling); - }, - tags: { - TABLE: ['', '
    ', 1], - TBODY: ['', '
    ', 2], - TR: ['', '
    ', 3], - TD: ['
    ', '
    ', 4], - SELECT: ['', 1] - } -}; - -(function() { - var tags = Element._insertionTranslations.tags; - Object.extend(tags, { - THEAD: tags.TBODY, - TFOOT: tags.TBODY, - TH: tags.TD - }); -})(); - -Element.Methods.Simulated = { - hasAttribute: function(element, attribute) { - attribute = Element._attributeTranslations.has[attribute] || attribute; - var node = $(element).getAttributeNode(attribute); - return !!(node && node.specified); - } -}; - -Element.Methods.ByTag = { }; - -Object.extend(Element, Element.Methods); - -(function(div) { - - if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) { - window.HTMLElement = { }; - window.HTMLElement.prototype = div['__proto__']; - Prototype.BrowserFeatures.ElementExtensions = true; - } - - div = null; - -})(document.createElement('div')); - -Element.extend = (function() { - - function checkDeficiency(tagName) { - if (typeof window.Element != 'undefined') { - var proto = window.Element.prototype; - if (proto) { - var id = '_' + (Math.random()+'').slice(2), - el = document.createElement(tagName); - proto[id] = 'x'; - var isBuggy = (el[id] !== 'x'); - delete proto[id]; - el = null; - return isBuggy; - } - } - return false; - } - - function extendElementWith(element, methods) { - for (var property in methods) { - var value = methods[property]; - if (Object.isFunction(value) && !(property in element)) - element[property] = value.methodize(); - } - } - - var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object'); - - if (Prototype.BrowserFeatures.SpecificElementExtensions) { - if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) { - return function(element) { - if (element && typeof element._extendedByPrototype == 'undefined') { - var t = element.tagName; - if (t && (/^(?:object|applet|embed)$/i.test(t))) { - extendElementWith(element, Element.Methods); - extendElementWith(element, Element.Methods.Simulated); - extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]); - } - } - return element; - } - } - return Prototype.K; - } - - var Methods = { }, ByTag = Element.Methods.ByTag; - - var extend = Object.extend(function(element) { - if (!element || typeof element._extendedByPrototype != 'undefined' || - element.nodeType != 1 || element == window) return element; - - var methods = Object.clone(Methods), - tagName = element.tagName.toUpperCase(); - - if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); - - extendElementWith(element, methods); - - element._extendedByPrototype = Prototype.emptyFunction; - return element; - - }, { - refresh: function() { - if (!Prototype.BrowserFeatures.ElementExtensions) { - Object.extend(Methods, Element.Methods); - Object.extend(Methods, Element.Methods.Simulated); - } - } - }); - - extend.refresh(); - return extend; -})(); - -if (document.documentElement.hasAttribute) { - Element.hasAttribute = function(element, attribute) { - return element.hasAttribute(attribute); - }; -} -else { - Element.hasAttribute = Element.Methods.Simulated.hasAttribute; -} - -Element.addMethods = function(methods) { - var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; - - if (!methods) { - Object.extend(Form, Form.Methods); - Object.extend(Form.Element, Form.Element.Methods); - Object.extend(Element.Methods.ByTag, { - "FORM": Object.clone(Form.Methods), - "INPUT": Object.clone(Form.Element.Methods), - "SELECT": Object.clone(Form.Element.Methods), - "TEXTAREA": Object.clone(Form.Element.Methods) - }); - } - - if (arguments.length == 2) { - var tagName = methods; - methods = arguments[1]; - } - - if (!tagName) Object.extend(Element.Methods, methods || { }); - else { - if (Object.isArray(tagName)) tagName.each(extend); - else extend(tagName); - } - - function extend(tagName) { - tagName = tagName.toUpperCase(); - if (!Element.Methods.ByTag[tagName]) - Element.Methods.ByTag[tagName] = { }; - Object.extend(Element.Methods.ByTag[tagName], methods); - } - - function copy(methods, destination, onlyIfAbsent) { - onlyIfAbsent = onlyIfAbsent || false; - for (var property in methods) { - var value = methods[property]; - if (!Object.isFunction(value)) continue; - if (!onlyIfAbsent || !(property in destination)) - destination[property] = value.methodize(); - } - } - - function findDOMClass(tagName) { - var klass; - var trans = { - "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", - "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", - "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", - "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", - "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": - "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": - "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": - "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": - "FrameSet", "IFRAME": "IFrame" - }; - if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; - if (window[klass]) return window[klass]; - klass = 'HTML' + tagName + 'Element'; - if (window[klass]) return window[klass]; - klass = 'HTML' + tagName.capitalize() + 'Element'; - if (window[klass]) return window[klass]; - - var element = document.createElement(tagName), - proto = element['__proto__'] || element.constructor.prototype; - - element = null; - return proto; - } - - var elementPrototype = window.HTMLElement ? HTMLElement.prototype : - Element.prototype; - - if (F.ElementExtensions) { - copy(Element.Methods, elementPrototype); - copy(Element.Methods.Simulated, elementPrototype, true); - } - - if (F.SpecificElementExtensions) { - for (var tag in Element.Methods.ByTag) { - var klass = findDOMClass(tag); - if (Object.isUndefined(klass)) continue; - copy(T[tag], klass.prototype); - } - } - - Object.extend(Element, Element.Methods); - delete Element.ByTag; - - if (Element.extend.refresh) Element.extend.refresh(); - Element.cache = { }; -}; - - -document.viewport = { - - getDimensions: function() { - return { width: this.getWidth(), height: this.getHeight() }; - }, - - getScrollOffsets: function() { - return Element._returnOffset( - window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, - window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); - } -}; - -(function(viewport) { - var B = Prototype.Browser, doc = document, element, property = {}; - - function getRootElement() { - if (B.WebKit && !doc.evaluate) - return document; - - if (B.Opera && window.parseFloat(window.opera.version()) < 9.5) - return document.body; - - return document.documentElement; - } - - function define(D) { - if (!element) element = getRootElement(); - - property[D] = 'client' + D; - - viewport['get' + D] = function() { return element[property[D]] }; - return viewport['get' + D](); - } - - viewport.getWidth = define.curry('Width'); - - viewport.getHeight = define.curry('Height'); -})(document.viewport); - - -Element.Storage = { - UID: 1 -}; - -Element.addMethods({ - getStorage: function(element) { - if (!(element = $(element))) return; - - var uid; - if (element === window) { - uid = 0; - } else { - if (typeof element._prototypeUID === "undefined") - element._prototypeUID = Element.Storage.UID++; - uid = element._prototypeUID; - } - - if (!Element.Storage[uid]) - Element.Storage[uid] = $H(); - - return Element.Storage[uid]; - }, - - store: function(element, key, value) { - if (!(element = $(element))) return; - - if (arguments.length === 2) { - Element.getStorage(element).update(key); - } else { - Element.getStorage(element).set(key, value); - } - - return element; - }, - - retrieve: function(element, key, defaultValue) { - if (!(element = $(element))) return; - var hash = Element.getStorage(element), value = hash.get(key); - - if (Object.isUndefined(value)) { - hash.set(key, defaultValue); - value = defaultValue; - } - - return value; - }, - - clone: function(element, deep) { - if (!(element = $(element))) return; - var clone = element.cloneNode(deep); - clone._prototypeUID = void 0; - if (deep) { - var descendants = Element.select(clone, '*'), - i = descendants.length; - while (i--) { - descendants[i]._prototypeUID = void 0; - } - } - return Element.extend(clone); - }, - - purge: function(element) { - if (!(element = $(element))) return; - purgeElement(element); - - var descendants = element.getElementsByTagName('*'), - i = descendants.length; - - while (i--) purgeElement(descendants[i]); - - return null; - } -}); - -(function() { - - function toDecimal(pctString) { - var match = pctString.match(/^(\d+)%?$/i); - if (!match) return null; - return (Number(match[1]) / 100); - } - - function getPixelValue(value, property) { - if (Object.isElement(value)) { - element = value; - value = element.getStyle(property); - } - if (value === null) { - return null; - } - - if ((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)) { - return window.parseFloat(value); - } - - if (/\d/.test(value) && element.runtimeStyle) { - var style = element.style.left, rStyle = element.runtimeStyle.left; - element.runtimeStyle.left = element.currentStyle.left; - element.style.left = value || 0; - value = element.style.pixelLeft; - element.style.left = style; - element.runtimeStyle.left = rStyle; - - return value; - } - - if (value.include('%')) { - var decimal = toDecimal(value); - var whole; - if (property.include('left') || property.include('right') || - property.include('width')) { - whole = $(element.parentNode).measure('width'); - } else if (property.include('top') || property.include('bottom') || - property.include('height')) { - whole = $(element.parentNode).measure('height'); - } - - return whole * decimal; - } - - return 0; - } - - function toCSSPixels(number) { - if (Object.isString(number) && number.endsWith('px')) { - return number; - } - return number + 'px'; - } - - function isDisplayed(element) { - var originalElement = element; - while (element && element.parentNode) { - var display = element.getStyle('display'); - if (display === 'none') { - return false; - } - element = $(element.parentNode); - } - return true; - } - - var hasLayout = Prototype.K; - if ('currentStyle' in document.documentElement) { - hasLayout = function(element) { - if (!element.currentStyle.hasLayout) { - element.style.zoom = 1; - } - return element; - }; - } - - function cssNameFor(key) { - if (key.include('border')) key = key + '-width'; - return key.camelize(); - } - - Element.Layout = Class.create(Hash, { - initialize: function($super, element, preCompute) { - $super(); - this.element = $(element); - - Element.Layout.PROPERTIES.each( function(property) { - this._set(property, null); - }, this); - - if (preCompute) { - this._preComputing = true; - this._begin(); - Element.Layout.PROPERTIES.each( this._compute, this ); - this._end(); - this._preComputing = false; - } - }, - - _set: function(property, value) { - return Hash.prototype.set.call(this, property, value); - }, - - set: function(property, value) { - throw "Properties of Element.Layout are read-only."; - }, - - get: function($super, property) { - var value = $super(property); - return value === null ? this._compute(property) : value; - }, - - _begin: function() { - if (this._prepared) return; - - var element = this.element; - if (isDisplayed(element)) { - this._prepared = true; - return; - } - - var originalStyles = { - position: element.style.position || '', - width: element.style.width || '', - visibility: element.style.visibility || '', - display: element.style.display || '' - }; - - element.store('prototype_original_styles', originalStyles); - - var position = element.getStyle('position'), - width = element.getStyle('width'); - - element.setStyle({ - position: 'absolute', - visibility: 'hidden', - display: 'block' - }); - - var positionedWidth = element.getStyle('width'); - - var newWidth; - if (width && (positionedWidth === width)) { - newWidth = getPixelValue(width); - } else if (width && (position === 'absolute' || position === 'fixed')) { - newWidth = getPixelValue(width); - } else { - var parent = element.parentNode, pLayout = $(parent).getLayout(); - - newWidth = pLayout.get('width') - - this.get('margin-left') - - this.get('border-left') - - this.get('padding-left') - - this.get('padding-right') - - this.get('border-right') - - this.get('margin-right'); - } - - element.setStyle({ width: newWidth + 'px' }); - - this._prepared = true; - }, - - _end: function() { - var element = this.element; - var originalStyles = element.retrieve('prototype_original_styles'); - element.store('prototype_original_styles', null); - element.setStyle(originalStyles); - this._prepared = false; - }, - - _compute: function(property) { - var COMPUTATIONS = Element.Layout.COMPUTATIONS; - if (!(property in COMPUTATIONS)) { - throw "Property not found."; - } - return this._set(property, COMPUTATIONS[property].call(this, this.element)); - }, - - toObject: function() { - var args = $A(arguments); - var keys = (args.length === 0) ? Element.Layout.PROPERTIES : - args.join(' ').split(' '); - var obj = {}; - keys.each( function(key) { - if (!Element.Layout.PROPERTIES.include(key)) return; - var value = this.get(key); - if (value != null) obj[key] = value; - }, this); - return obj; - }, - - toHash: function() { - var obj = this.toObject.apply(this, arguments); - return new Hash(obj); - }, - - toCSS: function() { - var args = $A(arguments); - var keys = (args.length === 0) ? Element.Layout.PROPERTIES : - args.join(' ').split(' '); - var css = {}; - - keys.each( function(key) { - if (!Element.Layout.PROPERTIES.include(key)) return; - if (Element.Layout.COMPOSITE_PROPERTIES.include(key)) return; - - var value = this.get(key); - if (value != null) css[cssNameFor(key)] = value + 'px'; - }, this); - return css; - }, - - inspect: function() { - return "#"; - } - }); - - Object.extend(Element.Layout, { - PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'), - - COMPOSITE_PROPERTIES: $w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'), - - COMPUTATIONS: { - 'height': function(element) { - if (!this._preComputing) this._begin(); - - var bHeight = this.get('border-box-height'); - if (bHeight <= 0) return 0; - - var bTop = this.get('border-top'), - bBottom = this.get('border-bottom'); - - var pTop = this.get('padding-top'), - pBottom = this.get('padding-bottom'); - - if (!this._preComputing) this._end(); - - return bHeight - bTop - bBottom - pTop - pBottom; - }, - - 'width': function(element) { - if (!this._preComputing) this._begin(); - - var bWidth = this.get('border-box-width'); - if (bWidth <= 0) return 0; - - var bLeft = this.get('border-left'), - bRight = this.get('border-right'); - - var pLeft = this.get('padding-left'), - pRight = this.get('padding-right'); - - if (!this._preComputing) this._end(); - - return bWidth - bLeft - bRight - pLeft - pRight; - }, - - 'padding-box-height': function(element) { - var height = this.get('height'), - pTop = this.get('padding-top'), - pBottom = this.get('padding-bottom'); - - return height + pTop + pBottom; - }, - - 'padding-box-width': function(element) { - var width = this.get('width'), - pLeft = this.get('padding-left'), - pRight = this.get('padding-right'); - - return width + pLeft + pRight; - }, - - 'border-box-height': function(element) { - return element.offsetHeight; - }, - - 'border-box-width': function(element) { - return element.offsetWidth; - }, - - 'margin-box-height': function(element) { - var bHeight = this.get('border-box-height'), - mTop = this.get('margin-top'), - mBottom = this.get('margin-bottom'); - - if (bHeight <= 0) return 0; - - return bHeight + mTop + mBottom; - }, - - 'margin-box-width': function(element) { - var bWidth = this.get('border-box-width'), - mLeft = this.get('margin-left'), - mRight = this.get('margin-right'); - - if (bWidth <= 0) return 0; - - return bWidth + mLeft + mRight; - }, - - 'top': function(element) { - var offset = element.positionedOffset(); - return offset.top; - }, - - 'bottom': function(element) { - var offset = element.positionedOffset(), - parent = element.getOffsetParent(), - pHeight = parent.measure('height'); - - var mHeight = this.get('border-box-height'); - - return pHeight - mHeight - offset.top; - }, - - 'left': function(element) { - var offset = element.positionedOffset(); - return offset.left; - }, - - 'right': function(element) { - var offset = element.positionedOffset(), - parent = element.getOffsetParent(), - pWidth = parent.measure('width'); - - var mWidth = this.get('border-box-width'); - - return pWidth - mWidth - offset.left; - }, - - 'padding-top': function(element) { - return getPixelValue(element, 'paddingTop'); - }, - - 'padding-bottom': function(element) { - return getPixelValue(element, 'paddingBottom'); - }, - - 'padding-left': function(element) { - return getPixelValue(element, 'paddingLeft'); - }, - - 'padding-right': function(element) { - return getPixelValue(element, 'paddingRight'); - }, - - 'border-top': function(element) { - return Object.isNumber(element.clientTop) ? element.clientTop : - getPixelValue(element, 'borderTopWidth'); - }, - - 'border-bottom': function(element) { - return Object.isNumber(element.clientBottom) ? element.clientBottom : - getPixelValue(element, 'borderBottomWidth'); - }, - - 'border-left': function(element) { - return Object.isNumber(element.clientLeft) ? element.clientLeft : - getPixelValue(element, 'borderLeftWidth'); - }, - - 'border-right': function(element) { - return Object.isNumber(element.clientRight) ? element.clientRight : - getPixelValue(element, 'borderRightWidth'); - }, - - 'margin-top': function(element) { - return getPixelValue(element, 'marginTop'); - }, - - 'margin-bottom': function(element) { - return getPixelValue(element, 'marginBottom'); - }, - - 'margin-left': function(element) { - return getPixelValue(element, 'marginLeft'); - }, - - 'margin-right': function(element) { - return getPixelValue(element, 'marginRight'); - } - } - }); - - if ('getBoundingClientRect' in document.documentElement) { - Object.extend(Element.Layout.COMPUTATIONS, { - 'right': function(element) { - var parent = hasLayout(element.getOffsetParent()); - var rect = element.getBoundingClientRect(), - pRect = parent.getBoundingClientRect(); - - return (pRect.right - rect.right).round(); - }, - - 'bottom': function(element) { - var parent = hasLayout(element.getOffsetParent()); - var rect = element.getBoundingClientRect(), - pRect = parent.getBoundingClientRect(); - - return (pRect.bottom - rect.bottom).round(); - } - }); - } - - Element.Offset = Class.create({ - initialize: function(left, top) { - this.left = left.round(); - this.top = top.round(); - - this[0] = this.left; - this[1] = this.top; - }, - - relativeTo: function(offset) { - return new Element.Offset( - this.left - offset.left, - this.top - offset.top - ); - }, - - inspect: function() { - return "#".interpolate(this); - }, - - toString: function() { - return "[#{left}, #{top}]".interpolate(this); - }, - - toArray: function() { - return [this.left, this.top]; - } - }); - - function getLayout(element, preCompute) { - return new Element.Layout(element, preCompute); - } - - function measure(element, property) { - return $(element).getLayout().get(property); - } - - function getDimensions(element) { - var layout = $(element).getLayout(); - return { - width: layout.get('width'), - height: layout.get('height') - }; - } - - function getOffsetParent(element) { - if (isDetached(element)) return $(document.body); - - var isInline = (Element.getStyle(element, 'display') === 'inline'); - if (!isInline && element.offsetParent) return $(element.offsetParent); - if (element === document.body) return $(element); - - while ((element = element.parentNode) && element !== document.body) { - if (Element.getStyle(element, 'position') !== 'static') { - return (element.nodeName === 'HTML') ? $(document.body) : $(element); - } - } - - return $(document.body); - } - - - function cumulativeOffset(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - return new Element.Offset(valueL, valueT); - } - - function positionedOffset(element) { - var layout = element.getLayout(); - - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - if (isBody(element)) break; - var p = Element.getStyle(element, 'position'); - if (p !== 'static') break; - } - } while (element); - - valueL -= layout.get('margin-top'); - valueT -= layout.get('margin-left'); - - return new Element.Offset(valueL, valueT); - } - - function cumulativeScrollOffset(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return new Element.Offset(valueL, valueT); - } - - function viewportOffset(forElement) { - var valueT = 0, valueL = 0, docBody = document.body; - - var element = forElement; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == docBody && - Element.getStyle(element, 'position') == 'absolute') break; - } while (element = element.offsetParent); - - element = forElement; - do { - if (element != docBody) { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } - } while (element = element.parentNode); - return new Element.Offset(valueL, valueT); - } - - function absolutize(element) { - element = $(element); - - if (Element.getStyle(element, 'position') === 'absolute') { - return element; - } - - var offsetParent = getOffsetParent(element); - var eOffset = element.viewportOffset(), - pOffset = offsetParent.viewportOffset(); - - var offset = eOffset.relativeTo(pOffset); - var layout = element.getLayout(); - - element.store('prototype_absolutize_original_styles', { - left: element.getStyle('left'), - top: element.getStyle('top'), - width: element.getStyle('width'), - height: element.getStyle('height') - }); - - element.setStyle({ - position: 'absolute', - top: offset.top + 'px', - left: offset.left + 'px', - width: layout.get('width') + 'px', - height: layout.get('height') + 'px' - }); - - return element; - } - - function relativize(element) { - element = $(element); - if (Element.getStyle(element, 'position') === 'relative') { - return element; - } - - var originalStyles = - element.retrieve('prototype_absolutize_original_styles'); - - if (originalStyles) element.setStyle(originalStyles); - return element; - } - - Element.addMethods({ - getLayout: getLayout, - measure: measure, - getDimensions: getDimensions, - getOffsetParent: getOffsetParent, - cumulativeOffset: cumulativeOffset, - positionedOffset: positionedOffset, - cumulativeScrollOffset: cumulativeScrollOffset, - viewportOffset: viewportOffset, - absolutize: absolutize, - relativize: relativize - }); - - function isBody(element) { - return element.nodeName.toUpperCase() === 'BODY'; - } - - function isDetached(element) { - return element !== document.body && - !Element.descendantOf(element, document.body); - } - - if ('getBoundingClientRect' in document.documentElement) { - Element.addMethods({ - viewportOffset: function(element) { - element = $(element); - if (isDetached(element)) return new Element.Offset(0, 0); - - var rect = element.getBoundingClientRect(), - docEl = document.documentElement; - return new Element.Offset(rect.left - docEl.clientLeft, - rect.top - docEl.clientTop); - }, - - positionedOffset: function(element) { - element = $(element); - var parent = element.getOffsetParent(); - if (isDetached(element)) return new Element.Offset(0, 0); - - if (element.offsetParent && - element.offsetParent.nodeName.toUpperCase() === 'HTML') { - return positionedOffset(element); - } - - var eOffset = element.viewportOffset(), - pOffset = isBody(parent) ? viewportOffset(parent) : - parent.viewportOffset(); - var retOffset = eOffset.relativeTo(pOffset); - - var layout = element.getLayout(); - var top = retOffset.top - layout.get('margin-top'); - var left = retOffset.left - layout.get('margin-left'); - - return new Element.Offset(left, top); - } - }); - } -})(); -window.$$ = function() { - var expression = $A(arguments).join(', '); - return Prototype.Selector.select(expression, document); -}; - -Prototype.Selector = (function() { - - function select() { - throw new Error('Method "Prototype.Selector.select" must be defined.'); - } - - function match() { - throw new Error('Method "Prototype.Selector.match" must be defined.'); - } - - function find(elements, expression, index) { - index = index || 0; - var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i; - - for (i = 0; i < length; i++) { - if (match(elements[i], expression) && index == matchIndex++) { - return Element.extend(elements[i]); - } - } - } - - function extendElements(elements) { - for (var i = 0, length = elements.length; i < length; i++) { - Element.extend(elements[i]); - } - return elements; - } - - - var K = Prototype.K; - - return { - select: select, - match: match, - find: find, - extendElements: (Element.extend === K) ? K : extendElements, - extendElement: Element.extend - }; -})(); -Prototype._original_property = window.Sizzle; -/*! - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true; - -[0, 0].sort(function(){ - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function(selector, context, results, seed) { - results = results || []; - var origContext = context = context || document; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context), - soFar = selector; - - while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) - selector += parts.shift(); - - set = posProcess( selector, set ); - } - } - } else { - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - var ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; - } - - if ( context ) { - var ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray(set); - } else { - prune = false; - } - - while ( parts.length ) { - var cur = parts.pop(), pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - throw "Syntax error, unrecognized expression: " + (cur || selector); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - } else if ( context && context.nodeType === 1 ) { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - } else { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function(results){ - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort(sortOrder); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[i-1] ) { - results.splice(i--, 1); - } - } - } - } - - return results; -}; - -Sizzle.matches = function(expr, set){ - return Sizzle(expr, null, null, set); -}; - -Sizzle.find = function(expr, context, isXML){ - var set, match; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var type = Expr.order[i], match; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice(1,1); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace(/\\/g, ""); - set = Expr.find[ type ]( match, context, isXML ); - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = context.getElementsByTagName("*"); - } - - return {set: set, expr: expr}; -}; - -Sizzle.filter = function(expr, set, inplace, not){ - var old = expr, result = [], curLoop = set, match, anyFound, - isXMLFilter = set && set[0] && isXML(set[0]); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.match[ type ].exec( expr )) != null ) { - var filter = Expr.filter[ type ], found, item; - anyFound = false; - - if ( curLoop == result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - } else { - curLoop[i] = false; - } - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - if ( expr == old ) { - if ( anyFound == null ) { - throw "Syntax error, unrecognized expression: " + expr; - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - match: { - ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ - }, - leftMatch: {}, - attrMap: { - "class": "className", - "for": "htmlFor" - }, - attrHandle: { - href: function(elem){ - return elem.getAttribute("href"); - } - }, - relative: { - "+": function(checkSet, part, isXML){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !/\W/.test(part), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag && !isXML ) { - part = part.toUpperCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - ">": function(checkSet, part, isXML){ - var isPartStr = typeof part === "string"; - - if ( isPartStr && !/\W/.test(part) ) { - part = isXML ? part : part.toUpperCase(); - - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName === part ? parent : false; - } - } - } else { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - "": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( !/\W/.test(part) ) { - var nodeCheck = part = isXML ? part : part.toUpperCase(); - checkFn = dirNodeCheck; - } - - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); - }, - "~": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = isXML ? part : part.toUpperCase(); - checkFn = dirNodeCheck; - } - - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); - } - }, - find: { - ID: function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? [m] : []; - } - }, - NAME: function(match, context, isXML){ - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], results = context.getElementsByName(match[1]); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - TAG: function(match, context){ - return context.getElementsByTagName(match[1]); - } - }, - preFilter: { - CLASS: function(match, curLoop, inplace, result, not, isXML){ - match = " " + match[1].replace(/\\/g, "") + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { - if ( !inplace ) - result.push( elem ); - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - ID: function(match){ - return match[1].replace(/\\/g, ""); - }, - TAG: function(match, curLoop){ - for ( var i = 0; curLoop[i] === false; i++ ){} - return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); - }, - CHILD: function(match){ - if ( match[1] == "nth" ) { - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( - match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - - match[0] = done++; - - return match; - }, - ATTR: function(match, curLoop, inplace, result, not, isXML){ - var name = match[1].replace(/\\/g, ""); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - PSEUDO: function(match, curLoop, inplace, result, not){ - if ( match[1] === "not" ) { - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - if ( !inplace ) { - result.push.apply( result, ret ); - } - return false; - } - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - POS: function(match){ - match.unshift( true ); - return match; - } - }, - filters: { - enabled: function(elem){ - return elem.disabled === false && elem.type !== "hidden"; - }, - disabled: function(elem){ - return elem.disabled === true; - }, - checked: function(elem){ - return elem.checked === true; - }, - selected: function(elem){ - elem.parentNode.selectedIndex; - return elem.selected === true; - }, - parent: function(elem){ - return !!elem.firstChild; - }, - empty: function(elem){ - return !elem.firstChild; - }, - has: function(elem, i, match){ - return !!Sizzle( match[3], elem ).length; - }, - header: function(elem){ - return /h\d/i.test( elem.nodeName ); - }, - text: function(elem){ - return "text" === elem.type; - }, - radio: function(elem){ - return "radio" === elem.type; - }, - checkbox: function(elem){ - return "checkbox" === elem.type; - }, - file: function(elem){ - return "file" === elem.type; - }, - password: function(elem){ - return "password" === elem.type; - }, - submit: function(elem){ - return "submit" === elem.type; - }, - image: function(elem){ - return "image" === elem.type; - }, - reset: function(elem){ - return "reset" === elem.type; - }, - button: function(elem){ - return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; - }, - input: function(elem){ - return /input|select|textarea|button/i.test(elem.nodeName); - } - }, - setFilters: { - first: function(elem, i){ - return i === 0; - }, - last: function(elem, i, match, array){ - return i === array.length - 1; - }, - even: function(elem, i){ - return i % 2 === 0; - }, - odd: function(elem, i){ - return i % 2 === 1; - }, - lt: function(elem, i, match){ - return i < match[3] - 0; - }, - gt: function(elem, i, match){ - return i > match[3] - 0; - }, - nth: function(elem, i, match){ - return match[3] - 0 == i; - }, - eq: function(elem, i, match){ - return match[3] - 0 == i; - } - }, - filter: { - PSEUDO: function(elem, match, i, array){ - var name = match[1], filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; - } else if ( name === "not" ) { - var not = match[3]; - - for ( var i = 0, l = not.length; i < l; i++ ) { - if ( not[i] === elem ) { - return false; - } - } - - return true; - } - }, - CHILD: function(elem, match){ - var type = match[1], node = elem; - switch (type) { - case 'only': - case 'first': - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) return false; - } - if ( type == 'first') return true; - node = elem; - case 'last': - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) return false; - } - return true; - case 'nth': - var first = match[2], last = match[3]; - - if ( first == 1 && last == 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - if ( first == 0 ) { - return diff == 0; - } else { - return ( diff % first == 0 && diff / first >= 0 ); - } - } - }, - ID: function(elem, match){ - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - TAG: function(elem, match){ - return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; - }, - CLASS: function(elem, match){ - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - ATTR: function(elem, match){ - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value != check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - POS: function(elem, match, i, array){ - var name = match[2], filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source ); -} - -var makeArray = function(array, results) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 ); - -} catch(e){ - makeArray = function(array, results) { - var ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - } else { - if ( typeof array.length === "number" ) { - for ( var i = 0, l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - } else { - for ( var i = 0; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - if ( a == b ) { - hasDuplicate = true; - } - return 0; - } - - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( "sourceIndex" in document.documentElement ) { - sortOrder = function( a, b ) { - if ( !a.sourceIndex || !b.sourceIndex ) { - if ( a == b ) { - hasDuplicate = true; - } - return 0; - } - - var ret = a.sourceIndex - b.sourceIndex; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( document.createRange ) { - sortOrder = function( a, b ) { - if ( !a.ownerDocument || !b.ownerDocument ) { - if ( a == b ) { - hasDuplicate = true; - } - return 0; - } - - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} - -(function(){ - var form = document.createElement("div"), - id = "script" + (new Date).getTime(); - form.innerHTML = ""; - - var root = document.documentElement; - root.insertBefore( form, root.firstChild ); - - if ( !!document.getElementById( id ) ) { - Expr.find.ID = function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; - } - }; - - Expr.filter.ID = function(elem, match){ - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - root = form = null; // release memory in IE -})(); - -(function(){ - - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function(match, context){ - var results = context.getElementsByTagName(match[1]); - - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - div.innerHTML = ""; - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - Expr.attrHandle.href = function(elem){ - return elem.getAttribute("href", 2); - }; - } - - div = null; // release memory in IE -})(); - -if ( document.querySelectorAll ) (function(){ - var oldSizzle = Sizzle, div = document.createElement("div"); - div.innerHTML = "

    "; - - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function(query, context, extra, seed){ - context = context || document; - - if ( !seed && context.nodeType === 9 && !isXML(context) ) { - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(e){} - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - div = null; // release memory in IE -})(); - -if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ - var div = document.createElement("div"); - div.innerHTML = "
    "; - - if ( div.getElementsByClassName("e").length === 0 ) - return; - - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) - return; - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function(match, context, isXML) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - div = null; // release memory in IE -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - var sibDir = dir == "previousSibling" && !isXML; - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - if ( sibDir && elem.nodeType === 1 ){ - elem.sizcache = doneName; - elem.sizset = i; - } - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - var sibDir = dir == "previousSibling" && !isXML; - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - if ( sibDir && elem.nodeType === 1 ) { - elem.sizcache = doneName; - elem.sizset = i; - } - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -var contains = document.compareDocumentPosition ? function(a, b){ - return a.compareDocumentPosition(b) & 16; -} : function(a, b){ - return a !== b && (a.contains ? a.contains(b) : true); -}; - -var isXML = function(elem){ - return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || - !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; -}; - -var posProcess = function(selector, context){ - var tmpSet = [], later = "", match, - root = context.nodeType ? [context] : context; - - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - - -window.Sizzle = Sizzle; - -})(); - -;(function(engine) { - var extendElements = Prototype.Selector.extendElements; - - function select(selector, scope) { - return extendElements(engine(selector, scope || document)); - } - - function match(element, selector) { - return engine.matches(selector, [element]).length == 1; - } - - Prototype.Selector.engine = engine; - Prototype.Selector.select = select; - Prototype.Selector.match = match; -})(Sizzle); - -window.Sizzle = Prototype._original_property; -delete Prototype._original_property; - -var Form = { - reset: function(form) { - form = $(form); - form.reset(); - return form; - }, - - serializeElements: function(elements, options) { - if (typeof options != 'object') options = { hash: !!options }; - else if (Object.isUndefined(options.hash)) options.hash = true; - var key, value, submitted = false, submit = options.submit; - - var data = elements.inject({ }, function(result, element) { - if (!element.disabled && element.name) { - key = element.name; value = $(element).getValue(); - if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted && - submit !== false && (!submit || key == submit) && (submitted = true)))) { - if (key in result) { - if (!Object.isArray(result[key])) result[key] = [result[key]]; - result[key].push(value); - } - else result[key] = value; - } - } - return result; - }); - - return options.hash ? data : Object.toQueryString(data); - } -}; - -Form.Methods = { - serialize: function(form, options) { - return Form.serializeElements(Form.getElements(form), options); - }, - - getElements: function(form) { - var elements = $(form).getElementsByTagName('*'), - element, - arr = [ ], - serializers = Form.Element.Serializers; - for (var i = 0; element = elements[i]; i++) { - arr.push(element); - } - return arr.inject([], function(elements, child) { - if (serializers[child.tagName.toLowerCase()]) - elements.push(Element.extend(child)); - return elements; - }) - }, - - getInputs: function(form, typeName, name) { - form = $(form); - var inputs = form.getElementsByTagName('input'); - - if (!typeName && !name) return $A(inputs).map(Element.extend); - - for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { - var input = inputs[i]; - if ((typeName && input.type != typeName) || (name && input.name != name)) - continue; - matchingInputs.push(Element.extend(input)); - } - - return matchingInputs; - }, - - disable: function(form) { - form = $(form); - Form.getElements(form).invoke('disable'); - return form; - }, - - enable: function(form) { - form = $(form); - Form.getElements(form).invoke('enable'); - return form; - }, - - findFirstElement: function(form) { - var elements = $(form).getElements().findAll(function(element) { - return 'hidden' != element.type && !element.disabled; - }); - var firstByIndex = elements.findAll(function(element) { - return element.hasAttribute('tabIndex') && element.tabIndex >= 0; - }).sortBy(function(element) { return element.tabIndex }).first(); - - return firstByIndex ? firstByIndex : elements.find(function(element) { - return /^(?:input|select|textarea)$/i.test(element.tagName); - }); - }, - - focusFirstElement: function(form) { - form = $(form); - form.findFirstElement().activate(); - return form; - }, - - request: function(form, options) { - form = $(form), options = Object.clone(options || { }); - - var params = options.parameters, action = form.readAttribute('action') || ''; - if (action.blank()) action = window.location.href; - options.parameters = form.serialize(true); - - if (params) { - if (Object.isString(params)) params = params.toQueryParams(); - Object.extend(options.parameters, params); - } - - if (form.hasAttribute('method') && !options.method) - options.method = form.method; - - return new Ajax.Request(action, options); - } -}; - -/*--------------------------------------------------------------------------*/ - - -Form.Element = { - focus: function(element) { - $(element).focus(); - return element; - }, - - select: function(element) { - $(element).select(); - return element; - } -}; - -Form.Element.Methods = { - - serialize: function(element) { - element = $(element); - if (!element.disabled && element.name) { - var value = element.getValue(); - if (value != undefined) { - var pair = { }; - pair[element.name] = value; - return Object.toQueryString(pair); - } - } - return ''; - }, - - getValue: function(element) { - element = $(element); - var method = element.tagName.toLowerCase(); - return Form.Element.Serializers[method](element); - }, - - setValue: function(element, value) { - element = $(element); - var method = element.tagName.toLowerCase(); - Form.Element.Serializers[method](element, value); - return element; - }, - - clear: function(element) { - $(element).value = ''; - return element; - }, - - present: function(element) { - return $(element).value != ''; - }, - - activate: function(element) { - element = $(element); - try { - element.focus(); - if (element.select && (element.tagName.toLowerCase() != 'input' || - !(/^(?:button|reset|submit)$/i.test(element.type)))) - element.select(); - } catch (e) { } - return element; - }, - - disable: function(element) { - element = $(element); - element.disabled = true; - return element; - }, - - enable: function(element) { - element = $(element); - element.disabled = false; - return element; - } -}; - -/*--------------------------------------------------------------------------*/ - -var Field = Form.Element; - -var $F = Form.Element.Methods.getValue; - -/*--------------------------------------------------------------------------*/ - -Form.Element.Serializers = { - input: function(element, value) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - return Form.Element.Serializers.inputSelector(element, value); - default: - return Form.Element.Serializers.textarea(element, value); - } - }, - - inputSelector: function(element, value) { - if (Object.isUndefined(value)) return element.checked ? element.value : null; - else element.checked = !!value; - }, - - textarea: function(element, value) { - if (Object.isUndefined(value)) return element.value; - else element.value = value; - }, - - select: function(element, value) { - if (Object.isUndefined(value)) - return this[element.type == 'select-one' ? - 'selectOne' : 'selectMany'](element); - else { - var opt, currentValue, single = !Object.isArray(value); - for (var i = 0, length = element.length; i < length; i++) { - opt = element.options[i]; - currentValue = this.optionValue(opt); - if (single) { - if (currentValue == value) { - opt.selected = true; - return; - } - } - else opt.selected = value.include(currentValue); - } - } - }, - - selectOne: function(element) { - var index = element.selectedIndex; - return index >= 0 ? this.optionValue(element.options[index]) : null; - }, - - selectMany: function(element) { - var values, length = element.length; - if (!length) return null; - - for (var i = 0, values = []; i < length; i++) { - var opt = element.options[i]; - if (opt.selected) values.push(this.optionValue(opt)); - } - return values; - }, - - optionValue: function(opt) { - return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; - } -}; - -/*--------------------------------------------------------------------------*/ - - -Abstract.TimedObserver = Class.create(PeriodicalExecuter, { - initialize: function($super, element, frequency, callback) { - $super(callback, frequency); - this.element = $(element); - this.lastValue = this.getValue(); - }, - - execute: function() { - var value = this.getValue(); - if (Object.isString(this.lastValue) && Object.isString(value) ? - this.lastValue != value : String(this.lastValue) != String(value)) { - this.callback(this.element, value); - this.lastValue = value; - } - } -}); - -Form.Element.Observer = Class.create(Abstract.TimedObserver, { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.Observer = Class.create(Abstract.TimedObserver, { - getValue: function() { - return Form.serialize(this.element); - } -}); - -/*--------------------------------------------------------------------------*/ - -Abstract.EventObserver = Class.create({ - initialize: function(element, callback) { - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - if (this.element.tagName.toLowerCase() == 'form') - this.registerFormCallbacks(); - else - this.registerCallback(this.element); - }, - - onElementEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - }, - - registerFormCallbacks: function() { - Form.getElements(this.element).each(this.registerCallback, this); - }, - - registerCallback: function(element) { - if (element.type) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - Event.observe(element, 'click', this.onElementEvent.bind(this)); - break; - default: - Event.observe(element, 'change', this.onElementEvent.bind(this)); - break; - } - } - } -}); - -Form.Element.EventObserver = Class.create(Abstract.EventObserver, { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.EventObserver = Class.create(Abstract.EventObserver, { - getValue: function() { - return Form.serialize(this.element); - } -}); -(function() { - - var Event = { - KEY_BACKSPACE: 8, - KEY_TAB: 9, - KEY_RETURN: 13, - KEY_ESC: 27, - KEY_LEFT: 37, - KEY_UP: 38, - KEY_RIGHT: 39, - KEY_DOWN: 40, - KEY_DELETE: 46, - KEY_HOME: 36, - KEY_END: 35, - KEY_PAGEUP: 33, - KEY_PAGEDOWN: 34, - KEY_INSERT: 45, - - cache: {} - }; - - var docEl = document.documentElement; - var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl - && 'onmouseleave' in docEl; - - var _isButton; - if (Prototype.Browser.IE) { - var buttonMap = { 0: 1, 1: 4, 2: 2 }; - _isButton = function(event, code) { - return event.button === buttonMap[code]; - }; - } else if (Prototype.Browser.WebKit) { - _isButton = function(event, code) { - switch (code) { - case 0: return event.which == 1 && !event.metaKey; - case 1: return event.which == 1 && event.metaKey; - default: return false; - } - }; - } else { - _isButton = function(event, code) { - return event.which ? (event.which === code + 1) : (event.button === code); - }; - } - - function isLeftClick(event) { return _isButton(event, 0) } - - function isMiddleClick(event) { return _isButton(event, 1) } - - function isRightClick(event) { return _isButton(event, 2) } - - function element(event) { - event = Event.extend(event); - - var node = event.target, type = event.type, - currentTarget = event.currentTarget; - - if (currentTarget && currentTarget.tagName) { - if (type === 'load' || type === 'error' || - (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' - && currentTarget.type === 'radio')) - node = currentTarget; - } - - if (node.nodeType == Node.TEXT_NODE) - node = node.parentNode; - - return Element.extend(node); - } - - function findElement(event, expression) { - var element = Event.element(event); - if (!expression) return element; - while (element) { - if (Object.isElement(element) && Prototype.Selector.match(element, expression)) { - return Element.extend(element); - } - element = element.parentNode; - } - } - - function pointer(event) { - return { x: pointerX(event), y: pointerY(event) }; - } - - function pointerX(event) { - var docElement = document.documentElement, - body = document.body || { scrollLeft: 0 }; - - return event.pageX || (event.clientX + - (docElement.scrollLeft || body.scrollLeft) - - (docElement.clientLeft || 0)); - } - - function pointerY(event) { - var docElement = document.documentElement, - body = document.body || { scrollTop: 0 }; - - return event.pageY || (event.clientY + - (docElement.scrollTop || body.scrollTop) - - (docElement.clientTop || 0)); - } - - - function stop(event) { - Event.extend(event); - event.preventDefault(); - event.stopPropagation(); - - event.stopped = true; - } - - Event.Methods = { - isLeftClick: isLeftClick, - isMiddleClick: isMiddleClick, - isRightClick: isRightClick, - - element: element, - findElement: findElement, - - pointer: pointer, - pointerX: pointerX, - pointerY: pointerY, - - stop: stop - }; - - - var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { - m[name] = Event.Methods[name].methodize(); - return m; - }); - - if (Prototype.Browser.IE) { - function _relatedTarget(event) { - var element; - switch (event.type) { - case 'mouseover': element = event.fromElement; break; - case 'mouseout': element = event.toElement; break; - default: return null; - } - return Element.extend(element); - } - - Object.extend(methods, { - stopPropagation: function() { this.cancelBubble = true }, - preventDefault: function() { this.returnValue = false }, - inspect: function() { return '[object Event]' } - }); - - Event.extend = function(event, element) { - if (!event) return false; - if (event._extendedByPrototype) return event; - - event._extendedByPrototype = Prototype.emptyFunction; - var pointer = Event.pointer(event); - - Object.extend(event, { - target: event.srcElement || element, - relatedTarget: _relatedTarget(event), - pageX: pointer.x, - pageY: pointer.y - }); - - return Object.extend(event, methods); - }; - } else { - Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__; - Object.extend(Event.prototype, methods); - Event.extend = Prototype.K; - } - - function _createResponder(element, eventName, handler) { - var registry = Element.retrieve(element, 'prototype_event_registry'); - - if (Object.isUndefined(registry)) { - CACHE.push(element); - registry = Element.retrieve(element, 'prototype_event_registry', $H()); - } - - var respondersForEvent = registry.get(eventName); - if (Object.isUndefined(respondersForEvent)) { - respondersForEvent = []; - registry.set(eventName, respondersForEvent); - } - - if (respondersForEvent.pluck('handler').include(handler)) return false; - - var responder; - if (eventName.include(":")) { - responder = function(event) { - if (Object.isUndefined(event.eventName)) - return false; - - if (event.eventName !== eventName) - return false; - - Event.extend(event, element); - handler.call(element, event); - }; - } else { - if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED && - (eventName === "mouseenter" || eventName === "mouseleave")) { - if (eventName === "mouseenter" || eventName === "mouseleave") { - responder = function(event) { - Event.extend(event, element); - - var parent = event.relatedTarget; - while (parent && parent !== element) { - try { parent = parent.parentNode; } - catch(e) { parent = element; } - } - - if (parent === element) return; - - handler.call(element, event); - }; - } - } else { - responder = function(event) { - Event.extend(event, element); - handler.call(element, event); - }; - } - } - - responder.handler = handler; - respondersForEvent.push(responder); - return responder; - } - - function _destroyCache() { - for (var i = 0, length = CACHE.length; i < length; i++) { - Event.stopObserving(CACHE[i]); - CACHE[i] = null; - } - } - - var CACHE = []; - - if (Prototype.Browser.IE) - window.attachEvent('onunload', _destroyCache); - - if (Prototype.Browser.WebKit) - window.addEventListener('unload', Prototype.emptyFunction, false); - - - var _getDOMEventName = Prototype.K, - translations = { mouseenter: "mouseover", mouseleave: "mouseout" }; - - if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) { - _getDOMEventName = function(eventName) { - return (translations[eventName] || eventName); - }; - } - - function observe(element, eventName, handler) { - element = $(element); - - var responder = _createResponder(element, eventName, handler); - - if (!responder) return element; - - if (eventName.include(':')) { - if (element.addEventListener) - element.addEventListener("dataavailable", responder, false); - else { - element.attachEvent("ondataavailable", responder); - element.attachEvent("onfilterchange", responder); - } - } else { - var actualEventName = _getDOMEventName(eventName); - - if (element.addEventListener) - element.addEventListener(actualEventName, responder, false); - else - element.attachEvent("on" + actualEventName, responder); - } - - return element; - } - - function stopObserving(element, eventName, handler) { - element = $(element); - - var registry = Element.retrieve(element, 'prototype_event_registry'); - if (!registry) return element; - - if (!eventName) { - registry.each( function(pair) { - var eventName = pair.key; - stopObserving(element, eventName); - }); - return element; - } - - var responders = registry.get(eventName); - if (!responders) return element; - - if (!handler) { - responders.each(function(r) { - stopObserving(element, eventName, r.handler); - }); - return element; - } - - var responder = responders.find( function(r) { return r.handler === handler; }); - if (!responder) return element; - - if (eventName.include(':')) { - if (element.removeEventListener) - element.removeEventListener("dataavailable", responder, false); - else { - element.detachEvent("ondataavailable", responder); - element.detachEvent("onfilterchange", responder); - } - } else { - var actualEventName = _getDOMEventName(eventName); - if (element.removeEventListener) - element.removeEventListener(actualEventName, responder, false); - else - element.detachEvent('on' + actualEventName, responder); - } - - registry.set(eventName, responders.without(responder)); - - return element; - } - - function fire(element, eventName, memo, bubble) { - element = $(element); - - if (Object.isUndefined(bubble)) - bubble = true; - - if (element == document && document.createEvent && !element.dispatchEvent) - element = document.documentElement; - - var event; - if (document.createEvent) { - event = document.createEvent('HTMLEvents'); - event.initEvent('dataavailable', true, true); - } else { - event = document.createEventObject(); - event.eventType = bubble ? 'ondataavailable' : 'onfilterchange'; - } - - event.eventName = eventName; - event.memo = memo || { }; - - if (document.createEvent) - element.dispatchEvent(event); - else - element.fireEvent(event.eventType, event); - - return Event.extend(event); - } - - Event.Handler = Class.create({ - initialize: function(element, eventName, selector, callback) { - this.element = $(element); - this.eventName = eventName; - this.selector = selector; - this.callback = callback; - this.handler = this.handleEvent.bind(this); - }, - - start: function() { - Event.observe(this.element, this.eventName, this.handler); - return this; - }, - - stop: function() { - Event.stopObserving(this.element, this.eventName, this.handler); - return this; - }, - - handleEvent: function(event) { - var element = event.findElement(this.selector); - if (element) this.callback.call(this.element, event, element); - } - }); - - function on(element, eventName, selector, callback) { - element = $(element); - if (Object.isFunction(selector) && Object.isUndefined(callback)) { - callback = selector, selector = null; - } - - return new Event.Handler(element, eventName, selector, callback).start(); - } - - Object.extend(Event, Event.Methods); - - Object.extend(Event, { - fire: fire, - observe: observe, - stopObserving: stopObserving, - on: on - }); - - Element.addMethods({ - fire: fire, - - observe: observe, - - stopObserving: stopObserving, - - on: on - }); - - Object.extend(document, { - fire: fire.methodize(), - - observe: observe.methodize(), - - stopObserving: stopObserving.methodize(), - - on: on.methodize(), - - loaded: false - }); - - if (window.Event) Object.extend(window.Event, Event); - else window.Event = Event; -})(); - -(function() { - /* Support for the DOMContentLoaded event is based on work by Dan Webb, - Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */ - - var timer; - - function fireContentLoadedEvent() { - if (document.loaded) return; - if (timer) window.clearTimeout(timer); - document.loaded = true; - document.fire('dom:loaded'); - } - - function checkReadyState() { - if (document.readyState === 'complete') { - document.stopObserving('readystatechange', checkReadyState); - fireContentLoadedEvent(); - } - } - - function pollDoScroll() { - try { document.documentElement.doScroll('left'); } - catch(e) { - timer = pollDoScroll.defer(); - return; - } - fireContentLoadedEvent(); - } - - if (document.addEventListener) { - document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false); - } else { - document.observe('readystatechange', checkReadyState); - if (window == top) - timer = pollDoScroll.defer(); - } - - Event.observe(window, 'load', fireContentLoadedEvent); -})(); - -Element.addMethods(); - -/*------------------------------- DEPRECATED -------------------------------*/ - -Hash.toQueryString = Object.toQueryString; - -var Toggle = { display: Element.toggle }; - -Element.Methods.childOf = Element.Methods.descendantOf; - -var Insertion = { - Before: function(element, content) { - return Element.insert(element, {before:content}); - }, - - Top: function(element, content) { - return Element.insert(element, {top:content}); - }, - - Bottom: function(element, content) { - return Element.insert(element, {bottom:content}); - }, - - After: function(element, content) { - return Element.insert(element, {after:content}); - } -}; - -var $continue = new Error('"throw $continue" is deprecated, use "return" instead'); - -var Position = { - includeScrollOffsets: false, - - prepare: function() { - this.deltaX = window.pageXOffset - || document.documentElement.scrollLeft - || document.body.scrollLeft - || 0; - this.deltaY = window.pageYOffset - || document.documentElement.scrollTop - || document.body.scrollTop - || 0; - }, - - within: function(element, x, y) { - if (this.includeScrollOffsets) - return this.withinIncludingScrolloffsets(element, x, y); - this.xcomp = x; - this.ycomp = y; - this.offset = Element.cumulativeOffset(element); - - return (y >= this.offset[1] && - y < this.offset[1] + element.offsetHeight && - x >= this.offset[0] && - x < this.offset[0] + element.offsetWidth); - }, - - withinIncludingScrolloffsets: function(element, x, y) { - var offsetcache = Element.cumulativeScrollOffset(element); - - this.xcomp = x + offsetcache[0] - this.deltaX; - this.ycomp = y + offsetcache[1] - this.deltaY; - this.offset = Element.cumulativeOffset(element); - - return (this.ycomp >= this.offset[1] && - this.ycomp < this.offset[1] + element.offsetHeight && - this.xcomp >= this.offset[0] && - this.xcomp < this.offset[0] + element.offsetWidth); - }, - - overlap: function(mode, element) { - if (!mode) return 0; - if (mode == 'vertical') - return ((this.offset[1] + element.offsetHeight) - this.ycomp) / - element.offsetHeight; - if (mode == 'horizontal') - return ((this.offset[0] + element.offsetWidth) - this.xcomp) / - element.offsetWidth; - }, - - - cumulativeOffset: Element.Methods.cumulativeOffset, - - positionedOffset: Element.Methods.positionedOffset, - - absolutize: function(element) { - Position.prepare(); - return Element.absolutize(element); - }, - - relativize: function(element) { - Position.prepare(); - return Element.relativize(element); - }, - - realOffset: Element.Methods.cumulativeScrollOffset, - - offsetParent: Element.Methods.getOffsetParent, - - page: Element.Methods.viewportOffset, - - clone: function(source, target, options) { - options = options || { }; - return Element.clonePosition(target, source, options); - } -}; - -/*--------------------------------------------------------------------------*/ - -if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ - function iter(name) { - return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; - } - - instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? - function(element, className) { - className = className.toString().strip(); - var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); - return cond ? document._getElementsByXPath('.//*' + cond, element) : []; - } : function(element, className) { - className = className.toString().strip(); - var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); - if (!classNames && !className) return elements; - - var nodes = $(element).getElementsByTagName('*'); - className = ' ' + className + ' '; - - for (var i = 0, child, cn; child = nodes[i]; i++) { - if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || - (classNames && classNames.all(function(name) { - return !name.toString().blank() && cn.include(' ' + name + ' '); - })))) - elements.push(Element.extend(child)); - } - return elements; - }; - - return function(className, parentElement) { - return $(parentElement || document.body).getElementsByClassName(className); - }; -}(Element.Methods); - -/*--------------------------------------------------------------------------*/ - -Element.ClassNames = Class.create(); -Element.ClassNames.prototype = { - initialize: function(element) { - this.element = $(element); - }, - - _each: function(iterator) { - this.element.className.split(/\s+/).select(function(name) { - return name.length > 0; - })._each(iterator); - }, - - set: function(className) { - this.element.className = className; - }, - - add: function(classNameToAdd) { - if (this.include(classNameToAdd)) return; - this.set($A(this).concat(classNameToAdd).join(' ')); - }, - - remove: function(classNameToRemove) { - if (!this.include(classNameToRemove)) return; - this.set($A(this).without(classNameToRemove).join(' ')); - }, - - toString: function() { - return $A(this).join(' '); - } -}; - -Object.extend(Element.ClassNames.prototype, Enumerable); - -/*--------------------------------------------------------------------------*/ - -(function() { - window.Selector = Class.create({ - initialize: function(expression) { - this.expression = expression.strip(); - }, - - findElements: function(rootElement) { - return Prototype.Selector.select(this.expression, rootElement); - }, - - match: function(element) { - return Prototype.Selector.match(element, this.expression); - }, - - toString: function() { - return this.expression; - }, - - inspect: function() { - return "#"; - } - }); - - Object.extend(Selector, { - matchElements: function(elements, expression) { - var match = Prototype.Selector.match, - results = []; - - for (var i = 0, length = elements.length; i < length; i++) { - var element = elements[i]; - if (match(element, expression)) { - results.push(Element.extend(element)); - } - } - return results; - }, - - findElement: function(elements, expression, index) { - index = index || 0; - var matchIndex = 0, element; - for (var i = 0, length = elements.length; i < length; i++) { - element = elements[i]; - if (Prototype.Selector.match(element, expression) && index === matchIndex++) { - return Element.extend(element); - } - } - }, - - findChildElements: function(element, expressions) { - var selector = expressions.toArray().join(', '); - return Prototype.Selector.select(selector, element || document); - } - }); -})(); diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/rails.js b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/rails.js deleted file mode 100644 index aed6aed..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/javascripts/rails.js +++ /dev/null @@ -1,191 +0,0 @@ -(function() { - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - function isEventSupported(eventName) { - var el = document.createElement('div'); - eventName = 'on' + eventName; - var isSupported = (eventName in el); - if (!isSupported) { - el.setAttribute(eventName, 'return;'); - isSupported = typeof el[eventName] == 'function'; - } - el = null; - return isSupported; - } - - function isForm(element) { - return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM' - } - - function isInput(element) { - if (Object.isElement(element)) { - var name = element.nodeName.toUpperCase() - return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA' - } - else return false - } - - var submitBubbles = isEventSupported('submit'), - changeBubbles = isEventSupported('change') - - if (!submitBubbles || !changeBubbles) { - // augment the Event.Handler class to observe custom events when needed - Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap( - function(init, element, eventName, selector, callback) { - init(element, eventName, selector, callback) - // is the handler being attached to an element that doesn't support this event? - if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) || - (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) { - // "submit" => "emulated:submit" - this.eventName = 'emulated:' + this.eventName - } - } - ) - } - - if (!submitBubbles) { - // discover forms on the page by observing focus events which always bubble - document.on('focusin', 'form', function(focusEvent, form) { - // special handler for the real "submit" event (one-time operation) - if (!form.retrieve('emulated:submit')) { - form.on('submit', function(submitEvent) { - var emulated = form.fire('emulated:submit', submitEvent, true) - // if custom event received preventDefault, cancel the real one too - if (emulated.returnValue === false) submitEvent.preventDefault() - }) - form.store('emulated:submit', true) - } - }) - } - - if (!changeBubbles) { - // discover form inputs on the page - document.on('focusin', 'input, select, texarea', function(focusEvent, input) { - // special handler for real "change" events - if (!input.retrieve('emulated:change')) { - input.on('change', function(changeEvent) { - input.fire('emulated:change', changeEvent, true) - }) - input.store('emulated:change', true) - } - }) - } - - function handleRemote(element) { - var method, url, params; - - var event = element.fire("ajax:before"); - if (event.stopped) return false; - - if (element.tagName.toLowerCase() === 'form') { - method = element.readAttribute('method') || 'post'; - url = element.readAttribute('action'); - params = element.serialize(); - } else { - method = element.readAttribute('data-method') || 'get'; - url = element.readAttribute('href'); - params = {}; - } - - new Ajax.Request(url, { - method: method, - parameters: params, - evalScripts: true, - - onComplete: function(request) { element.fire("ajax:complete", request); }, - onSuccess: function(request) { element.fire("ajax:success", request); }, - onFailure: function(request) { element.fire("ajax:failure", request); } - }); - - element.fire("ajax:after"); - } - - function handleMethod(element) { - var method = element.readAttribute('data-method'), - url = element.readAttribute('href'), - csrf_param = $$('meta[name=csrf-param]')[0], - csrf_token = $$('meta[name=csrf-token]')[0]; - - var form = new Element('form', { method: "POST", action: url, style: "display: none;" }); - element.parentNode.insert(form); - - if (method !== 'post') { - var field = new Element('input', { type: 'hidden', name: '_method', value: method }); - form.insert(field); - } - - if (csrf_param) { - var param = csrf_param.readAttribute('content'), - token = csrf_token.readAttribute('content'), - field = new Element('input', { type: 'hidden', name: param, value: token }); - form.insert(field); - } - - form.submit(); - } - - - document.on("click", "*[data-confirm]", function(event, element) { - var message = element.readAttribute('data-confirm'); - if (!confirm(message)) event.stop(); - }); - - document.on("click", "a[data-remote]", function(event, element) { - if (event.stopped) return; - handleRemote(element); - event.stop(); - }); - - document.on("click", "a[data-method]", function(event, element) { - if (event.stopped) return; - handleMethod(element); - event.stop(); - }); - - document.on("submit", function(event) { - var element = event.findElement(), - message = element.readAttribute('data-confirm'); - if (message && !confirm(message)) { - event.stop(); - return false; - } - - var inputs = element.select("input[type=submit][data-disable-with]"); - inputs.each(function(input) { - input.disabled = true; - input.writeAttribute('data-original-value', input.value); - input.value = input.readAttribute('data-disable-with'); - }); - - var element = event.findElement("form[data-remote]"); - if (element) { - handleRemote(element); - event.stop(); - } - }); - - document.on("ajax:after", "form", function(event, element) { - var inputs = element.select("input[type=submit][disabled=true][data-disable-with]"); - inputs.each(function(input) { - input.value = input.readAttribute('data-original-value'); - input.removeAttribute('data-original-value'); - input.disabled = false; - }); - }); - - Ajax.Responders.register({ - onCreate: function(request) { - var csrf_meta_tag = $$('meta[name=csrf-token]')[0]; - - if (csrf_meta_tag) { - var header = 'X-CSRF-Token', - token = csrf_meta_tag.readAttribute('content'); - - if (!request.options.requestHeaders) { - request.options.requestHeaders = {}; - } - request.options.requestHeaders[header] = token; - } - } - }); -})(); diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/robots.txt b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/robots.txt deleted file mode 100644 index 085187f..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-Agent: * -# Disallow: / diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/public/stylesheets/.gitkeep b/oldstuff/RubyFun/cookbook/015/hodgepodge/public/stylesheets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/script/rails b/oldstuff/RubyFun/cookbook/015/hodgepodge/script/rails deleted file mode 100755 index f8da2cf..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/fixtures/people.yml b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/fixtures/people.yml deleted file mode 100644 index 6b0a880..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/fixtures/people.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html - -# This model initially had no columns defined. If you add columns to the -# model remove the '{}' from the fixture names and add the columns immediately -# below each fixture, per the syntax in the comments below - -one: - name: "John Doe" - email: "john@doe.com" - -two: - name: "Jane Doe" - email: "janeybear@yahoo.com" - -three: - name: "Manny Bananny" - email: "hunka@burninluv.us" - diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/fixtures/users.yml b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/fixtures/users.yml deleted file mode 100644 index 3db618e..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/fixtures/users.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html - -# This model initially had no columns defined. If you add columns to the -# model remove the '{}' from the fixture names and add the columns immediately -# below each fixture, per the syntax in the comments below -# -one: - username: johndoe - hashed_password: 019768a0e586a21e3250db985405554ccde798fc - -two: - username: janedoe - hashed_password: 019768a0e586a21e3250db985405554ccde798fc diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/foo_controller_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/foo_controller_test.rb deleted file mode 100644 index 289ffba..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/foo_controller_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class FooControllerTest < ActionController::TestCase - test "should get index" do - get :index - assert_response :success - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/index_controller_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/index_controller_test.rb deleted file mode 100644 index a12b212..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/index_controller_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class IndexControllerTest < ActionController::TestCase - test "should get index" do - get :index - assert_response :success - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/list_controller_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/list_controller_test.rb deleted file mode 100644 index 3c547f7..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/list_controller_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class ListControllerTest < ActionController::TestCase - test "should get index" do - get :index - assert_response :success - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/people_controller_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/people_controller_test.rb deleted file mode 100644 index 69420d1..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/people_controller_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class PeopleControllerTest < ActionController::TestCase - test "should get list" do - get :list - assert_response :success - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/user_controller_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/user_controller_test.rb deleted file mode 100644 index ba7e019..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/functional/user_controller_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'test_helper' - -class UserControllerTest < ActionController::TestCase - test "oh lordy" do - assert true - end - -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/performance/browsing_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/performance/browsing_test.rb deleted file mode 100644 index 867fc8c..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/performance/browsing_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' -require 'rails/performance_test_help' - -# Profiling results for each test method are written to tmp/performance. -class BrowsingTest < ActionDispatch::PerformanceTest - def test_homepage - get '/' - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/test_helper.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/test_helper.rb deleted file mode 100644 index 8bf1192..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/test_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -ENV["RAILS_ENV"] = "test" -require File.expand_path('../../config/environment', __FILE__) -require 'rails/test_help' - -class ActiveSupport::TestCase - # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. - # - # Note: You'll currently still have to declare fixtures explicitly in integration tests - # -- they do not yet inherit this setting - fixtures :all - - # Add more helper methods to be used by all tests here... -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/foo_helper_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/foo_helper_test.rb deleted file mode 100644 index f4454c1..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/foo_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class FooHelperTest < ActionView::TestCase -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/index_helper_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/index_helper_test.rb deleted file mode 100644 index 104f529..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/index_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class IndexHelperTest < ActionView::TestCase -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/list_helper_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/list_helper_test.rb deleted file mode 100644 index 09cd2a5..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/list_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class ListHelperTest < ActionView::TestCase -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/people_helper_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/people_helper_test.rb deleted file mode 100644 index d554493..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/people_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class PeopleHelperTest < ActionView::TestCase -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/user_helper_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/user_helper_test.rb deleted file mode 100644 index ad44a53..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/helpers/user_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class UserHelperTest < ActionView::TestCase -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/person_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/person_test.rb deleted file mode 100644 index 8e9c555..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/person_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'test_helper' - -class PersonTest < ActiveSupport::TestCase - # Replace this with your real tests. - test "the truth" do - assert true - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/user_test.rb b/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/user_test.rb deleted file mode 100644 index a64d2d3..0000000 --- a/oldstuff/RubyFun/cookbook/015/hodgepodge/test/unit/user_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'test_helper' - -class UserTest < ActiveSupport::TestCase - # Replace this with your real tests. - test "the truth" do - assert true - end -end diff --git a/oldstuff/RubyFun/cookbook/015/hodgepodge/vendor/plugins/.gitkeep b/oldstuff/RubyFun/cookbook/015/hodgepodge/vendor/plugins/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/cookbook/016/03.rb b/oldstuff/RubyFun/cookbook/016/03.rb deleted file mode 100644 index 456529f..0000000 --- a/oldstuff/RubyFun/cookbook/016/03.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'xmlrpc/client' - -server = XMLRPC::Client.new2('http://betty.userland.com/RPC2') -puts server.call('examples.getStateName', 5) - - -begin - server.call('noSuchMethod') -rescue XMLRPC::FaultException => e - puts "Error: fault code #{e.faultCode}" - puts e.faultString -end diff --git a/oldstuff/RubyFun/cookbook/016/03b.rb b/oldstuff/RubyFun/cookbook/016/03b.rb deleted file mode 100644 index 09a9ffd..0000000 --- a/oldstuff/RubyFun/cookbook/016/03b.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'xmlrpc/client' - - -def lookup_upc(upc, rpc_key) - server = XMLRPC::Client.new2('http://www.upcdatabase.com/xmlrpc') - begin - response = server.call('lookup', :upc => upc, :rpc_key => rpc_key) - return response['found'] ? response : nil - rescue XMLRPC::FaultException => e - puts "Error: " - puts e.faultCode - puts e.faultString - end -end - - -['018787765654', 'no such UPC'].each do |upc| - product = lookup_upc(upc, ARGV.first.strip) - if product - puts product['description'] - puts product['size'] - else - puts "Oh no! product with upc='#{upc}' is #{product.inspect}" - end -end diff --git a/oldstuff/RubyFun/cookbook/016/04.rb b/oldstuff/RubyFun/cookbook/016/04.rb deleted file mode 100644 index 6447b2a..0000000 --- a/oldstuff/RubyFun/cookbook/016/04.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'soap/rpc/driver' - -# doesn't work (service no longer available?) -driver = SOAP::RPC::Driver.new( - 'http://services.xmethods.net/soap/', 'url:xmethods-delayed-quotes' -) - -driver.add_method('getQuote', 'symbol') - -puts 'Stock price: %.2f' % driver.getQuote(ARGV.first) diff --git a/oldstuff/RubyFun/cookbook/preface/sample_ruby_file.rb b/oldstuff/RubyFun/cookbook/preface/sample_ruby_file.rb deleted file mode 100644 index 8d7e1d7..0000000 --- a/oldstuff/RubyFun/cookbook/preface/sample_ruby_file.rb +++ /dev/null @@ -1,3 +0,0 @@ -1 + 2 -Math.sqrt(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10) -puts "This string is self-referential." diff --git a/oldstuff/RubyFun/koans/GREED_RULES.txt b/oldstuff/RubyFun/koans/GREED_RULES.txt deleted file mode 100644 index 58b5a9c..0000000 --- a/oldstuff/RubyFun/koans/GREED_RULES.txt +++ /dev/null @@ -1,66 +0,0 @@ -= Playing Greed - -Greed is a dice game played among 2 or more players, using 5 -six-sided dice. - -== Playing Greed - -Each player takes a turn consisting of one or more rolls of the dice. -On the first roll of the game, a player rolls all five dice which are -scored according to the following: - - Three 1's => 1000 points - Three 6's => 600 points - Three 5's => 500 points - Three 4's => 400 points - Three 3's => 300 points - Three 2's => 200 points - One 1 => 100 points - One 5 => 50 points - -A single die can only be counted once in each roll. For example, -a "5" can only count as part of a triplet (contributing to the 500 -points) or as a single 50 points, but not both in the same roll. - -Example Scoring - - Throw Score - --------- ------------------ - 5 1 3 4 1 50 + 2 * 100 = 250 - 1 1 1 3 1 1000 + 100 = 1100 - 2 4 4 5 4 400 + 50 = 450 - -The dice not contributing to the score are called the non-scoring -dice. "3" and "4" are non-scoring dice in the first example. "3" is -a non-scoring die in the second, and "2" is a non-score die in the -final example. - -After a player rolls and the score is calculated, the scoring dice are -removed and the player has the option of rolling again using only the -non-scoring dice. If all of the thrown dice are scoring, then the -player may roll all 5 dice in the next roll. - -The player may continue to roll as long as each roll scores points. If -a roll has zero points, then the player loses not only their turn, but -also accumulated score for that turn. If a player decides to stop -rolling before rolling a zero-point roll, then the accumulated points -for the turn is added to his total score. - -== Getting "In The Game" - -Before a player is allowed to accumulate points, they must get at -least 300 points in a single turn. Once they have achieved 300 points -in a single turn, the points earned in that turn and each following -turn will be counted toward their total score. - -== End Game - -Once a player reaches 3000 (or more) points, the game enters the final -round where each of the other players gets one more turn. The winner -is the player with the highest score after the final round. - -== References - -Greed is described on Wikipedia at -http://en.wikipedia.org/wiki/Greed_(dice_game), however the rules are -a bit different from the rules given here. diff --git a/oldstuff/RubyFun/koans/README.rdoc b/oldstuff/RubyFun/koans/README.rdoc deleted file mode 100644 index f1e0f8e..0000000 --- a/oldstuff/RubyFun/koans/README.rdoc +++ /dev/null @@ -1,136 +0,0 @@ -= EdgeCase Ruby Koans - -The Ruby Koans walk you along the path to enlightenment in order to learn Ruby. -The goal is to learn the Ruby language, syntax, structure, and some common -functions and libraries. We also teach you culture. Testing is not just something we -pay lip service to, but something we live. It is essential in your quest to learn -and do great things in the language. - -== The Structure - -The koans are broken out into areas by file, hashes are covered in about_hashes.rb, -modules are introduced in about_modules.rb, etc. They are presented in order in the -path_to_enlightenment.rb file. - -Each koan builds up your knowledge of Ruby and builds upon itself. It will stop at -the first place you need to correct. - -Some koans simply need to have the correct answer substituted for an incorrect one. -Some, however, require you to supply your own answer. If you see the method +__+ (a -double underscore) listed, it is a hint to you to supply your own code in order to -make it work correctly. - -== Installing Ruby - -If you do not have Ruby setup, please visit http://ruby-lang.org/en/downloads/ for -operating specific instructions. In order to run this you need ruby and rake -installed. To check the installations simply type: - -*nix platforms from any terminal window: - - [~] $ ruby --version - [~] $ rake --version - -Windows from the command prompt (cmd.exe) - - c:\ruby --version - c:\rake --version - -Any response for Ruby with a version number greater than 1.8 is fine (should be -around 1.8.6 or more). Any version of rake will do. - -== The Path To Enlightenment - -You can run the tests through rake or by calling the file itself (rake is the -recommended way to run them as we might build more functionality into this task). - -*nix platforms, from the koans directory - - [ruby_koans] $ rake # runs the default target :walk_the_path - [ruby_koans] $ ruby path_to_enlightenment.rb # simply call the file directly - -Windows is the same thing - - c:\ruby_koans\rake # runs the default target :walk_the_path - c:\ruby_koans\ruby path_to_enlightenment.rb # simply call the file directly - -=== Red, Green, Refactor - -In test-driven development the mantra has always been, red, green, refactor. Write a -failing test and run it (red), make the test pass (green), then refactor it (that is -look at the code and see if you can make it any better. In this case you will need -to run the koan and see it fail (red), make the test pass (green), then take a -moment and reflect upon the test to see what it is teaching you and improve the -code to better communicate its intent (refactor). - -The very first time you run it you will see the following output: - - [ ruby_koans ] $ rake - (in /Users/person/dev/ruby_koans) - cd koans - - Thinking AboutAsserts - test_assert_truth has damaged your karma. - - You have not yet reached enlightenment ... - is not true. - - Please meditate on the following code: - ./about_asserts.rb:10:in `test_assert_truth' - path_to_enlightenment.rb:27 - - mountains are merely mountains - -You have come to your first stage. If you notice it is telling you where to look for -the first solution: - - Please meditate on the following code: - ./about_asserts.rb:10:in `test_assert_truth' - path_to_enlightenment.rb:27 - -We then open up the about_asserts.rb file and look at the first test: - - # We shall contemplate truth by testing reality, via asserts. - def test_assert_truth - assert false # This should be true - end - -We then change the +false+ to +true+ and run the test again. After you are -done, think about what you are learning. In this case, ignore everything except -the method name (+test_assert_truth+) and the parts inside the method (everything -before the +end+). - -In this case the goal is for you to see that if you pass a value to the +assert+ -method, it will either ensure it is +true+ and continue on, or fail if in fact -the statement is +false+. - -== Inspiration - -A special thanks to Mike Clark and Ara Howard for inspiring this -project. Mike Clark wrote an excellent blog post about learning Ruby -through unit testing. This sparked an idea that has taken a bit to -solidify, that of bringing new rubyists into the community through -testing. Ara Howard then gave us the idea for the Koans in his ruby -quiz entry on Meta Koans (a must for any rubyist wanting to improve -their skills). Also, "The Little Lisper" taught us all the value of -the short questions/simple answers style of learning. - -Mike Clark's post :: http://www.clarkware.com/cgi/blosxom/2005/03/18 -Meta Koans :: http://rubyquiz.com/quiz67.html -The Little Lisper :: http://www.amazon.com/Little-LISPer-Third-Daniel-Friedman/dp/0023397632 - -== Other Resources - -The Ruby Language :: http://ruby-lang.org -Try Ruby in your browser :: http://tryruby.org - -Dave Thomas' introduction to Ruby Programming Ruby (the Pick Axe) :: http://pragprog.com/titles/ruby/programming-ruby - -Brian Marick's fantastic guide for beginners Everyday Scripting with Ruby :: http://pragprog.com/titles/bmsft/everyday-scripting-with-ruby - -= Other stuff - -Author :: Jim Weirich -Author :: Joe O'Brien -Issue Tracker :: http://www.pivotaltracker.com/projects/48111 -Requires :: Ruby 1.8.x or later and Rake (any recent version) diff --git a/oldstuff/RubyFun/koans/Rakefile b/oldstuff/RubyFun/koans/Rakefile deleted file mode 100644 index 1a2c7f2..0000000 --- a/oldstuff/RubyFun/koans/Rakefile +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env ruby -# -*- ruby -*- - -require 'rake/clean' -require 'rake/testtask' - -task :default => :test - -task :test do - ruby 'path_to_enlightenment.rb' -end - diff --git a/oldstuff/RubyFun/koans/about_array_assignment.rb b/oldstuff/RubyFun/koans/about_array_assignment.rb deleted file mode 100644 index 21a64bb..0000000 --- a/oldstuff/RubyFun/koans/about_array_assignment.rb +++ /dev/null @@ -1,51 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutArrayAssignment < EdgeCase::Koan - def test_non_parallel_assignment - names = ["John", "Smith"] - assert_equal __, names - end - - def test_parallel_assignments - first_name, last_name = ["John", "Smith"] - assert_equal __, first_name - assert_equal __, last_name - end - - def test_parallel_assignments_with_extra_values - first_name, last_name = ["John", "Smith", "III"] - assert_equal __, first_name - assert_equal __, last_name - end - - def test_parallel_assignments_with_splat_operator - first_name, *last_name = ["John", "Smith", "III"] - assert_equal __, first_name - assert_equal __, last_name - end - - def test_parallel_assignments_with_too_few_variables - first_name, last_name = ["Cher"] - assert_equal __, first_name - assert_equal __, last_name - end - - def test_parallel_assignments_with_subarrays - first_name, last_name = [["Willie", "Rae"], "Johnson"] - assert_equal __, first_name - assert_equal __, last_name - end - - def test_parallel_assignment_with_one_variable - first_name, = ["John", "Smith"] - assert_equal __, first_name - end - - def test_swapping_with_parallel_assignment - first_name = "Roy" - last_name = "Rob" - first_name, last_name = last_name, first_name - assert_equal __, first_name - assert_equal __, last_name - end -end diff --git a/oldstuff/RubyFun/koans/about_arrays.rb b/oldstuff/RubyFun/koans/about_arrays.rb deleted file mode 100644 index 9f27b5a..0000000 --- a/oldstuff/RubyFun/koans/about_arrays.rb +++ /dev/null @@ -1,84 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutArrays < EdgeCase::Koan - def test_creating_arrays - empty_array = Array.new - assert_equal __, empty_array.class - assert_equal __, empty_array.size - end - - def test_array_literals - array = Array.new - assert_equal [], array - - array[0] = 1 - assert_equal [1], array - - array[1] = 2 - assert_equal [1, __], array - - array << 333 - assert_equal __, array - end - - def test_accessing_array_elements - array = [:peanut, :butter, :and, :jelly] - - assert_equal __, array[0] - assert_equal __, array.first - assert_equal __, array[3] - assert_equal __, array.last - assert_equal __, array[-1] - assert_equal __, array[-3] - end - - def test_slicing_arrays - array = [:peanut, :butter, :and, :jelly] - - assert_equal __, array[0,1] - assert_equal __, array[0,2] - assert_equal __, array[2,2] - assert_equal __, array[2,20] - assert_equal __, array[4,0] - assert_equal __, array[4,100] - assert_equal __, array[5,0] - end - - def test_arrays_and_ranges - assert_equal __, (1..5).class - assert_not_equal [1,2,3,4,5], (1..5) - assert_equal __, (1..5).to_a - assert_equal __, (1...5).to_a - end - - def test_slicing_with_ranges - array = [:peanut, :butter, :and, :jelly] - - assert_equal __, array[0..2] - assert_equal __, array[0...2] - assert_equal __, array[2..-1] - end - - def test_pushing_and_popping_arrays - array = [1,2] - array.push(:last) - - assert_equal __, array - - popped_value = array.pop - assert_equal __, popped_value - assert_equal __, array - end - - def test_shifting_arrays - array = [1,2] - array.unshift(:first) - - assert_equal __, array - - shifted_value = array.shift - assert_equal __, shifted_value - assert_equal __, array - end - -end diff --git a/oldstuff/RubyFun/koans/about_asserts.rb b/oldstuff/RubyFun/koans/about_asserts.rb deleted file mode 100644 index 33e2572..0000000 --- a/oldstuff/RubyFun/koans/about_asserts.rb +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env ruby -# -*- ruby -*- - -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutAsserts < EdgeCase::Koan - - def test_assert_truth - assert true - end - - def test_assert_with_message - assert true, "This should be true -- Please fix this" - end - - # To understand reality, we must compare our expectations against - # reality. - def test_assert_equality - expected_value = 2 - actual_value = 1 + 1 - - assert expected_value == actual_value - end - - # Some ways of asserting equality are better than others. - def test_a_better_way_of_asserting_equality - expected_value = 2 - actual_value = 1 + 1 - - assert_equal expected_value, actual_value - end - - # Sometimes we will ask you to fill in the values - def test_fill_in_values - assert_equal 2, 1 + 1 - end -end diff --git a/oldstuff/RubyFun/koans/about_blocks.rb b/oldstuff/RubyFun/koans/about_blocks.rb deleted file mode 100644 index 0abee8f..0000000 --- a/oldstuff/RubyFun/koans/about_blocks.rb +++ /dev/null @@ -1,96 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutBlocks < EdgeCase::Koan - def method_with_block - result = yield - result - end - - def test_methods_can_take_blocks - yielded_result = method_with_block { 1 + 2 } - assert_equal __, yielded_result - end - - def test_blocks_can_be_defined_with_do_end_too - yielded_result = method_with_block do 1 + 2 end - assert_equal __, yielded_result - end - - # ------------------------------------------------------------------ - - def method_with_block_arguments - yield("Jim") - end - - def test_blocks_can_take_arguments - result = method_with_block_arguments do |argument| - assert_equal __, argument - end - end - - # ------------------------------------------------------------------ - - def many_yields - yield(:peanut) - yield(:butter) - yield(:and) - yield(:jelly) - end - - def test_methods_can_call_yield_many_times - result = [] - many_yields { |item| result << item } - assert_equal __, result - end - - # ------------------------------------------------------------------ - - def yield_tester - if block_given? - yield - else - :no_block - end - end - - def test_methods_can_see_if_they_have_been_called_with_a_block - assert_equal __, yield_tester { :with_block } - assert_equal __, yield_tester - end - - # ------------------------------------------------------------------ - - def test_block_can_affect_variables_in_the_code_where_they_are_created - value = :initial_value - method_with_block { value = :modified_in_a_block } - assert_equal __, value - end - - def test_blocks_can_be_assigned_to_variables_and_called_explicitly - add_one = lambda { |n| n + 1 } - assert_equal __, add_one.call(10) - - # Alternative calling sequence - assert_equal __, add_one[10] - end - - def test_stand_alone_blocks_can_be_passed_to_methods_expecting_blocks - make_upper = lambda { |n| n.upcase } - result = method_with_block_arguments(&make_upper) - assert_equal __, result - end - - # ------------------------------------------------------------------ - - def method_with_explicit_block(&block) - block.call(10) - end - - def test_methods_can_take_an_explicit_block_argument - assert_equal __, method_with_explicit_block { |n| n * 2 } - - add_one = lambda { |n| n + 1 } - assert_equal __, method_with_explicit_block(&add_one) - end - -end diff --git a/oldstuff/RubyFun/koans/about_class_methods.rb b/oldstuff/RubyFun/koans/about_class_methods.rb deleted file mode 100644 index ddd32bd..0000000 --- a/oldstuff/RubyFun/koans/about_class_methods.rb +++ /dev/null @@ -1,170 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutClassMethods < EdgeCase::Koan - class Dog - end - - def test_objects_are_objects - fido = Dog.new - assert_equal __, fido.is_a?(Object) - end - - def test_classes_are_classes - assert_equal __, Dog.is_a?(Class) - end - - def test_classes_are_objects_too - assert_equal __, Dog.is_a?(Object) - end - - def test_objects_have_methods - fido = Dog.new - assert fido.methods.size > _n_ - end - - def test_classes_have_methods - assert Dog.methods.size > _n_ - end - - def test_you_can_define_methods_on_individual_objects - fido = Dog.new - def fido.wag - :fidos_wag - end - assert_equal __, fido.wag - end - - def test_other_objects_are_not_affected_by_these_singleton_methods - fido = Dog.new - rover = Dog.new - def fido.wag - :fidos_wag - end - - assert_raise(___) do - rover.wag - end - end - - # ------------------------------------------------------------------ - - class Dog2 - def wag - :instance_level_wag - end - end - - def Dog2.wag - :class_level_wag - end - - def test_since_classes_are_objects_you_can_define_singleton_methods_on_them_too - assert_equal __, Dog2.wag - end - - def test_class_methods_are_independent_of_instance_methods - fido = Dog2.new - assert_equal __, fido.wag - assert_equal __, Dog2.wag - end - - # ------------------------------------------------------------------ - - class Dog - attr_accessor :name - end - - def Dog.name - @name - end - - def test_classes_and_instances_do_not_share_instance_variables - fido = Dog.new - fido.name = "Fido" - assert_equal __, fido.name - assert_equal __, Dog.name - end - - # ------------------------------------------------------------------ - - class Dog - def Dog.a_class_method - :dogs_class_method - end - end - - def test_you_can_define_class_methods_inside_the_class - assert_equal __, Dog.a_class_method - end - - - # ------------------------------------------------------------------ - - LastExpressionInClassStatement = class Dog - 21 - end - - def test_class_statements_return_the_value_of_their_last_expression - assert_equal __, LastExpressionInClassStatement - end - - # ------------------------------------------------------------------ - - SelfInsideOfClassStatement = class Dog - self - end - - def test_self_while_inside_class_is_class_object_not_instance - assert_equal __, Dog == SelfInsideOfClassStatement - end - - # ------------------------------------------------------------------ - - class Dog - def self.class_method2 - :another_way_to_write_class_methods - end - end - - def test_you_can_use_self_instead_of_an_explicit_reference_to_dog - assert_equal __, Dog.class_method2 - end - - # ------------------------------------------------------------------ - - class Dog - class << self - def another_class_method - :still_another_way - end - end - end - - def test_heres_still_another_way_to_write_class_methods - assert_equal __, Dog.another_class_method - end - - # THINK ABOUT IT: - # - # The two major ways to write class methods are: - # class Demo - # def self.method - # end - # - # class << self - # def class_methods - # end - # end - # end - # - # Which do you prefer and why? - # Are there times you might prefer one over the other? - - # ------------------------------------------------------------------ - - def test_heres_an_easy_way_to_call_class_methods_from_instance_methods - fido = Dog.new - assert_equal __, fido.class.another_class_method - end - -end diff --git a/oldstuff/RubyFun/koans/about_classes.rb b/oldstuff/RubyFun/koans/about_classes.rb deleted file mode 100644 index fce0be0..0000000 --- a/oldstuff/RubyFun/koans/about_classes.rb +++ /dev/null @@ -1,190 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutClasses < EdgeCase::Koan - class Dog - end - - def test_instances_of_classes_can_be_created_with_new - fido = Dog.new - assert_equal __, fido.class - end - - # ------------------------------------------------------------------ - - class Dog2 - def set_name(a_name) - @name = a_name - end - end - - def test_instance_variables_can_be_set_by_assigning_to_them - fido = Dog2.new - assert_equal __, fido.instance_variables - - fido.set_name("Fido") - assert_equal __, fido.instance_variables - end - - def test_instance_variables_cannot_be_accessed_outside_the_class - fido = Dog2.new - fido.set_name("Fido") - - assert_raise(___) do - fido.name - end - - assert_raise(___) do - eval "fido.@name" - # NOTE: Using eval because the above line is a syntax error. - end - end - - def test_you_can_politely_ask_for_instance_variable_values - fido = Dog2.new - fido.set_name("Fido") - - assert_equal __, fido.instance_variable_get("@name") - end - - def test_you_can_rip_the_value_out_using_instance_eval - fido = Dog2.new - fido.set_name("Fido") - - assert_equal __, fido.instance_eval("@name") # string version - assert_equal __, fido.instance_eval { @name } # block version - end - - # ------------------------------------------------------------------ - - class Dog3 - def set_name(a_name) - @name = a_name - end - def name - @name - end - end - - def test_you_can_create_accessor_methods_to_return_instance_variables - fido = Dog3.new - fido.set_name("Fido") - - assert_equal __, fido.name - end - - # ------------------------------------------------------------------ - - class Dog4 - attr_reader :name - - def set_name(a_name) - @name = a_name - end - end - - - def test_attr_reader_will_automatically_define_an_accessor - fido = Dog4.new - fido.set_name("Fido") - - assert_equal __, fido.name - end - - # ------------------------------------------------------------------ - - class Dog5 - attr_accessor :name - end - - - def test_attr_accessor_will_automatically_define_both_read_and_write_accessors - fido = Dog5.new - - fido.name = "Fido" - assert_equal __, fido.name - end - - # ------------------------------------------------------------------ - - class Dog6 - attr_reader :name - def initialize(initial_name) - @name = initial_name - end - end - - def test_initialize_provides_initial_values_for_instance_variables - fido = Dog6.new("Fido") - assert_equal __, fido.name - end - - def test_args_to_new_must_match_initialize - assert_raise(___) do - Dog6.new - end - # THINK ABOUT IT: - # Why is this so? - end - - def test_different_objects_have_difference_instance_variables - fido = Dog6.new("Fido") - rover = Dog6.new("Rover") - - assert_equal __, rover.name != fido.name - end - - # ------------------------------------------------------------------ - - class Dog7 - attr_reader :name - - def initialize(initial_name) - @name = initial_name - end - - def get_self - self - end - - def to_s - __ - end - - def inspect - "" - end - end - - def test_inside_a_method_self_refers_to_the_containing_object - fido = Dog7.new("Fido") - - fidos_self = fido.get_self - assert_equal __, fidos_self - end - - def test_to_s_provides_a_string_version_of_the_object - fido = Dog7.new("Fido") - assert_equal __, fido.to_s - end - - def test_to_s_is_used_in_string_interpolation - fido = Dog7.new("Fido") - assert_equal __, "My dog is #{fido}" - end - - def test_inspect_provides_a_more_complete_string_version - fido = Dog7.new("Fido") - assert_equal __, fido.inspect - end - - def test_all_objects_support_to_s_and_inspect - array = [1,2,3] - - assert_equal __, array.to_s - assert_equal __, array.inspect - - assert_equal __, "STRING".to_s - assert_equal __, "STRING".inspect - end - -end diff --git a/oldstuff/RubyFun/koans/about_constants.rb b/oldstuff/RubyFun/koans/about_constants.rb deleted file mode 100644 index 0beccdc..0000000 --- a/oldstuff/RubyFun/koans/about_constants.rb +++ /dev/null @@ -1,87 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -C = "top level" - -class AboutConstants < EdgeCase::Koan - - C = "nested" - - def test_nested_constants_may_also_be_referenced_with_relative_paths - assert_equal __, C - end - - def test_top_level_constants_are_referenced_by_double_colons - assert_equal __, ::C - end - - def test_nested_constants_are_referenced_by_their_complete_path - assert_equal __, AboutConstants::C - assert_equal __, ::AboutConstants::C - end - - # ------------------------------------------------------------------ - - class Animal - LEGS = 4 - def legs_in_animal - LEGS - end - - class NestedAnimal - def legs_in_nested_animal - LEGS - end - end - end - - def test_nested_classes_inherit_constants_from_enclosing_classes - assert_equal __, Animal::NestedAnimal.new.legs_in_nested_animal - end - - # ------------------------------------------------------------------ - - class Reptile < Animal - def legs_in_reptile - LEGS - end - end - - def test_subclasses_inherit_constants_from_parent_classes - assert_equal __, Reptile.new.legs_in_reptile - end - - # ------------------------------------------------------------------ - - class MyAnimals - LEGS = 2 - - class Bird < Animal - def legs_in_bird - LEGS - end - end - end - - def test_who_wins_with_both_nested_and_inherited_constants - assert_equal __, MyAnimals::Bird.new.legs_in_bird - end - - # QUESTION: Which has precedence: The constant in the lexical scope, - # or the constant from the inheritance heirarachy? - - # ------------------------------------------------------------------ - - class MyAnimals::Oyster < Animal - def legs_in_oyster - LEGS - end - end - - def test_who_wins_with_explicit_scoping_on_class_definition - assert_equal __, MyAnimals::Oyster.new.legs_in_oyster - end - - # QUESTION: Now Which has precedence: The constant in the lexical - # scope, or the constant from the inheritance heirarachy? Why is it - # different than the previous answer? -end diff --git a/oldstuff/RubyFun/koans/about_control_statements.rb b/oldstuff/RubyFun/koans/about_control_statements.rb deleted file mode 100644 index 768dace..0000000 --- a/oldstuff/RubyFun/koans/about_control_statements.rb +++ /dev/null @@ -1,116 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutControlStatements < EdgeCase::Koan - - def test_if_then_else_statements - if true - result = :true_value - else - result = :false_value - end - assert_equal __, result - end - - def test_if_then_statements - result = :default_value - if true - result = :true_value - end - assert_equal __, result - end - - def test_if_statements_return_values - value = if true - :true_value - else - :false_value - end - assert_equal __, value - - value = if false - :true_value - else - :false_value - end - assert_equal __, value - - # NOTE: Actually, EVERY statement in Ruby will return a value, not - # just if statements. - end - - def test_if_statements_with_no_else_with_false_condition_return_value - value = if false - :true_value - end - assert_equal __, value - end - - def test_condition_operators - assert_equal __, (true ? :true_value : :false_value) - assert_equal __, (false ? :true_value : :false_value) - end - - def test_if_statement_modifiers - result = :default_value - result = :true_value if true - - assert_equal __, result - end - - def test_unless_statement - result = :default_value - unless false - result = :false_value - end - assert_equal __, result - end - - def test_unless_statement_modifier - result = :default_value - result = :false_value unless false - - assert_equal __, result - end - - def test_while_statement - i = 1 - result = 1 - while i <= 10 - result = result * i - i += 1 - end - assert_equal __, result - end - - def test_break_statement - i = 1 - result = 1 - while true - break unless i <= 10 - result = result * i - i += 1 - end - assert_equal __, result - end - - def test_next_statement - i = 0 - result = [] - while i < 10 - i += 1 - next if (i % 2) == 0 - result << i - end - assert_equal __, result - end - - def test_for_statement - array = ["fish", "and", "chips"] - result = [] - for item in array - result << item.upcase - end - assert_equal [__, __, __], result - end - -end diff --git a/oldstuff/RubyFun/koans/about_dice_project.rb b/oldstuff/RubyFun/koans/about_dice_project.rb deleted file mode 100644 index ce81715..0000000 --- a/oldstuff/RubyFun/koans/about_dice_project.rb +++ /dev/null @@ -1,63 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -# Implement a DiceSet Class here: -# -# class DiceSet -# code ... -# end - -class AboutDiceProject < EdgeCase::Koan - def test_can_create_a_dice_set - dice = DiceSet.new - assert_not_nil dice - end - - def test_rolling_the_dice_returns_a_set_of_integers_between_1_and_6 - dice = DiceSet.new - - dice.roll(5) - assert dice.values.is_a?(Array), "should be an array" - assert_equal 5, dice.values.size - dice.values.each do |value| - assert value >= 1 && value <= 6, "value #{value} must be between 1 and 6" - end - end - - def test_dice_values_do_not_change_unless_explicitly_rolled - dice = DiceSet.new - dice.roll(5) - first_time = dice.values - second_time = dice.values - assert_equal first_time, second_time - end - - def test_dice_values_should_change_between_rolls - dice = DiceSet.new - - dice.roll(5) - first_time = dice.values - - dice.roll(5) - second_time = dice.values - - assert_not_equal first_time, second_time, - "Two rolls should not be equal" - - # THINK ABOUT IT: - # - # If the rolls are random, then it is possible (although not - # likely) that two consecutive rolls are equal. What would be a - # better way to test this. - end - - def test_you_can_roll_different_numbers_of_dice - dice = DiceSet.new - - dice.roll(3) - assert_equal 3, dice.values.size - - dice.roll(1) - assert_equal 1, dice.values.size - end - -end diff --git a/oldstuff/RubyFun/koans/about_exceptions.rb b/oldstuff/RubyFun/koans/about_exceptions.rb deleted file mode 100644 index d745f96..0000000 --- a/oldstuff/RubyFun/koans/about_exceptions.rb +++ /dev/null @@ -1,68 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutExceptions < EdgeCase::Koan - - class MySpecialError < RuntimeError - end - - def test_exceptions_inherit_from_Exception - assert_equal __, MySpecialError.ancestors[1] - assert_equal __, MySpecialError.ancestors[2] - assert_equal __, MySpecialError.ancestors[3] - assert_equal __, MySpecialError.ancestors[4] - end - - def test_rescue_clause - result = nil - begin - fail "Oops" - rescue StandardError => ex - result = :exception_handled - end - - assert_equal __, result - - assert_equal __, ex.is_a?(StandardError), "Should be a Standard Error" - assert_equal __, ex.is_a?(RuntimeError), "Should be a Runtime Error" - - assert RuntimeError.ancestors.include?(StandardError), - "RuntimeError is a subclass of StandardError" - - assert_equal __, ex.message - end - - def test_raising_a_particular_error - result = nil - begin - # 'raise' and 'fail' are synonyms - raise MySpecialError, "My Message" - rescue MySpecialError => ex - result = :exception_handled - end - - assert_equal __, result - assert_equal __, ex.message - end - - def test_ensure_clause - result = nil - begin - fail "Oops" - rescue StandardError => ex - # no code here - ensure - result = :always_run - end - - assert_equal __, result - end - - # Sometimes, we must know about the unknown - def test_asserting_an_error_is_raised - # A do-end is a block, a topic to explore more later - assert_raise(___) do - raise MySpecialError.new("New instances can be raised directly.") - end - end - -end diff --git a/oldstuff/RubyFun/koans/about_extra_credit.rb b/oldstuff/RubyFun/koans/about_extra_credit.rb deleted file mode 100644 index 5012edf..0000000 --- a/oldstuff/RubyFun/koans/about_extra_credit.rb +++ /dev/null @@ -1,8 +0,0 @@ -# EXTRA CREDIT: -# -# Create a program that will play the Greed Game. -# Rules for the game are in GREED_RULES.TXT. -# -# You already have a DiceSet class and score function you can use. -# Write a player class and a Game class to complete the project. This -# is a free form assignment, so approach it however you desire. diff --git a/oldstuff/RubyFun/koans/about_hashes.rb b/oldstuff/RubyFun/koans/about_hashes.rb deleted file mode 100644 index 3e4e62c..0000000 --- a/oldstuff/RubyFun/koans/about_hashes.rb +++ /dev/null @@ -1,66 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutHashes < EdgeCase::Koan - def test_creating_hashes - empty_hash = Hash.new - assert_equal __, empty_hash.class - assert_equal({}, empty_hash) - assert_equal __, empty_hash.size - end - - def test_hash_literals - hash = { :one => "uno", :two => "dos" } - assert_equal __, hash.size - end - - def test_accessing_hashes - hash = { :one => "uno", :two => "dos" } - assert_equal __, hash[:one] - assert_equal __, hash[:two] - assert_equal __, hash[:doesnt_exist] - end - - def test_changing_hashes - hash = { :one => "uno", :two => "dos" } - hash[:one] = "eins" - - expected = { :one => __, :two => "dos" } - assert_equal __, expected == hash - - # Bonus Question: Why was "expected" broken out into a variable - # rather than used as a literal? - end - - def test_hash_is_unordered - hash1 = { :one => "uno", :two => "dos" } - hash2 = { :two => "dos", :one => "uno" } - - assert_equal __, hash1 == hash2 - end - - def test_hash_keys - hash = { :one => "uno", :two => "dos" } - assert_equal __, hash.keys.size - assert_equal __, hash.keys.include?(:one) - assert_equal __, hash.keys.include?(:two) - assert_equal __, hash.keys.class - end - - def test_hash_values - hash = { :one => "uno", :two => "dos" } - assert_equal __, hash.values.size - assert_equal __, hash.values.include?("uno") - assert_equal __, hash.values.include?("dos") - assert_equal __, hash.values.class - end - - def test_combining_hashes - hash = { "jim" => 53, "amy" => 20, "dan" => 23 } - new_hash = hash.merge({ "jim" => 54, "jenny" => 26 }) - - assert_equal __, hash != new_hash - - expected = { "jim" => __, "amy" => 20, "dan" => 23, "jenny" => __ } - assert_equal __, expected == new_hash - end -end diff --git a/oldstuff/RubyFun/koans/about_inheritance.rb b/oldstuff/RubyFun/koans/about_inheritance.rb deleted file mode 100644 index cafec34..0000000 --- a/oldstuff/RubyFun/koans/about_inheritance.rb +++ /dev/null @@ -1,85 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutInheritance < EdgeCase::Koan - class Dog - attr_reader :name - - def initialize(name) - @name = name - end - - def bark - "WOOF" - end - end - - class Chihuahua < Dog - def wag - :happy - end - - def bark - "yip" - end - end - - def test_subclasses_have_the_parent_as_an_ancestor - assert_equal __, Chihuahua.ancestors.include?(Dog) - end - - def test_all_classes_ultimately_inherit_from_object - assert_equal __, Chihuahua.ancestors.include?(Object) - end - - def test_subcases_inherit_behavior_from_parent_class - chico = Chihuahua.new("Chico") - assert_equal __, chico.name - end - - def test_subclasses_add_new_behavior - chico = Chihuahua.new("Chico") - assert_equal __, chico.wag - - assert_raise(___) do - fido = Dog.new("Fido") - fido.wag - end - end - - def test_subclasses_can_modify_existing_behavior - chico = Chihuahua.new("Chico") - assert_equal __, chico.bark - - fido = Dog.new("Fido") - assert_equal __, fido.bark - end - - # ------------------------------------------------------------------ - - class BullDog < Dog - def bark - super + ", GROWL" - end - end - - def test_subclasses_can_invoke_parent_behavior_via_super - ralph = BullDog.new("Ralph") - assert_equal __, ralph.bark - end - - # ------------------------------------------------------------------ - - class GreatDane < Dog - def growl - super.bark + ", GROWL" - end - end - - def test_super_does_not_work_cross_method - george = GreatDane.new("George") - assert_raise(___) do - george.growl - end - end - -end diff --git a/oldstuff/RubyFun/koans/about_iteration.rb b/oldstuff/RubyFun/koans/about_iteration.rb deleted file mode 100644 index 591b869..0000000 --- a/oldstuff/RubyFun/koans/about_iteration.rb +++ /dev/null @@ -1,103 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutIteration < EdgeCase::Koan - - def test_each_is_a_method_on_arrays - [].methods.include?("each") - end - - def test_iterating_with_each - array = [1, 2, 3] - sum = 0 - array.each do |item| - sum += item - end - assert_equal __, sum - end - - def test_each_can_use_curly_brace_blocks_too - array = [1, 2, 3] - sum = 0 - array.each { |item| - sum += item - } - assert_equal __, sum - end - - def test_break_works_with_each_style_iterations - array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - sum = 0 - array.each { |item| - break if item > 3 - sum += item - } - assert_equal __, sum - end - - def test_collect_transforms_elements_of_an_array - array = [1, 2, 3] - new_array = array.collect { |item| item + 10 } - assert_equal __, new_array - - # NOTE: 'map' is another name for the 'collect' operation - another_array = array.map { |item| item + 10 } - assert_equal __, another_array - end - - def test_select_selects_certain_items_from_an_array - array = [1, 2, 3, 4, 5, 6] - - even_numbers = array.select { |item| (item % 2) == 0 } - assert_equal __, even_numbers - - # NOTE: 'find_all' is another name for the 'select' operation - more_even_numbers = array.find_all { |item| (item % 2) == 0 } - assert_equal __, more_even_numbers - end - - def test_find_locates_the_first_element_matching_a_criteria - array = ["Jim", "Bill", "Clarence", "Doug", "Eli"] - - assert_equal __, array.find { |item| item.size > 4 } - end - - def test_inject_will_blow_your_mind - result = [2, 3, 4].inject(0) { |sum, item| sum + item } - assert_equal __, result - - result2 = [2, 3, 4].inject(1) { |sum, item| sum * item } - assert_equal __, result2 - - # Extra Credit: - # Describe in your own words what inject does. - end - - def test_all_iteration_methods_work_on_any_collection_not_just_arrays - # Ranges act like a collection - result = (1..3).map { |item| item + 10 } - assert_equal __, result - - # Files act like a collection of lines - File.open("example_file.txt") do |file| - upcase_lines = file.map { |line| line.strip.upcase } - assert_equal __, upcase_lines - end - - # NOTE: You can create your own collections that work with each, - # map, select, etc. - end - - # Bonus Question: In the previous koan, we saw the construct: - # - # File.open(filename) do |file| - # # code to read 'file' - # end - # - # Why did we do it that way instead of the following? - # - # file = File.open(filename) - # # code to read 'file' - # - # When you get to the "AboutSandwichCode" koan, recheck your answer. - -end diff --git a/oldstuff/RubyFun/koans/about_java_interop.rb b/oldstuff/RubyFun/koans/about_java_interop.rb deleted file mode 100644 index 2a58e40..0000000 --- a/oldstuff/RubyFun/koans/about_java_interop.rb +++ /dev/null @@ -1,137 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -include Java - -# Concepts -# * Pull in a java class -# * calling a method, Camel vs snake -# * Resovling module/class name conflicts -# * Showing what gets returned -# * Ruby Strings VS Java Strings -# * Calling custom java class -# * Calling Ruby from java??? - -class AboutJavaInterop < EdgeCase::Koan - def test_using_a_java_library_class - java_array = java.util.ArrayList.new - assert_equal __, java_array.class - end - - def test_java_class_can_be_referenced_using_both_ruby_and_java_like_syntax - assert_equal __, Java::JavaUtil::ArrayList == java.util.ArrayList - end - - def test_include_class_includes_class_in_module_scope - assert_nil defined?(TreeSet) - include_class "java.util.TreeSet" - assert_equal __, defined?(TreeSet) - end - - # THINK ABOUT IT: - # - # What if we use: - # - # include_class "java.lang.String" - # - # What would be the value of the String constant after this - # include_class is run? Would it be useful to provide a way of - # aliasing java classes to different names? - - JString = java.lang.String - def test_also_java_class_can_be_given_ruby_aliases - java_string = JString.new("A Java String") - assert_equal __, java_string.class - assert_equal __, JString - end - - def test_can_directly_call_java_methods_on_java_objects - java_string = JString.new("A Java String") - assert_equal __, java_string.toLowerCase - end - - def test_jruby_provides_snake_case_versions_of_java_methods - java_string = JString.new("A Java String") - assert_equal __, java_string.to_lower_case - end - - def test_jruby_provides_question_mark_versions_of_boolean_methods - java_string = JString.new("A Java String") - assert_equal __, java_string.endsWith("String") - assert_equal __, java_string.ends_with("String") - assert_equal __, java_string.ends_with?("String") - end - - def test_java_string_are_not_ruby_strings - ruby_string = "A Java String" - java_string = java.lang.String.new(ruby_string) - assert_equal __, java_string.is_a?(java.lang.String) - assert_equal __, java_string.is_a?(String) - end - - def test_java_strings_can_be_compared_to_ruby_strings_maybe - ruby_string = "A Java String" - java_string = java.lang.String.new(ruby_string) - assert_equal __, ruby_string == java_string - assert_equal __, java_string == ruby_string - - # THINK ABOUT IT: - # - # Is there any possible way for this to be more wrong? - # - # SERIOUSLY, THINK ABOUT IT: - # - # Why do you suppose that Ruby and Java strings compare like that? - # - # ADVANCED THINK ABOUT IT: - # - # Is there a way to make Ruby/Java string comparisons commutative? - # How would you do it? - end - - def test_however_most_methods_returning_strings_return_ruby_strings - java_array = java.util.ArrayList.new - assert_equal __, java_array.toString - assert_equal __, java_array.toString.is_a?(String) - assert_equal __, java_array.toString.is_a?(java.lang.String) - end - - def test_some_ruby_objects_can_be_coerced_to_java - assert_equal __, "ruby string".to_java.class - assert_equal __, 1.to_java.class - assert_equal __, 9.32.to_java.class - assert_equal __, false.to_java.class - end - - def test_some_ruby_objects_are_not_coerced_to_what_you_might_expect - assert_equal __, [].to_java.class == Java::JavaUtil::ArrayList - assert_equal __, {}.to_java.class == Java::JavaUtil::HashMap - assert_equal __, Object.new.to_java.class == Java::JavaLang::Object - end - - def test_java_collections_are_enumerable - java_array = java.util.ArrayList.new - java_array << "one" << "two" << "three" - assert_equal __, java_array.map { |item| item.upcase } - end - - # ------------------------------------------------------------------ - - # Open the Java ArrayList class and add a new method. - class Java::JavaUtil::ArrayList - def multiply_all - result = 1 - each do |item| - result *= item - end - result - end - end - - def test_java_class_are_open_from_ruby - java_array = java.util.ArrayList.new - java_array.add_all([1,2,3,4,5]) - - assert_equal __, java_array.multiply_all - end - -end diff --git a/oldstuff/RubyFun/koans/about_message_passing.rb b/oldstuff/RubyFun/koans/about_message_passing.rb deleted file mode 100644 index 45541a0..0000000 --- a/oldstuff/RubyFun/koans/about_message_passing.rb +++ /dev/null @@ -1,178 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutMessagePassing < EdgeCase::Koan - - class MessageCatcher - def caught? - true - end - end - - def test_methods_can_be_called_directly - mc = MessageCatcher.new - - assert mc.caught? - end - - def test_methods_can_be_invoked_by_sending_the_message - mc = MessageCatcher.new - - assert mc.send(:caught?) - end - - def test_methods_can_be_invoked_more_dynamically - mc = MessageCatcher.new - - assert mc.send("caught?") - assert mc.send("caught" + __ ) # What do you need to add to the first string? - assert mc.send("CAUGHT?".____ ) # What would you need to do to the string? - end - - def test_send_with_underscores_will_also_send_messages - mc = MessageCatcher.new - - assert_equal __, mc.__send__(:caught?) - - # THINK ABOUT IT: - # - # Why does Ruby provide both send and __send__ ? - end - - def test_classes_can_be_asked_if_they_know_how_to_respond - mc = MessageCatcher.new - - assert_equal __, mc.respond_to?(:caught?) - assert_equal __, mc.respond_to?(:does_not_exist) - end - - # ------------------------------------------------------------------ - - class MessageCatcher - def add_a_payload(*args) - args - end - end - - def test_sending_a_message_with_arguments - mc = MessageCatcher.new - - assert_equal __, mc.add_a_payload - assert_equal __, mc.send(:add_a_payload) - - assert_equal __, mc.add_a_payload(3, 4, nil, 6) - assert_equal __, mc.send(:add_a_payload, 3, 4, nil, 6) - end - - # ------------------------------------------------------------------ - - class TypicalObject - end - - def test_sending_undefined_messages_to_a_typical_object_results_in_errors - typical = TypicalObject.new - - exception = assert_raise(___) do - typical.foobar - end - assert_match(/foobar/, exception.message) - end - - def test_calling_method_missing_causes_the_no_method_error - typical = TypicalObject.new - - exception = assert_raise(___) do - typical.method_missing(:foobar) - end - assert_match(/foobar/, exception.message) - - # THINK ABOUT IT: - # - # If the method :method_missing causes the NoMethodError, then - # what would happen if we redefine method_missing? - # - # NOTE: - # - # In Ruby 1.8 the method_missing method is public and can be - # called as shown above. However, in Ruby 1.9 the method_missing - # method is private. We explicitly made it public in the testing - # framework so this example works in both versions of Ruby. Just - # keep in mind you can't call method_missing like that in Ruby - # 1.9. normally. - # - # Thanks. We now return you to your regularly schedule Ruby - # Koans. - end - - # ------------------------------------------------------------------ - - class AllMessageCatcher - def method_missing(method_name, *args, &block) - "Someone called #{method_name} with <#{args.join(", ")}>" - end - end - - def test_all_messages_are_caught - catcher = AllMessageCatcher.new - - assert_equal __, catcher.foobar - assert_equal __, catcher.foobaz(1) - assert_equal __, catcher.sum(1,2,3,4,5,6) - end - - def test_catching_messages_makes_respond_to_lie - catcher = AllMessageCatcher.new - - assert_nothing_raised(NoMethodError) do - catcher.any_method - end - assert_equal __, catcher.respond_to?(:any_method) - end - - # ------------------------------------------------------------------ - - class WellBehavedFooCatcher - def method_missing(method_name, *args, &block) - if method_name.to_s[0,3] == "foo" - "Foo to you too" - else - super(method_name, *args, &block) - end - end - end - - def test_foo_method_are_caught - catcher = WellBehavedFooCatcher.new - - assert_equal __, catcher.foo_bar - assert_equal __, catcher.foo_baz - end - - def test_non_foo_messages_are_treated_normally - catcher = WellBehavedFooCatcher.new - - assert_raise(___) do - catcher.normal_undefined_method - end - end - - # ------------------------------------------------------------------ - - # (note: just reopening class from above) - class WellBehavedFooCatcher - def respond_to?(method_name) - if method_name.to_s[0,3] == "foo" - true - else - super(method_name) - end - end - end - - def test_explicitly_implementing_respond_to_lets_objects_tell_the_truth - catcher = WellBehavedFooCatcher.new - - assert_equal __, catcher.respond_to?(:foo_bar) - assert_equal __, catcher.respond_to?(:something_else) - end - -end diff --git a/oldstuff/RubyFun/koans/about_methods.rb b/oldstuff/RubyFun/koans/about_methods.rb deleted file mode 100644 index d36e9ab..0000000 --- a/oldstuff/RubyFun/koans/about_methods.rb +++ /dev/null @@ -1,150 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -def my_global_method(a,b) - a + b -end - -class AboutMethods < EdgeCase::Koan - - def test_calling_global_methods - assert_equal __, my_global_method(2,3) - end - - def test_calling_global_methods_without_parentheses - result = my_global_method 2, 3 - assert_equal __, result - end - - # (NOTE: We are Using eval below because the example code is - # considered to be syntactically invalid). - def test_sometimes_missing_parentheses_are_ambiguous - eval "assert_equal 5, my_global_method 2, 3" # ENABLE CHECK - # - # Ruby doesn't know if you mean: - # - # assert_equal(5, my_global_method(2), 3) - # or - # assert_equal(5, my_global_method(2, 3)) - # - # Rewrite the eval string to continue. - # - end - - # NOTE: wrong number of argument is not a SYNTAX error, but a - # runtime error. - def test_calling_global_methods_with_wrong_number_of_arguments - exception = assert_raise(___) do - my_global_method - end - assert_match(/__/, exception.message) - - exception = assert_raise(___) do - my_global_method(1,2,3) - end - assert_match(/__/, exception.message) - end - - # ------------------------------------------------------------------ - - def method_with_defaults(a, b=:default_value) - [a, b] - end - - def test_calling_with_default_values - assert_equal [1, __], method_with_defaults(1) - assert_equal [1, __], method_with_defaults(1, 2) - end - - # ------------------------------------------------------------------ - - def method_with_var_args(*args) - args - end - - def test_calling_with_variable_arguments - assert_equal __, method_with_var_args - assert_equal __, method_with_var_args(:one) - assert_equal __, method_with_var_args(:one, :two) - end - - # ------------------------------------------------------------------ - - def method_with_explicit_return - :a_non_return_value - return :return_value - :another_non_return_value - end - - def test_method_with_explicit_return - assert_equal __, method_with_explicit_return - end - - # ------------------------------------------------------------------ - - def method_without_explicit_return - :a_non_return_value - :return_value - end - - def test_method_without_explicit_return - assert_equal __, method_without_explicit_return - end - - # ------------------------------------------------------------------ - - def my_same_class_method(a, b) - a * b - end - - def test_calling_methods_in_same_class - assert_equal __, my_same_class_method(3,4) - end - - def test_calling_methods_in_same_class_with_explicit_receiver - assert_equal __, self.my_same_class_method(3,4) - end - - # ------------------------------------------------------------------ - - def my_private_method - "a secret" - end - private :my_private_method - - def test_calling_private_methods_without_receiver - assert_equal __, my_private_method - end - - def test_calling_private_methods_with_an_explicit_receiver - exception = assert_raise(___) do - self.my_private_method - end - assert_match /__/, exception.message - end - - # ------------------------------------------------------------------ - - class Dog - def name - "Fido" - end - - private - - def tail - "tail" - end - end - - def test_calling_methods_in_other_objects_require_explicit_receiver - rover = Dog.new - assert_equal __, rover.name - end - - def test_calling_private_methods_in_other_objects - rover = Dog.new - assert_raise(___) do - rover.tail - end - end -end diff --git a/oldstuff/RubyFun/koans/about_modules.rb b/oldstuff/RubyFun/koans/about_modules.rb deleted file mode 100644 index cd967a9..0000000 --- a/oldstuff/RubyFun/koans/about_modules.rb +++ /dev/null @@ -1,63 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutModules < EdgeCase::Koan - module Nameable - def set_name(new_name) - @name = new_name - end - - def here - :in_module - end - end - - def test_cant_instantiate_modules - assert_raise(___) do - Nameable.new - end - end - - # ------------------------------------------------------------------ - - class Dog - include Nameable - - attr_reader :name - - def initialize - @name = "Fido" - end - - def bark - "WOOF" - end - - def here - :in_object - end - end - - def test_normal_methods_are_available_in_the_object - fido = Dog.new - assert_equal __, fido.bark - end - - def test_module_methods_are_also_availble_in_the_object - fido = Dog.new - assert_nothing_raised(Exception) do - fido.set_name("Rover") - end - end - - def test_module_methods_can_affect_instance_variables_in_the_object - fido = Dog.new - assert_equal __, fido.name - fido.set_name("Rover") - assert_equal __, fido.name - end - - def test_classes_can_override_module_methods - fido = Dog.new - assert_equal __, fido.here - end -end diff --git a/oldstuff/RubyFun/koans/about_nil.rb b/oldstuff/RubyFun/koans/about_nil.rb deleted file mode 100644 index 5e1e28b..0000000 --- a/oldstuff/RubyFun/koans/about_nil.rb +++ /dev/null @@ -1,38 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutNil < EdgeCase::Koan - def test_nil_is_an_object - assert_equal __, nil.is_a?(Object), "Unlike NULL in other languages" - end - - def test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil - # What happens when you call a method that doesn't exist. The - # following begin/rescue/end code block captures the exception and - # make some assertions about it. - begin - nil.some_method_nil_doesnt_know_about - rescue Exception => ex - # What exception has been caught? - assert_equal __, ex.class - - # What message was attached to the exception? - # (HINT: replace __ with part of the error message.) - assert_match(/__/, ex.message) - end - end - - def test_nil_has_a_few_methods_defined_on_it - assert_equal __, nil.nil? - assert_equal __, nil.to_s - assert_equal __, nil.inspect - - # THINK ABOUT IT: - # - # Is it better to use - # obj.nil? - # or - # obj == nil - # Why? - end - -end diff --git a/oldstuff/RubyFun/koans/about_objects.rb b/oldstuff/RubyFun/koans/about_objects.rb deleted file mode 100644 index 05c44de..0000000 --- a/oldstuff/RubyFun/koans/about_objects.rb +++ /dev/null @@ -1,56 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutObjects < EdgeCase::Koan - def test_everything_is_an_object - assert_equal __, 1.is_a?(Object) - assert_equal __, 1.5.is_a?(Object) - assert_equal __, "string".is_a?(Object) - assert_equal __, nil.is_a?(Object) - assert_equal __, Object.is_a?(Object) - end - - def test_objects_can_be_converted_to_strings - assert_equal __, 123.to_s - assert_equal __, nil.to_s - end - - def test_objects_can_be_inspected - assert_equal __, 123.inspect - assert_equal __, nil.inspect - end - - def test_every_object_has_an_id - obj = Object.new - assert_equal __, obj.object_id.class - end - - def test_every_object_has_different_id - obj = Object.new - another_obj = Object.new - assert_equal __, obj.object_id != another_obj.object_id - end - - def test_some_system_objects_always_have_the_same_id - assert_equal __, false.object_id - assert_equal __, true.object_id - assert_equal __, nil.object_id - end - - def test_small_integers_have_fixed_ids - assert_equal __, 0.object_id - assert_equal __, 1.object_id - assert_equal __, 2.object_id - assert_equal __, 100.object_id - - # THINK ABOUT IT: - # What pattern do the object IDs for small integers follow? - end - - def test_clone_creates_a_different_object - obj = Object.new - copy = obj.clone - - assert_equal __, obj != copy - assert_equal __, obj.object_id != copy.object_id - end -end diff --git a/oldstuff/RubyFun/koans/about_open_classes.rb b/oldstuff/RubyFun/koans/about_open_classes.rb deleted file mode 100644 index afef1f9..0000000 --- a/oldstuff/RubyFun/koans/about_open_classes.rb +++ /dev/null @@ -1,45 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutOpenClasses < EdgeCase::Koan - class Dog - def bark - "WOOF" - end - end - - def test_as_defined_dogs_do_bark - fido = Dog.new - assert_equal __, fido.bark - end - - # ------------------------------------------------------------------ - - # Open the existing Dog class and add a new method. - class Dog - def wag - "HAPPY" - end - end - - def test_after_reopening_dogs_can_both_wag_and_bark - fido = Dog.new - assert_equal __, fido.wag - assert_equal __, fido.bark - end - - # ------------------------------------------------------------------ - - class ::Integer - def even? - (self % 2) == 0 - end - end - - def test_even_existing_built_in_classes_can_be_reopened - assert_equal __, 1.even? - assert_equal __, 2.even? - end - - # NOTE: To understand why we need the :: before Integer, you need to - # become enlightened about scope. -end diff --git a/oldstuff/RubyFun/koans/about_proxy_object_project.rb b/oldstuff/RubyFun/koans/about_proxy_object_project.rb deleted file mode 100644 index a959a80..0000000 --- a/oldstuff/RubyFun/koans/about_proxy_object_project.rb +++ /dev/null @@ -1,154 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -# Project: Create a Proxy Class -# -# In this assignment, create a proxy class (one is started for you -# below). You should be able to initialize the proxy object with any -# object. Any messages sent to the proxy object should be forwarded -# to the target object. As each message is sent, the proxy should -# record the name of the method send. -# -# The proxy class is started for you. You will need to add a method -# missing handler and any other supporting methods. The specification -# of the Proxy class is given in the AboutProxyObjectProject koan. - -class Proxy - def initialize(target_object) - @object = target_object - # ADD MORE CODE HERE - end - - # WRITE CODE HERE -end - -# The proxy object should pass the following Koan: -# -class AboutProxyObjectProject < EdgeCase::Koan - def test_proxy_method_returns_wrapped_object - # NOTE: The Television class is defined below - tv = Proxy.new(Television.new) - - assert tv.instance_of?(Proxy) - end - - def test_tv_methods_still_perform_their_function - tv = Proxy.new(Television.new) - - tv.channel = 10 - tv.power - - assert_equal 10, tv.channel - assert tv.on? - end - - def test_proxy_records_messages_sent_to_tv - tv = Proxy.new(Television.new) - - tv.power - tv.channel = 10 - - assert_equal [:power, :channel=], tv.messages - end - - def test_proxy_handles_invalid_messages - tv = Proxy.new(Television.new) - - assert_raise(NoMethodError) do - tv.no_such_method - end - end - - def test_proxy_reports_methods_have_been_called - tv = Proxy.new(Television.new) - - tv.power - tv.power - - assert tv.called?(:power) - assert ! tv.called?(:channel) - end - - def test_proxy_counts_method_calls - tv = Proxy.new(Television.new) - - tv.power - tv.channel = 48 - tv.power - - assert_equal 2, tv.number_of_times_called(:power) - assert_equal 1, tv.number_of_times_called(:channel=) - assert_equal 0, tv.number_of_times_called(:on?) - end - - def test_proxy_can_record_more_than_just_tv_objects - proxy = Proxy.new("Code Mash 2009") - - proxy.upcase! - result = proxy.split - - assert_equal ["CODE", "MASH", "2009"], result - assert_equal [:upcase!, :split], proxy.messages - end -end - - -# ==================================================================== -# The following code is to support the testing of the Proxy class. No -# changes should be necessary to anything below this comment. - -# Example class using in the proxy testing above. -class Television - attr_accessor :channel - - def power - if @power == :on - @power = :off - else - @power = :on - end - end - - def on? - @power == :on - end -end - -# Tests for the Television class. All of theses tests should pass. -class TelevisionTest < EdgeCase::Koan - def test_it_turns_on - tv = Television.new - - tv.power - assert tv.on? - end - - def test_it_also_turns_off - tv = Television.new - - tv.power - tv.power - - assert ! tv.on? - end - - def test_edge_case_on_off - tv = Television.new - - tv.power - tv.power - tv.power - - assert tv.on? - - tv.power - - assert ! tv.on? - end - - def test_can_set_the_channel - tv = Television.new - - tv.channel = 11 - assert_equal 11, tv.channel - end -end diff --git a/oldstuff/RubyFun/koans/about_regular_expressions.rb b/oldstuff/RubyFun/koans/about_regular_expressions.rb deleted file mode 100644 index 8344911..0000000 --- a/oldstuff/RubyFun/koans/about_regular_expressions.rb +++ /dev/null @@ -1,159 +0,0 @@ -# -*- coding: utf-8 -*- -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutRegularExpressions < EdgeCase::Koan - def test_a_pattern_is_a_regular_expression - assert_equal __, /pattern/.class - end - - def test_a_regexp_can_search_a_string_for_matching_content - assert_equal __, "some matching content"[/match/] - end - - def test_a_failed_match_returns_nil - assert_equal __, "some matching content"[/missing/] - end - - # ------------------------------------------------------------------ - - def test_question_mark_means_optional - assert_equal __, "abbcccddddeeeee"[/ab?/] - assert_equal __, "abbcccddddeeeee"[/az?/] - end - - def test_plus_means_one_or_more - assert_equal __, "abbcccddddeeeee"[/bc+/] - end - - def test_asterisk_means_zero_or_more - assert_equal __, "abbcccddddeeeee"[/ab*/] - assert_equal __, "abbcccddddeeeee"[/az*/] - assert_equal __, "abbcccddddeeeee"[/z*/] - - # THINK ABOUT IT: - # - # When would * fail to match? - end - - # THINK ABOUT IT: - # - # We say that the repetition operators above are "greedy." - # - # Why? - - # ------------------------------------------------------------------ - - def test_the_left_most_match_wins - assert_equal __, "abbccc az"[/az*/] - end - - # ------------------------------------------------------------------ - - def test_character_classes_give_options_for_a_character - animals = ["cat", "bat", "rat", "zat"] - assert_equal __, animals.select { |a| a[/[cbr]at/] } - end - - def test_slash_d_is_a_shortcut_for_a_digit_character_class - assert_equal __, "the number is 42"[/[0123456789]+/] - assert_equal __, "the number is 42"[/\d+/] - end - - def test_character_classes_can_include_ranges - assert_equal __, "the number is 42"[/[0-9]+/] - end - - def test_slash_s_is_a_shortcut_for_a_whitespace_character_class - assert_equal __, "space: \t\n"[/\s+/] - end - - def test_slash_w_is_a_shortcut_for_a_word_character_class - # NOTE: This is more like how a programmer might define a word. - assert_equal __, "variable_1 = 42"[/[a-zA-Z0-9_]+/] - assert_equal __, "variable_1 = 42"[/\w+/] - end - - def test_period_is_a_shortcut_for_any_non_newline_character - assert_equal __, "abc\n123"[/a.+/] - end - - def test_a_character_class_can_be_negated - assert_equal __, "the number is 42"[/[^0-9]+/] - end - - def test_shortcut_character_classes_are_negated_with_capitals - assert_equal __, "the number is 42"[/\D+/] - assert_equal __, "space: \t\n"[/\S+/] - assert_equal __, "variable_1 = 42"[/\W+/] - end - - # ------------------------------------------------------------------ - - def test_slash_a_anchors_to_the_start_of_the_string - assert_equal __, "start end"[/\Astart/] - assert_equal __, "start end"[/\Aend/] - end - - def test_slash_z_anchors_to_the_end_of_the_string - assert_equal __, "start end"[/end\z/] - assert_equal __, "start end"[/start\z/] - end - - def test_caret_anchors_to_the_start_of_lines - assert_equal __, "num 42\n2 lines"[/^\d+/] - end - - def test_dollar_sign_anchors_to_the_end_of_lines - assert_equal __, "2 lines\nnum 42"[/\d+$/] - end - - def test_slash_b_anchors_to_a_word_boundary - assert_equal __, "bovine vines"[/\bvine./] - end - - # ------------------------------------------------------------------ - - def test_parentheses_group_contents - assert_equal __, "ahahaha"[/(ha)+/] - end - - # ------------------------------------------------------------------ - - def test_parentheses_also_capture_matched_content_by_number - assert_equal __, "Gray, James"[/(\w+), (\w+)/, 1] - assert_equal __, "Gray, James"[/(\w+), (\w+)/, 2] - end - - def test_variables_can_also_be_used_to_access_captures - assert_equal __, "Name: Gray, James"[/(\w+), (\w+)/] - assert_equal __, $1 - assert_equal __, $2 - end - - # ------------------------------------------------------------------ - - def test_a_vertical_pipe_means_or - grays = /(James|Dana|Summer) Gray/ - assert_equal __, "James Gray"[grays] - assert_equal __, "Summer Gray"[grays, 1] - assert_equal __, "Jim Gray"[grays, 1] - end - - # THINK ABOUT IT: - # - # Explain the difference between a character class ([...]) and alternation (|). - - # ------------------------------------------------------------------ - - def test_scan_is_like_find_all - assert_equal __, "one two-three".scan(/\w+/) - end - - def test_sub_is_like_find_and_replace - assert_equal __, "one two-three".sub(/(t\w*)/) { $1[0, 1] } - end - - def test_gsub_is_like_find_and_replace_all - assert_equal __, "one two-three".gsub(/(t\w*)/) { $1[0, 1] } - end -end diff --git a/oldstuff/RubyFun/koans/about_sandwich_code.rb b/oldstuff/RubyFun/koans/about_sandwich_code.rb deleted file mode 100644 index 614a374..0000000 --- a/oldstuff/RubyFun/koans/about_sandwich_code.rb +++ /dev/null @@ -1,106 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutSandwichCode < EdgeCase::Koan - - def count_lines(file_name) - file = open(file_name) - count = 0 - while line = file.gets - count += 1 - end - count - ensure - file.close if file - end - - def test_counting_lines - assert_equal __, count_lines("example_file.txt") - end - - # ------------------------------------------------------------------ - - def find_line(file_name) - file = open(file_name) - while line = file.gets - return line if line.match(/e/) - end - ensure - file.close if file - end - - def test_finding_lines - assert_equal __, find_line("example_file.txt") - end - - # ------------------------------------------------------------------ - # THINK ABOUT IT: - # - # The count_lines and find_line are similar, and yet different. - # They both follow the pattern of "sandwich code". - # - # Sandwich code is code that comes in three parts: (1) the top slice - # of bread, (2) the meat, and (3) the bottom slice of bread. The - # the bread part of the sandwich almost always goes together, but - # the meat part changes all the time. - # - # Because the changing part of the sandwich code is in the middle, - # abstracting the top and bottom bread slices to a library can be - # difficult in many languages. - # - # (Aside for C++ programmers: The idiom of capturing allocated - # pointers in a smart pointer constructor is an attempt to deal with - # the problem of sandwich code for resource allocation.) - # - # Consider the following code: - # - - def file_sandwich(file_name) - file = open(file_name) - yield(file) - ensure - file.close if file - end - - # Now we write: - - def count_lines2(file_name) - file_sandwich(file_name) do |file| - count = 0 - while line = file.gets - count += 1 - end - count - end - end - - def test_counting_lines2 - assert_equal __, count_lines2("example_file.txt") - end - - # ------------------------------------------------------------------ - - def find_line2(file_name) - # Rewrite find_line using the file_sandwich library function. - end - - def test_finding_lines2 - assert_equal __, find_line2("example_file.txt") - end - - # ------------------------------------------------------------------ - - def count_lines3(file_name) - open(file_name) do |file| - count = 0 - while line = file.gets - count += 1 - end - count - end - end - - def test_open_handles_the_file_sandwich_when_given_a_block - assert_equal __, count_lines3("example_file.txt") - end - -end diff --git a/oldstuff/RubyFun/koans/about_scope.rb b/oldstuff/RubyFun/koans/about_scope.rb deleted file mode 100644 index d07d2af..0000000 --- a/oldstuff/RubyFun/koans/about_scope.rb +++ /dev/null @@ -1,79 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutScope < EdgeCase::Koan - module Jims - class Dog - def identify - :jims_dog - end - end - end - - module Joes - class Dog - def identify - :joes_dog - end - end - end - - def test_dog_is_not_available_in_the_current_scope - assert_raise(___) do - fido = Dog.new - end - end - - def test_you_can_reference_nested_classes_using_the_scope_operator - fido = Jims::Dog.new - rover = Joes::Dog.new - assert_equal __, fido.identify - assert_equal __, rover.identify - - assert_equal __, fido.class != rover.class - assert_equal __, Jims::Dog != Joes::Dog - end - - # ------------------------------------------------------------------ - - class String - end - - def test_bare_bones_class_names_assume_the_current_scope - assert_equal __, AboutScope::String == String - end - - def test_nested_string_is_not_the_same_as_the_system_string - assert_equal __, String == "HI".class - end - - def test_use_the_prefix_scope_operator_to_force_the_global_scope - assert_equal __, ::String == "HI".class - end - - # ------------------------------------------------------------------ - - PI = 3.1416 - - def test_constants_are_defined_with_an_initial_uppercase_letter - assert_equal __, PI - end - - # ------------------------------------------------------------------ - - MyString = ::String - - def test_class_names_are_just_constants - assert_equal __, MyString == ::String - assert_equal __, MyString == "HI".class - end - - def test_constants_can_be_looked_up_explicitly - assert_equal __, PI == AboutScope.const_get("PI") - assert_equal __, MyString == AboutScope.const_get("MyString") - end - - def test_you_can_get_a_list_of_constants_for_any_class_or_module - assert_equal __, Jims.constants - assert Object.constants.size > _n_ - end -end diff --git a/oldstuff/RubyFun/koans/about_scoring_project.rb b/oldstuff/RubyFun/koans/about_scoring_project.rb deleted file mode 100644 index 3c8e027..0000000 --- a/oldstuff/RubyFun/koans/about_scoring_project.rb +++ /dev/null @@ -1,74 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -# Greed is a dice game where you roll up to five dice to accumulate -# points. The following "score" function will be used calculate the -# score of a single roll of the dice. -# -# A greed roll is scored as follows: -# -# * A set of three ones is 1000 points -# -# * A set of three numbers (other than ones) is worth 100 times the -# number. (e.g. three fives is 500 points). -# -# * A one (that is not part of a set of three) is worth 100 points. -# -# * A five (that is not part of a set of three) is worth 50 points. -# -# * Everything else is worth 0 points. -# -# -# Examples: -# -# score([1,1,1,5,1]) => 1150 points -# score([2,3,4,6,2]) => 0 points -# score([3,4,5,3,3]) => 350 points -# score([1,5,1,2,4]) => 250 points -# -# More scoring examples are given in the tests below: -# -# Your goal is to write the score method. - -def score(dice) - # You need to write this method -end - -class AboutScoringProject < EdgeCase::Koan - def test_score_of_an_empty_list_is_zero - assert_equal 0, score([]) - end - - def test_score_of_a_single_roll_of_5_is_50 - assert_equal 50, score([5]) - end - - def test_score_of_a_single_roll_of_1_is_100 - assert_equal 100, score([1]) - end - - def test_score_of_multiple_1s_and_5s_is_the_sum_of_individual_scores - assert_equal 300, score([1,5,5,1]) - end - - def test_score_of_single_2s_3s_4s_and_6s_are_zero - assert_equal 0, score([2,3,4,6]) - end - - def test_score_of_a_triple_1_is_1000 - assert_equal 1000, score([1,1,1]) - end - - def test_score_of_other_triples_is_100x - assert_equal 200, score([2,2,2]) - assert_equal 300, score([3,3,3]) - assert_equal 400, score([4,4,4]) - assert_equal 500, score([5,5,5]) - assert_equal 600, score([6,6,6]) - end - - def test_score_of_mixed_is_sum - assert_equal 250, score([2,5,2,2,3]) - assert_equal 550, score([5,5,5,5]) - end - -end diff --git a/oldstuff/RubyFun/koans/about_strings.rb b/oldstuff/RubyFun/koans/about_strings.rb deleted file mode 100644 index 509d26c..0000000 --- a/oldstuff/RubyFun/koans/about_strings.rb +++ /dev/null @@ -1,193 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') - -class AboutStrings < EdgeCase::Koan - def test_double_quoted_strings_are_strings - string = "Hello, World" - assert_equal __, string.is_a?(String) - end - - def test_single_quoted_strings_are_also_strings - string = 'Goodbye, World' - assert_equal __, string.is_a?(String) - end - - def test_use_single_quotes_to_create_string_with_double_quotes - string = 'He said, "Go Away."' - assert_equal __, string - end - - def test_use_double_quotes_to_create_strings_with_single_quotes - string = "Don't" - assert_equal __, string - end - - def test_use_backslash_for_those_hard_cases - a = "He said, \"Don't\"" - b = 'He said, "Don\'t"' - assert_equal __, a == b - end - - def test_use_flexible_quoting_to_handle_really_hard_cases - a = %(flexible quotes can handle both ' and " characters) - b = %!flexible quotes can handle both ' and " characters! - c = %{flexible quotes can handle both ' and " characters} - assert_equal __, a == b - assert_equal __, a == c - end - - def test_flexible_quotes_can_handle_multiple_lines - long_string = %{ -It was the best of times, -It was the worst of times. -} - assert_equal __, long_string.size - end - - def test_here_documents_can_also_handle_multiple_lines - long_string = < 0, :black => 30, :red => 31, - :green => 32, :yellow => 33, :blue => 34, - :magenta => 35, :cyan => 36, - } - - module_function - - COLORS.each do |color, value| - module_eval "def #{color}(string); colorize(string, #{value}); end" - module_function color - end - - def colorize(string, color_value) - if use_colors? - color(color_value) + string + color(COLORS[:clear]) - else - string - end - end - - def color(color_value) - "\e[#{color_value}m" - end - - def use_colors? - return false if ENV['NO_COLOR'] - if ENV['ANSI_COLOR'].nil? - ! using_windows? - else - ENV['ANSI_COLOR'] =~ /^(t|y)/i - end - end - - def using_windows? - File::ALT_SEPARATOR - end - end - - class Sensei - attr_reader :failure, :failed_test, :pass_count - - in_ruby_version("1.8") do - AssertionError = Test::Unit::AssertionFailedError - end - - in_ruby_version("1.9") do - if defined?(MiniTest) - AssertionError = MiniTest::Assertion - else - AssertionError = Test::Unit::AssertionFailedError - end - end - - def initialize - @pass_count = 0 - @failure = nil - @failed_test = nil - @observations = [] - end - - PROGRESS_FILE_NAME = '.path_progress' - - def add_progress(prog) - @_contents = nil - exists = File.exists?(PROGRESS_FILE_NAME) - File.open(PROGRESS_FILE_NAME,'a+') do |f| - f.print "#{',' if exists}#{prog}" - end - end - - def progress - if @_contents.nil? - if File.exists?(PROGRESS_FILE_NAME) - File.open(PROGRESS_FILE_NAME,'r') do |f| - @_contents = f.read.to_s.gsub(/\s/,'').split(',') - end - else - @_contents = [] - end - end - @_contents - end - - def observe(step) - if step.passed? - @pass_count += 1 - if @pass_count > progress.last.to_i - @observations << Color.green("#{step.koan_file}##{step.name} has expanded your awareness.") - end - else - @failed_test = step - @failure = step.failure - add_progress(@pass_count) - @observations << Color.red("#{step.koan_file}##{step.name} has damaged your karma.") - throw :edgecase_exit - end - end - - def failed? - ! @failure.nil? - end - - def assert_failed? - failure.is_a?(AssertionError) - end - - def instruct - if failed? - @observations.each{|c| puts c } - encourage - guide_through_error - a_zenlike_statement - show_progress - else - end_screen - end - end - - def show_progress - bar_width = 50 - total_tests = EdgeCase::Koan.total_tests - scale = bar_width.to_f/total_tests - print Color.green("your path thus far [") - happy_steps = (pass_count*scale).to_i - happy_steps = 1 if happy_steps == 0 && pass_count > 0 - print Color.green('.'*happy_steps) - if failed? - print Color.red('X') - print Color.cyan('_'*(bar_width-1-happy_steps)) - end - print Color.green(']') - print " #{pass_count}/#{total_tests}" - puts - end - - def end_screen - if EdgeCase.simple_output - boring_end_screen - else - artistic_end_screen - end - end - - def boring_end_screen - puts "Mountains are again merely mountains" - end - - def artistic_end_screen - "JRuby 1.9.x Koans" - ruby_version = "(in #{'J' if defined?(JRUBY_VERSION)}Ruby #{defined?(JRUBY_VERSION) ? JRUBY_VERSION : RUBY_VERSION})" - ruby_version = ruby_version.side_padding(54) - completed = <<-ENDTEXT - ,, , ,, - : ::::, :::, - , ,,: :::::::::::::,, :::: : , - , ,,, ,:::::::::::::::::::, ,: ,: ,, - :, ::, , , :, ,::::::::::::::::::, ::: ,:::: - : : ::, ,:::::::: ::, ,:::: - , ,::::: :,:::::::,::::, - ,: , ,:,,: ::::::::::::: - ::,: ,,:::, ,::::::::::::, - ,:::, :,,::: ::::::::::::, - ,::: :::::::, Mountains are again merely mountains ,:::::::::::: - :::,,,:::::: :::::::::::: - ,:::::::::::, ::::::::::::, - :::::::::::, ,:::::::::::: -::::::::::::: ,:::::::::::: -:::::::::::: Ruby Koans ::::::::::::, -::::::::::::#{ ruby_version },::::::::::::, -:::::::::::, , :::::::::::: -,:::::::::::::, brought to you by ,,::::::::::::, -:::::::::::::: ,:::::::::::: - ::::::::::::::, ,::::::::::::: - ::::::::::::, EdgeCase Software Artisans , :::::::::::: - :,::::::::: :::: ::::::::::::: - ,::::::::::: ,: ,,:::::::::::::, - :::::::::::: ,::::::::::::::, - :::::::::::::::::, :::::::::::::::: - :::::::::::::::::::, :::::::::::::::: - ::::::::::::::::::::::, ,::::,:, , ::::,::: - :::::::::::::::::::::::, ::,: ::,::, ,,: :::: - ,:::::::::::::::::::: ::,, , ,, ,:::: - ,:::::::::::::::: ::,, , ,:::, - ,:::: , ,, - ,,, -ENDTEXT - puts completed - end - - def encourage - puts - puts "The Master says:" - puts Color.cyan(" You have not yet reached enlightenment.") - if ((recents = progress.last(5)) && recents.size == 5 && recents.uniq.size == 1) - puts Color.cyan(" I sense frustration. Do not be afraid to ask for help.") - elsif progress.last(2).size == 2 && progress.last(2).uniq.size == 1 - puts Color.cyan(" Do not lose hope.") - elsif progress.last.to_i > 0 - puts Color.cyan(" You are progressing. Excellent. #{progress.last} completed.") - end - end - - def guide_through_error - puts - puts "The answers you seek..." - puts Color.red(indent(failure.message).join) - puts - puts "Please meditate on the following code:" - if assert_failed? - puts embolden_first_line_only(indent(find_interesting_lines(failure.backtrace))) - else - puts embolden_first_line_only(indent(failure.backtrace)) - end - puts - end - - def embolden_first_line_only(text) - first_line = true - text.collect { |t| - if first_line - first_line = false - Color.red(t) - else - Color.cyan(t) - end - } - end - - def indent(text) - text = text.split(/\n/) if text.is_a?(String) - text.collect{|t| " #{t}"} - end - - def find_interesting_lines(backtrace) - backtrace.reject { |line| - line =~ /test\/unit\/|edgecase\.rb|minitest/ - } - end - - # Hat's tip to Ara T. Howard for the zen statements from his - # metakoans Ruby Quiz (http://rubyquiz.com/quiz67.html) - def a_zenlike_statement - if !failed? - zen_statement = "Mountains are again merely mountains" - else - zen_statement = case (@pass_count % 10) - when 0 - "mountains are merely mountains" - when 1, 2 - "learn the rules so you know how to break them properly" - when 3, 4 - "remember that silence is sometimes the best answer" - when 5, 6 - "sleep is the best meditation" - when 7, 8 - "when you lose, don't lose the lesson" - else - "things are not what they appear to be: nor are they otherwise" - end - end - puts Color.green(zen_statement) - end - end - - class Koan - include Test::Unit::Assertions - - attr_reader :name, :failure, :koan_count, :step_count, :koan_file - - def initialize(name, koan_file=nil, koan_count=0, step_count=0) - @name = name - @failure = nil - @koan_count = koan_count - @step_count = step_count - @koan_file = koan_file - end - - def passed? - @failure.nil? - end - - def failed(failure) - @failure = failure - end - - def setup - end - - def teardown - end - - def meditate - setup - begin - send(name) - rescue StandardError, EdgeCase::Sensei::AssertionError => ex - failed(ex) - ensure - begin - teardown - rescue StandardError, EdgeCase::Sensei::AssertionError => ex - failed(ex) if passed? - end - end - self - end - - # Class methods for the EdgeCase test suite. - class << self - def inherited(subclass) - subclasses << subclass - end - - def method_added(name) - testmethods << name if !tests_disabled? && Koan.test_pattern =~ name.to_s - end - - def end_of_enlightenment - @tests_disabled = true - end - - def command_line(args) - args.each do |arg| - case arg - when /^-n\/(.*)\/$/ - @test_pattern = Regexp.new($1) - when /^-n(.*)$/ - @test_pattern = Regexp.new(Regexp.quote($1)) - else - if File.exist?(arg) - load(arg) - else - fail "Unknown command line argument '#{arg}'" - end - end - end - end - - # Lazy initialize list of subclasses - def subclasses - @subclasses ||= [] - end - - # Lazy initialize list of test methods. - def testmethods - @test_methods ||= [] - end - - def tests_disabled? - @tests_disabled ||= false - end - - def test_pattern - @test_pattern ||= /^test_/ - end - - def total_tests - self.subclasses.inject(0){|total, k| total + k.testmethods.size } - end - end - end - - class ThePath - def walk - sensei = EdgeCase::Sensei.new - each_step do |step| - sensei.observe(step.meditate) - end - sensei.instruct - end - - def each_step - catch(:edgecase_exit) { - step_count = 0 - EdgeCase::Koan.subclasses.each_with_index do |koan,koan_index| - koan.testmethods.each do |method_name| - step = koan.new(method_name, koan.to_s, koan_index+1, step_count+=1) - yield step - end - end - } - end - end -end - -END { - EdgeCase::Koan.command_line(ARGV) - EdgeCase::ThePath.new.walk -} diff --git a/oldstuff/RubyFun/koans/example_file.txt b/oldstuff/RubyFun/koans/example_file.txt deleted file mode 100644 index ffe7cbd..0000000 --- a/oldstuff/RubyFun/koans/example_file.txt +++ /dev/null @@ -1,4 +0,0 @@ -this -is -a -test diff --git a/oldstuff/RubyFun/koans/first_test.rb b/oldstuff/RubyFun/koans/first_test.rb deleted file mode 100644 index 708baf1..0000000 --- a/oldstuff/RubyFun/koans/first_test.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'test/unit' - -class TestSomething < Test::Unit::TestCase - def test_assert - assert true - assert_equal 1, 1 - assert_equal 1, 1.0 - end -end - - diff --git a/oldstuff/RubyFun/koans/path_to_enlightenment.rb b/oldstuff/RubyFun/koans/path_to_enlightenment.rb deleted file mode 100644 index 64621bf..0000000 --- a/oldstuff/RubyFun/koans/path_to_enlightenment.rb +++ /dev/null @@ -1,38 +0,0 @@ -# The path to Ruby Enlightenment starts with the following: - -$LOAD_PATH << File.dirname(__FILE__) - -require 'about_asserts' -require 'about_nil' -require 'about_objects' -require 'about_arrays' -require 'about_array_assignment' -require 'about_hashes' -require 'about_strings' -require 'about_symbols' -require 'about_regular_expressions' -require 'about_methods' -require 'about_constants' -require 'about_control_statements' -require 'about_true_and_false' -require 'about_triangle_project' -require 'about_exceptions' -require 'about_triangle_project_2' -require 'about_iteration' -require 'about_blocks' -require 'about_sandwich_code' -require 'about_scoring_project' -require 'about_classes' -require 'about_open_classes' -require 'about_dice_project' -require 'about_inheritance' -require 'about_modules' -require 'about_scope' -require 'about_class_methods' -require 'about_message_passing' -require 'about_proxy_object_project' -require 'about_to_str' -in_ruby_version("jruby") do - require 'about_java_interop' -end -require 'about_extra_credit' diff --git a/oldstuff/RubyFun/koans/test_helper.rb b/oldstuff/RubyFun/koans/test_helper.rb deleted file mode 100644 index 9accf96..0000000 --- a/oldstuff/RubyFun/koans/test_helper.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test/unit' - -def __ - "FILL ME IN" -end - -EdgeCase = Test::Unit diff --git a/oldstuff/RubyFun/koans/triangle.rb b/oldstuff/RubyFun/koans/triangle.rb deleted file mode 100644 index 8df052a..0000000 --- a/oldstuff/RubyFun/koans/triangle.rb +++ /dev/null @@ -1,22 +0,0 @@ -# Triangle Project Code. - -# Triangle analyzes the lengths of the sides of a triangle -# (represented by a, b and c) and returns the type of triangle. -# -# It returns: -# :equilateral if all sides are equal -# :isosceles if exactly 2 sides are equal -# :scalene if no sides are equal -# -# The tests for this method can be found in -# about_triangle_project.rb -# and -# about_triangle_project_2.rb -# -def triangle(a, b, c) - # WRITE THIS CODE -end - -# Error class used in part 2. No need to change this code. -class TriangleError < StandardError -end diff --git a/oldstuff/RubyFun/rails/gerbil/.gitignore b/oldstuff/RubyFun/rails/gerbil/.gitignore deleted file mode 100644 index 923b697..0000000 --- a/oldstuff/RubyFun/rails/gerbil/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.bundle -db/*.sqlite3 -log/*.log -tmp/ -.sass-cache/ diff --git a/oldstuff/RubyFun/rails/gerbil/.rspec b/oldstuff/RubyFun/rails/gerbil/.rspec deleted file mode 100644 index 5902dd3..0000000 --- a/oldstuff/RubyFun/rails/gerbil/.rspec +++ /dev/null @@ -1 +0,0 @@ ---colour --drb diff --git a/oldstuff/RubyFun/rails/gerbil/.watchr b/oldstuff/RubyFun/rails/gerbil/.watchr deleted file mode 100644 index 6c03f8a..0000000 --- a/oldstuff/RubyFun/rails/gerbil/.watchr +++ /dev/null @@ -1,24 +0,0 @@ -def run_spec(file) - unless File.exist?(file) - puts "#{file} does not exist" - return - end - - puts "Running #{file}" - system "bundle exec rspec #{file}" - puts -end - - -watch("spec/[^/]*/[^/]*_spec\\.rb") do |match| - run_spec(match[0]) -end - - -watch("app/(.*)\\.rb") do |match| - run_spec(%{spec/#{match[1]}_spec.rb}) -end - - - -# vim:filetype=ruby diff --git a/oldstuff/RubyFun/rails/gerbil/Gemfile b/oldstuff/RubyFun/rails/gerbil/Gemfile deleted file mode 100644 index 55ce5d4..0000000 --- a/oldstuff/RubyFun/rails/gerbil/Gemfile +++ /dev/null @@ -1,40 +0,0 @@ -source 'http://rubygems.org' - -gem 'rails', '3.1.1' - -# Bundle edge Rails instead: -# gem 'rails', :git => 'git://github.com/rails/rails.git' - -gem 'sqlite3' - -gem 'json' - -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails', '~> 3.1.4' - gem 'coffee-rails', '~> 3.1.1' - gem 'uglifier', '>= 1.0.3' -end - -gem 'jquery-rails' - -# To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.0.0' - -# Use unicorn as the web server -# gem 'unicorn' - -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger -# gem 'ruby-debug' - - -group :development, :test do - gem 'rspec-rails' - gem 'watchr' - gem 'rev' - gem 'spork', '~> 0.9.0.rc' -end diff --git a/oldstuff/RubyFun/rails/gerbil/Gemfile.lock b/oldstuff/RubyFun/rails/gerbil/Gemfile.lock deleted file mode 100644 index db1c308..0000000 --- a/oldstuff/RubyFun/rails/gerbil/Gemfile.lock +++ /dev/null @@ -1,139 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - actionmailer (3.1.1) - actionpack (= 3.1.1) - mail (~> 2.3.0) - actionpack (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - builder (~> 3.0.0) - erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.2) - rack-cache (~> 1.1) - rack-mount (~> 0.8.2) - rack-test (~> 0.6.1) - sprockets (~> 2.0.2) - activemodel (3.1.1) - activesupport (= 3.1.1) - builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - arel (~> 2.2.1) - tzinfo (~> 0.3.29) - activeresource (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - activesupport (3.1.1) - multi_json (~> 1.0) - arel (2.2.1) - builder (3.0.0) - coffee-rails (3.1.1) - coffee-script (>= 2.2.0) - railties (~> 3.1.0) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.1.3) - diff-lcs (1.1.3) - erubis (2.7.0) - execjs (1.2.9) - multi_json (~> 1.0) - hike (1.2.1) - i18n (0.6.0) - iobuffer (1.0.0) - jquery-rails (1.0.17) - railties (~> 3.0) - thor (~> 0.14) - json (1.6.1) - mail (2.3.0) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.17.2) - multi_json (1.0.3) - polyglot (0.3.3) - rack (1.3.5) - rack-cache (1.1) - rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) - rack-ssl (1.3.2) - rack - rack-test (0.6.1) - rack (>= 1.0) - rails (3.1.1) - actionmailer (= 3.1.1) - actionpack (= 3.1.1) - activerecord (= 3.1.1) - activeresource (= 3.1.1) - activesupport (= 3.1.1) - bundler (~> 1.0) - railties (= 3.1.1) - railties (3.1.1) - actionpack (= 3.1.1) - activesupport (= 3.1.1) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (0.9.2.2) - rdoc (3.11) - json (~> 1.4) - rev (0.3.2) - iobuffer (>= 0.1.3) - rspec (2.7.0) - rspec-core (~> 2.7.0) - rspec-expectations (~> 2.7.0) - rspec-mocks (~> 2.7.0) - rspec-core (2.7.1) - rspec-expectations (2.7.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.7.0) - rspec-rails (2.7.0) - actionpack (~> 3.0) - activesupport (~> 3.0) - railties (~> 3.0) - rspec (~> 2.7.0) - sass (3.1.10) - sass-rails (3.1.4) - actionpack (~> 3.1.0) - railties (~> 3.1.0) - sass (>= 3.1.4) - sprockets (~> 2.0.0) - tilt (~> 1.3.2) - spork (0.9.0.rc9) - sprockets (2.0.3) - hike (~> 1.2) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.4) - thor (0.14.6) - tilt (1.3.3) - treetop (1.4.10) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.31) - uglifier (1.0.4) - execjs (>= 0.3.0) - multi_json (>= 1.0.2) - watchr (0.7) - -PLATFORMS - ruby - -DEPENDENCIES - coffee-rails (~> 3.1.1) - jquery-rails - json - rails (= 3.1.1) - rev - rspec-rails - sass-rails (~> 3.1.4) - spork (~> 0.9.0.rc) - sqlite3 - uglifier (>= 1.0.3) - watchr diff --git a/oldstuff/RubyFun/rails/gerbil/README b/oldstuff/RubyFun/rails/gerbil/README deleted file mode 100644 index 7c36f23..0000000 --- a/oldstuff/RubyFun/rails/gerbil/README +++ /dev/null @@ -1,261 +0,0 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, create a new Rails application: - rails new myapp (where myapp is the application name) - -2. Change directory to myapp and start the web server: - cd myapp; rails server (run with --help for options) - -3. Go to http://localhost:3000/ and you'll see: - "Welcome aboard: You're riding Ruby on Rails!" - -4. Follow the guidelines to start developing your application. You can find -the following resources handy: - -* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html -* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands -running on the server.log and development.log. Rails will automatically display -debugging and runtime information to these files. Debugging info will also be -shown in the browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code -using the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are -several books available online as well: - -* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two books will bring you up to speed on the Ruby language and also on -programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your -Mongrel or WEBrick server with --debugger. This means that you can break out of -execution at any point in the code, investigate and change the model, and then, -resume execution! You need to install ruby-debug to run the server in debugging -mode. With gems, use sudo gem install ruby-debug. Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.all - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#nil, "body"=>nil, "id"=>"1"}>, - #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better, you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you can enter "cont". - - -== Console - -The console is a Ruby shell, which allows you to interact with your -application's domain model. Here you'll have all parts of the application -configured, just like it is when the application is running. You can inspect -domain models, change values, and save to the database. Starting the script -without arguments will launch it in the development environment. - -To start the console, run rails console from the application -directory. - -Options: - -* Passing the -s, --sandbox argument will rollback any modifications - made to the database. -* Passing an environment name as an argument will load the corresponding - environment. Example: rails console production. - -To reload your controllers and models after launching the console run -reload! - -More information about irb can be found at: -link:http://www.rubycentral.org/pickaxe/irb.html - - -== dbconsole - -You can go to the command line of your database directly through rails -dbconsole. You would be connected to the database with the credentials -defined in database.yml. Starting the script without arguments will connect you -to the development database. Passing an argument will connect you to a different -database, like rails dbconsole production. Currently works for MySQL, -PostgreSQL and SQLite 3. - -== Description of Contents - -The default directory structure of a generated Ruby on Rails application: - - |-- app - | |-- assets - | |-- images - | |-- javascripts - | `-- stylesheets - | |-- controllers - | |-- helpers - | |-- mailers - | |-- models - | `-- views - | `-- layouts - |-- config - | |-- environments - | |-- initializers - | `-- locales - |-- db - |-- doc - |-- lib - | `-- tasks - |-- log - |-- public - |-- script - |-- test - | |-- fixtures - | |-- functional - | |-- integration - | |-- performance - | `-- unit - |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets - `-- vendor - |-- assets - `-- stylesheets - `-- plugins - -app - Holds all the code that's specific to this particular application. - -app/assets - Contains subdirectories for images, stylesheets, and JavaScript files. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from - ApplicationController which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. Models descend from - ActiveRecord::Base by default. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use - eRuby syntax by default. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the - common header/footer method of wrapping views. In your views, define a layout - using the layout :default and create a file named default.html.erb. - Inside default.html.erb, call <% yield %> to render the view using this - layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are - generated for you automatically when using generators for controllers. - Helpers can be used to wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, - and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all the - sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when - generated using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that - doesn't belong under controllers, models, or helpers. This directory is in - the load path. - -public - The directory available for the web server. Also contains the dispatchers and the - default HTML files. This should be set as the DOCUMENT_ROOT of your web - server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the rails generate - command, template test files will be generated for you and placed in this - directory. - -vendor - External libraries that the application depends on. Also includes the plugins - subdirectory. If the app has frozen rails, those gems also go here, under - vendor/rails/. This directory is in the load path. diff --git a/oldstuff/RubyFun/rails/gerbil/Rakefile b/oldstuff/RubyFun/rails/gerbil/Rakefile deleted file mode 100644 index 9a06a97..0000000 --- a/oldstuff/RubyFun/rails/gerbil/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) - -Gerbil::Application.load_tasks diff --git a/oldstuff/RubyFun/rails/gerbil/app/assets/images/rails.png b/oldstuff/RubyFun/rails/gerbil/app/assets/images/rails.png deleted file mode 100644 index d5edc04..0000000 Binary files a/oldstuff/RubyFun/rails/gerbil/app/assets/images/rails.png and /dev/null differ diff --git a/oldstuff/RubyFun/rails/gerbil/app/assets/javascripts/application.js b/oldstuff/RubyFun/rails/gerbil/app/assets/javascripts/application.js deleted file mode 100644 index 37c7bfc..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/assets/javascripts/application.js +++ /dev/null @@ -1,9 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery_ujs -//= require_tree . diff --git a/oldstuff/RubyFun/rails/gerbil/app/assets/javascripts/people.js.coffee b/oldstuff/RubyFun/rails/gerbil/app/assets/javascripts/people.js.coffee deleted file mode 100644 index 7615679..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/assets/javascripts/people.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/application.css b/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/application.css deleted file mode 100644 index fc25b57..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/application.css +++ /dev/null @@ -1,7 +0,0 @@ -/* - * This is a manifest file that'll automatically include all the stylesheets available in this directory - * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at - * the top of the compiled file, but it's generally better to create a new file per style scope. - *= require_self - *= require_tree . -*/ \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/people.css.scss b/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/people.css.scss deleted file mode 100644 index 5217462..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/people.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the People controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/scaffolds.css.scss b/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/scaffolds.css.scss deleted file mode 100644 index 05188f0..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/assets/stylesheets/scaffolds.css.scss +++ /dev/null @@ -1,56 +0,0 @@ -body { - background-color: #fff; - color: #333; - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; } - -p, ol, ul, td { - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; } - -pre { - background-color: #eee; - padding: 10px; - font-size: 11px; } - -a { - color: #000; - &:visited { - color: #666; } - &:hover { - color: #fff; - background-color: #000; } } - -div { - &.field, &.actions { - margin-bottom: 10px; } } - -#notice { - color: green; } - -.field_with_errors { - padding: 2px; - background-color: red; - display: table; } - -#error_explanation { - width: 450px; - border: 2px solid red; - padding: 7px; - padding-bottom: 0; - margin-bottom: 20px; - background-color: #f0f0f0; - h2 { - text-align: left; - font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; - margin-bottom: 0px; - background-color: #c00; - color: #fff; } - ul li { - font-size: 12px; - list-style: square; } } diff --git a/oldstuff/RubyFun/rails/gerbil/app/controllers/application_controller.rb b/oldstuff/RubyFun/rails/gerbil/app/controllers/application_controller.rb deleted file mode 100644 index e8065d9..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/controllers/application_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery -end diff --git a/oldstuff/RubyFun/rails/gerbil/app/controllers/people_controller.rb b/oldstuff/RubyFun/rails/gerbil/app/controllers/people_controller.rb deleted file mode 100644 index cf4b1b5..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/controllers/people_controller.rb +++ /dev/null @@ -1,83 +0,0 @@ -class PeopleController < ApplicationController - # GET /people - # GET /people.json - def index - @people = Person.all - - respond_to do |format| - format.html # index.html.erb - format.json { render :json => @people } - end - end - - # GET /people/1 - # GET /people/1.json - def show - @person = Person.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render :json => @person } - end - end - - # GET /people/new - # GET /people/new.json - def new - @person = Person.new - - respond_to do |format| - format.html # new.html.erb - format.json { render :json => @person } - end - end - - # GET /people/1/edit - def edit - @person = Person.find(params[:id]) - end - - # POST /people - # POST /people.json - def create - @person = Person.new(params[:person]) - - respond_to do |format| - if @person.save - format.html { redirect_to @person, :notice => 'Person was successfully created.' } - format.json { render :json => @person, :status => :created, :location => @person } - else - format.html { render :action => "new" } - format.json { render :json => @person.errors, :status => :unprocessable_entity } - end - end - end - - # PUT /people/1 - # PUT /people/1.json - def update - @person = Person.find(params[:id]) - - respond_to do |format| - if @person.update_attributes(params[:person]) - format.html { redirect_to @person, :notice => 'Person was successfully updated.' } - format.json { head :ok } - else - format.html { render :action => "edit" } - format.json { render :json => @person.errors, :status => :unprocessable_entity } - end - end - end - - # DELETE /people/1 - # DELETE /people/1.json - def destroy - @person = Person.find(params[:id]) - @person.destroy - - respond_to do |format| - format.html { redirect_to people_url } - format.json { head :ok } - end - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/app/helpers/application_helper.rb b/oldstuff/RubyFun/rails/gerbil/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/oldstuff/RubyFun/rails/gerbil/app/helpers/people_helper.rb b/oldstuff/RubyFun/rails/gerbil/app/helpers/people_helper.rb deleted file mode 100644 index b682fbf..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/helpers/people_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PeopleHelper -end diff --git a/oldstuff/RubyFun/rails/gerbil/app/mailers/.gitkeep b/oldstuff/RubyFun/rails/gerbil/app/mailers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/gerbil/app/models/.gitkeep b/oldstuff/RubyFun/rails/gerbil/app/models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/gerbil/app/models/person.rb b/oldstuff/RubyFun/rails/gerbil/app/models/person.rb deleted file mode 100644 index 2f2e286..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/models/person.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Person < ActiveRecord::Base -end diff --git a/oldstuff/RubyFun/rails/gerbil/app/views/layouts/application.html.erb b/oldstuff/RubyFun/rails/gerbil/app/views/layouts/application.html.erb deleted file mode 100644 index 857373f..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Gerbil - <%= stylesheet_link_tag "application" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/oldstuff/RubyFun/rails/gerbil/app/views/people/_form.html.erb b/oldstuff/RubyFun/rails/gerbil/app/views/people/_form.html.erb deleted file mode 100644 index 7f287c9..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/views/people/_form.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<%= form_for(@person) do |f| %> - <% if @person.errors.any? %> -
    -

    <%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:

    - -
      - <% @person.errors.full_messages.each do |msg| %> -
    • <%= msg %>
    • - <% end %> -
    -
    - <% end %> - -
    - <%= f.label :name %>
    - <%= f.text_field :name %> -
    -
    - <%= f.label :age %>
    - <%= f.number_field :age %> -
    -
    - <%= f.label :zipcode %>
    - <%= f.text_field :zipcode %> -
    -
    - <%= f.submit %> -
    -<% end %> diff --git a/oldstuff/RubyFun/rails/gerbil/app/views/people/edit.html.erb b/oldstuff/RubyFun/rails/gerbil/app/views/people/edit.html.erb deleted file mode 100644 index 4d91b25..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/views/people/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

    Editing person

    - -<%= render 'form' %> - -<%= link_to 'Show', @person %> | -<%= link_to 'Back', people_path %> diff --git a/oldstuff/RubyFun/rails/gerbil/app/views/people/index.html.erb b/oldstuff/RubyFun/rails/gerbil/app/views/people/index.html.erb deleted file mode 100644 index 981ce38..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/views/people/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -

    Listing people

    - - - - - - - - - - - -<% @people.each do |person| %> - - - - - - - - -<% end %> -
    NameAgeZipcode
    <%= person.name %><%= person.age %><%= person.zipcode %><%= link_to 'Show', person %><%= link_to 'Edit', edit_person_path(person) %><%= link_to 'Destroy', person, :confirm => 'Are you sure?', :method => :delete %>
    - -
    - -<%= link_to 'New Person', new_person_path %> diff --git a/oldstuff/RubyFun/rails/gerbil/app/views/people/new.html.erb b/oldstuff/RubyFun/rails/gerbil/app/views/people/new.html.erb deleted file mode 100644 index 3618249..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/views/people/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

    New person

    - -<%= render 'form' %> - -<%= link_to 'Back', people_path %> diff --git a/oldstuff/RubyFun/rails/gerbil/app/views/people/show.html.erb b/oldstuff/RubyFun/rails/gerbil/app/views/people/show.html.erb deleted file mode 100644 index 31d0f6e..0000000 --- a/oldstuff/RubyFun/rails/gerbil/app/views/people/show.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -

    <%= notice %>

    - -

    - Name: - <%= @person.name %> -

    - -

    - Age: - <%= @person.age %> -

    - -

    - Zipcode: - <%= @person.zipcode %> -

    - - -<%= link_to 'Edit', edit_person_path(@person) %> | -<%= link_to 'Back', people_path %> diff --git a/oldstuff/RubyFun/rails/gerbil/config.ru b/oldstuff/RubyFun/rails/gerbil/config.ru deleted file mode 100644 index 1c68528..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Gerbil::Application diff --git a/oldstuff/RubyFun/rails/gerbil/config/application.rb b/oldstuff/RubyFun/rails/gerbil/config/application.rb deleted file mode 100644 index 742d7a6..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/application.rb +++ /dev/null @@ -1,60 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -# Pick the frameworks you want: -require "active_record/railtie" -require "action_controller/railtie" -require "action_mailer/railtie" -require "active_resource/railtie" -require "sprockets/railtie" -# require "rails/test_unit/railtie" - -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) -end - -module Gerbil - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable the asset pipeline - config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' - - if Rails.env.test? - initializer :after => :initialize_dependency_mechanism do - ActiveSupport::Dependencies.mechanism = :load - end - end - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/config/boot.rb b/oldstuff/RubyFun/rails/gerbil/config/boot.rb deleted file mode 100644 index 4489e58..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/boot.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'rubygems' - -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/oldstuff/RubyFun/rails/gerbil/config/database.yml b/oldstuff/RubyFun/rails/gerbil/config/database.yml deleted file mode 100644 index 51a4dd4..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 diff --git a/oldstuff/RubyFun/rails/gerbil/config/environment.rb b/oldstuff/RubyFun/rails/gerbil/config/environment.rb deleted file mode 100644 index 92034d5..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path('../application', __FILE__) - -# Initialize the rails application -Gerbil::Application.initialize! diff --git a/oldstuff/RubyFun/rails/gerbil/config/environments/development.rb b/oldstuff/RubyFun/rails/gerbil/config/environments/development.rb deleted file mode 100644 index e7958d3..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/environments/development.rb +++ /dev/null @@ -1,30 +0,0 @@ -Gerbil::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Do not compress assets - config.assets.compress = false - - # Expands the lines which load the assets - config.assets.debug = true -end diff --git a/oldstuff/RubyFun/rails/gerbil/config/environments/production.rb b/oldstuff/RubyFun/rails/gerbil/config/environments/production.rb deleted file mode 100644 index 594b170..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/environments/production.rb +++ /dev/null @@ -1,60 +0,0 @@ -Gerbil::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # Code is not reloaded between requests - config.cache_classes = true - - # Full error reports are disabled and caching is turned on - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = false - - # Compress JavaScripts and CSS - config.assets.compress = true - - # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false - - # Generate digests for assets URLs - config.assets.digest = true - - # Defaults to Rails.root.join("public/assets") - # config.assets.manifest = YOUR_PATH - - # Specifies the header that your server uses for sending files - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # See everything in the log (default is :info) - # config.log_level = :debug - - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new - - # Use a different cache store in production - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false - - # Enable threaded mode - # config.threadsafe! - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify -end diff --git a/oldstuff/RubyFun/rails/gerbil/config/environments/test.rb b/oldstuff/RubyFun/rails/gerbil/config/environments/test.rb deleted file mode 100644 index 53de15c..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/environments/test.rb +++ /dev/null @@ -1,39 +0,0 @@ -Gerbil::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = false - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end diff --git a/oldstuff/RubyFun/rails/gerbil/config/initializers/backtrace_silencers.rb b/oldstuff/RubyFun/rails/gerbil/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cd..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/oldstuff/RubyFun/rails/gerbil/config/initializers/inflections.rb b/oldstuff/RubyFun/rails/gerbil/config/initializers/inflections.rb deleted file mode 100644 index 9e8b013..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/oldstuff/RubyFun/rails/gerbil/config/initializers/mime_types.rb b/oldstuff/RubyFun/rails/gerbil/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/oldstuff/RubyFun/rails/gerbil/config/initializers/secret_token.rb b/oldstuff/RubyFun/rails/gerbil/config/initializers/secret_token.rb deleted file mode 100644 index de6ff6e..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/initializers/secret_token.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -Gerbil::Application.config.secret_token = '9e10dd70c3632c0909de3941585c5da32367929a00ee94dea37e50333dccc6b99908a100e48ea742b968e00b40c90bd1b6b2df9b8d9aa1a72be5d2ba54c76911' diff --git a/oldstuff/RubyFun/rails/gerbil/config/initializers/session_store.rb b/oldstuff/RubyFun/rails/gerbil/config/initializers/session_store.rb deleted file mode 100644 index 742017a..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Gerbil::Application.config.session_store :cookie_store, :key => '_gerbil_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# Gerbil::Application.config.session_store :active_record_store diff --git a/oldstuff/RubyFun/rails/gerbil/config/initializers/wrap_parameters.rb b/oldstuff/RubyFun/rails/gerbil/config/initializers/wrap_parameters.rb deleted file mode 100644 index da4fb07..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters :format => [:json] -end - -# Disable root element in JSON by default. -ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false -end diff --git a/oldstuff/RubyFun/rails/gerbil/config/locales/en.yml b/oldstuff/RubyFun/rails/gerbil/config/locales/en.yml deleted file mode 100644 index 179c14c..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/oldstuff/RubyFun/rails/gerbil/config/routes.rb b/oldstuff/RubyFun/rails/gerbil/config/routes.rb deleted file mode 100644 index a5d455b..0000000 --- a/oldstuff/RubyFun/rails/gerbil/config/routes.rb +++ /dev/null @@ -1,60 +0,0 @@ -Gerbil::Application.routes.draw do - resources :people - - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - # root :to => 'welcome#index' - - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id(.:format)))' -end diff --git a/oldstuff/RubyFun/rails/gerbil/db/migrate/20111114120238_create_people.rb b/oldstuff/RubyFun/rails/gerbil/db/migrate/20111114120238_create_people.rb deleted file mode 100644 index 29f934b..0000000 --- a/oldstuff/RubyFun/rails/gerbil/db/migrate/20111114120238_create_people.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePeople < ActiveRecord::Migration - def change - create_table :people do |t| - t.string :name - t.integer :age - t.string :zipcode - - t.timestamps - end - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/db/schema.rb b/oldstuff/RubyFun/rails/gerbil/db/schema.rb deleted file mode 100644 index 43de42d..0000000 --- a/oldstuff/RubyFun/rails/gerbil/db/schema.rb +++ /dev/null @@ -1,23 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20111114120238) do - - create_table "people", :force => true do |t| - t.string "name" - t.integer "age" - t.string "zipcode" - t.datetime "created_at" - t.datetime "updated_at" - end - -end diff --git a/oldstuff/RubyFun/rails/gerbil/db/seeds.rb b/oldstuff/RubyFun/rails/gerbil/db/seeds.rb deleted file mode 100644 index d34dfa0..0000000 --- a/oldstuff/RubyFun/rails/gerbil/db/seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) -# Mayor.create(:name => 'Emanuel', :city => cities.first) diff --git a/oldstuff/RubyFun/rails/gerbil/doc/README_FOR_APP b/oldstuff/RubyFun/rails/gerbil/doc/README_FOR_APP deleted file mode 100644 index fe41f5c..0000000 --- a/oldstuff/RubyFun/rails/gerbil/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/oldstuff/RubyFun/rails/gerbil/lib/assets/.gitkeep b/oldstuff/RubyFun/rails/gerbil/lib/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/gerbil/lib/tasks/.gitkeep b/oldstuff/RubyFun/rails/gerbil/lib/tasks/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/gerbil/log/.gitkeep b/oldstuff/RubyFun/rails/gerbil/log/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/gerbil/public/404.html b/oldstuff/RubyFun/rails/gerbil/public/404.html deleted file mode 100644 index 9a48320..0000000 --- a/oldstuff/RubyFun/rails/gerbil/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
    -

    The page you were looking for doesn't exist.

    -

    You may have mistyped the address or the page may have moved.

    -
    - - diff --git a/oldstuff/RubyFun/rails/gerbil/public/422.html b/oldstuff/RubyFun/rails/gerbil/public/422.html deleted file mode 100644 index 83660ab..0000000 --- a/oldstuff/RubyFun/rails/gerbil/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
    -

    The change you wanted was rejected.

    -

    Maybe you tried to change something you didn't have access to.

    -
    - - diff --git a/oldstuff/RubyFun/rails/gerbil/public/500.html b/oldstuff/RubyFun/rails/gerbil/public/500.html deleted file mode 100644 index b80307f..0000000 --- a/oldstuff/RubyFun/rails/gerbil/public/500.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
    -

    We're sorry, but something went wrong.

    -

    We've been notified about this issue and we'll take a look at it shortly.

    -
    - - diff --git a/oldstuff/RubyFun/rails/gerbil/public/favicon.ico b/oldstuff/RubyFun/rails/gerbil/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/gerbil/public/index.html b/oldstuff/RubyFun/rails/gerbil/public/index.html deleted file mode 100644 index 9d9811a..0000000 --- a/oldstuff/RubyFun/rails/gerbil/public/index.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - Ruby on Rails: Welcome aboard - - - - -
    - - -
    - - - - -
    -

    Getting started

    -

    Here’s how to get rolling:

    - -
      -
    1. -

      Use rails generate to create your models and controllers

      -

      To see all available options, run it without parameters.

      -
    2. - -
    3. -

      Set up a default route and remove public/index.html

      -

      Routes are set up in config/routes.rb.

      -
    4. - -
    5. -

      Create your database

      -

      Run rake db:create to create your database. If you're not using SQLite (the default), edit config/database.yml with your username and password.

      -
    6. -
    -
    -
    - - -
    - - diff --git a/oldstuff/RubyFun/rails/gerbil/public/robots.txt b/oldstuff/RubyFun/rails/gerbil/public/robots.txt deleted file mode 100644 index 085187f..0000000 --- a/oldstuff/RubyFun/rails/gerbil/public/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-Agent: * -# Disallow: / diff --git a/oldstuff/RubyFun/rails/gerbil/script/rails b/oldstuff/RubyFun/rails/gerbil/script/rails deleted file mode 100755 index f8da2cf..0000000 --- a/oldstuff/RubyFun/rails/gerbil/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/oldstuff/RubyFun/rails/gerbil/spec/controllers/people_controller_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/controllers/people_controller_spec.rb deleted file mode 100644 index af6f11d..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/controllers/people_controller_spec.rb +++ /dev/null @@ -1,157 +0,0 @@ -require 'spec_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. - -describe PeopleController do - - # This should return the minimal set of attributes required to create a valid - # Person. As you add validations to Person, be sure to - # update the return value of this method accordingly. - def valid_attributes - {} - end - - describe "GET index" do - it "assigns all people as @people" do - person = Person.create! valid_attributes - get :index - assigns(:people).should eq([person]) - end - end - - describe "GET show" do - it "assigns the requested person as @person" do - person = Person.create! valid_attributes - get :show, :id => person.id - assigns(:person).should eq(person) - end - end - - describe "GET new" do - it "assigns a new person as @person" do - get :new - assigns(:person).should be_a_new(Person) - end - end - - describe "GET edit" do - it "assigns the requested person as @person" do - person = Person.create! valid_attributes - get :edit, :id => person.id - assigns(:person).should eq(person) - end - end - - describe "POST create" do - describe "with valid params" do - it "creates a new Person" do - expect { - post :create, :person => valid_attributes - }.to change(Person, :count).by(1) - end - - it "assigns a newly created person as @person" do - post :create, :person => valid_attributes - assigns(:person).should be_a(Person) - assigns(:person).should be_persisted - end - - it "redirects to the created person" do - post :create, :person => valid_attributes - response.should redirect_to(Person.last) - end - end - - describe "with invalid params" do - it "assigns a newly created but unsaved person as @person" do - # Trigger the behavior that occurs when invalid params are submitted - Person.any_instance.stub(:save).and_return(false) - post :create, :person => {} - assigns(:person).should be_a_new(Person) - end - - it "re-renders the 'new' template" do - # Trigger the behavior that occurs when invalid params are submitted - Person.any_instance.stub(:save).and_return(false) - post :create, :person => {} - response.should render_template("new") - end - end - end - - describe "PUT update" do - describe "with valid params" do - it "updates the requested person" do - person = Person.create! valid_attributes - # Assuming there are no other people in the database, this - # specifies that the Person created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Person.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) - put :update, :id => person.id, :person => {'these' => 'params'} - end - - it "assigns the requested person as @person" do - person = Person.create! valid_attributes - put :update, :id => person.id, :person => valid_attributes - assigns(:person).should eq(person) - end - - it "redirects to the person" do - person = Person.create! valid_attributes - put :update, :id => person.id, :person => valid_attributes - response.should redirect_to(person) - end - end - - describe "with invalid params" do - it "assigns the person as @person" do - person = Person.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Person.any_instance.stub(:save).and_return(false) - put :update, :id => person.id, :person => {} - assigns(:person).should eq(person) - end - - it "re-renders the 'edit' template" do - person = Person.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Person.any_instance.stub(:save).and_return(false) - put :update, :id => person.id, :person => {} - response.should render_template("edit") - end - end - end - - describe "DELETE destroy" do - it "destroys the requested person" do - person = Person.create! valid_attributes - expect { - delete :destroy, :id => person.id - }.to change(Person, :count).by(-1) - end - - it "redirects to the people list" do - person = Person.create! valid_attributes - delete :destroy, :id => person.id - response.should redirect_to(people_url) - end - end - -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/helpers/people_helper_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/helpers/people_helper_spec.rb deleted file mode 100644 index 9d4bf57..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/helpers/people_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the PeopleHelper. For example: -# -# describe PeopleHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe PeopleHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/models/person_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/models/person_spec.rb deleted file mode 100644 index d8f56ff..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/models/person_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe Person do - it "can be instantiated" do - Person.new.should be_an_instance_of(Person) - end - - it "can be saved successfully" do - Person.create.should be_persisted - - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/requests/people_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/requests/people_spec.rb deleted file mode 100644 index ba7a96c..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/requests/people_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "People" do - describe "GET /people" do - it "works! (now write some real specs)" do - # Run the generator again with the --webrat flag if you want to use webrat methods/matchers - get people_path - response.status.should be(200) - end - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/routing/people_routing_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/routing/people_routing_spec.rb deleted file mode 100644 index 70db5e0..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/routing/people_routing_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -describe PeopleController do - describe "routing" do - - it "routes to #index" do - get("/people").should route_to("people#index") - end - - it "routes to #new" do - get("/people/new").should route_to("people#new") - end - - it "routes to #show" do - get("/people/1").should route_to("people#show", :id => "1") - end - - it "routes to #edit" do - get("/people/1/edit").should route_to("people#edit", :id => "1") - end - - it "routes to #create" do - post("/people").should route_to("people#create") - end - - it "routes to #update" do - put("/people/1").should route_to("people#update", :id => "1") - end - - it "routes to #destroy" do - delete("/people/1").should route_to("people#destroy", :id => "1") - end - - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/spec_helper.rb b/oldstuff/RubyFun/rails/gerbil/spec/spec_helper.rb deleted file mode 100644 index b8459a7..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/spec_helper.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'spork' - -Spork.prefork do - # This file is copied to spec/ when you run 'rails generate rspec:install' - ENV["RAILS_ENV"] ||= 'test' - require File.expand_path("../../config/environment", __FILE__) - require 'rspec/rails' - require 'rspec/autorun' - - # Requires supporting ruby files with custom matchers and macros, etc, - # in spec/support/ and its subdirectories. - Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} - - RSpec.configure do |config| - # == Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr - config.mock_with :rspec - - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" - - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = true - - # If true, the base class of anonymous controllers will be inferred - # automatically. This will be the default behavior in future versions of - # rspec-rails. - config.infer_base_class_for_anonymous_controllers = false - - ActiveSupport::Dependencies.clear - end -end - -Spork.each_run do - load Rails.root.join("config/routes.rb") - Dir[Rails.root.join("app/**/*.rb")].each { |f| load f } -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/views/people/edit.html.erb_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/views/people/edit.html.erb_spec.rb deleted file mode 100644 index fc7c2d1..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/views/people/edit.html.erb_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' - -describe "people/edit.html.erb" do - before(:each) do - @person = assign(:person, stub_model(Person, - :name => "MyString", - :age => 1, - :zipcode => "MyString" - )) - end - - it "renders the edit person form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form", :action => people_path(@person), :method => "post" do - assert_select "input#person_name", :name => "person[name]" - assert_select "input#person_age", :name => "person[age]" - assert_select "input#person_zipcode", :name => "person[zipcode]" - end - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/views/people/index.html.erb_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/views/people/index.html.erb_spec.rb deleted file mode 100644 index 48064ea..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/views/people/index.html.erb_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'spec_helper' - -describe "people/index.html.erb" do - before(:each) do - assign(:people, [ - stub_model(Person, - :name => "Name", - :age => 1, - :zipcode => "Zipcode" - ), - stub_model(Person, - :name => "Name", - :age => 1, - :zipcode => "Zipcode" - ) - ]) - end - - it "renders a list of people" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => "Name".to_s, :count => 2 - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => 1.to_s, :count => 2 - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => "Zipcode".to_s, :count => 2 - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/views/people/new.html.erb_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/views/people/new.html.erb_spec.rb deleted file mode 100644 index 7540260..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/views/people/new.html.erb_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' - -describe "people/new.html.erb" do - before(:each) do - assign(:person, stub_model(Person, - :name => "MyString", - :age => 1, - :zipcode => "MyString" - ).as_new_record) - end - - it "renders new person form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form", :action => people_path, :method => "post" do - assert_select "input#person_name", :name => "person[name]" - assert_select "input#person_age", :name => "person[age]" - assert_select "input#person_zipcode", :name => "person[zipcode]" - end - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/spec/views/people/show.html.erb_spec.rb b/oldstuff/RubyFun/rails/gerbil/spec/views/people/show.html.erb_spec.rb deleted file mode 100644 index ac751ea..0000000 --- a/oldstuff/RubyFun/rails/gerbil/spec/views/people/show.html.erb_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'spec_helper' - -describe "people/show.html.erb" do - before(:each) do - @person = assign(:person, stub_model(Person, - :name => "Name", - :age => 1, - :zipcode => "Zipcode" - )) - end - - it "renders attributes in

    " do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(/Name/) - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(/1/) - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(/Zipcode/) - end -end diff --git a/oldstuff/RubyFun/rails/gerbil/vendor/assets/stylesheets/.gitkeep b/oldstuff/RubyFun/rails/gerbil/vendor/assets/stylesheets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/gerbil/vendor/plugins/.gitkeep b/oldstuff/RubyFun/rails/gerbil/vendor/plugins/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/hamster/README b/oldstuff/RubyFun/rails/hamster/README deleted file mode 100644 index 37ec8ea..0000000 --- a/oldstuff/RubyFun/rails/hamster/README +++ /dev/null @@ -1,243 +0,0 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" templates -that are primarily responsible for inserting pre-built data in between HTML tags. -The model contains the "smart" domain objects (such as Account, Product, Person, -Post) that holds all the business logic and knows how to persist themselves to -a database. The controller handles the incoming requests (such as Save New Account, -Update Product, Show Post) by manipulating the model and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, start a new Rails application using the rails command - and your application name. Ex: rails myapp -2. Change directory into myapp and start the web server: script/server (run with --help for options) -3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!" -4. Follow the guidelines to start developing your application - - -== Web Servers - -By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails -with a variety of other web servers. - -Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is -suitable for development and deployment of Rails applications. If you have Ruby Gems installed, -getting up and running with mongrel is as easy as: gem install mongrel. -More info at: http://mongrel.rubyforge.org - -Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or -Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use -FCGI or proxy to a pack of Mongrels/Thin/Ebb servers. - -== Apache .htaccess example for FCGI/CGI - -# General Apache options -AddHandler fastcgi-script .fcgi -AddHandler cgi-script .cgi -Options +FollowSymLinks +ExecCGI - -# If you don't want Rails to look in certain directories, -# use the following rewrite rules so that Apache won't rewrite certain requests -# -# Example: -# RewriteCond %{REQUEST_URI} ^/notrails.* -# RewriteRule .* - [L] - -# Redirect all requests not available on the filesystem to Rails -# By default the cgi dispatcher is used which is very slow -# -# For better performance replace the dispatcher with the fastcgi one -# -# Example: -# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] -RewriteEngine On - -# If your Rails application is accessed via an Alias directive, -# then you MUST also set the RewriteBase in this htaccess file. -# -# Example: -# Alias /myrailsapp /path/to/myrailsapp/public -# RewriteBase /myrailsapp - -RewriteRule ^$ index.html [QSA] -RewriteRule ^([^.]+)$ $1.html [QSA] -RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^(.*)$ dispatch.cgi [QSA,L] - -# In case Rails experiences terminal errors -# Instead of displaying this message you can supply a file here which will be rendered instead -# -# Example: -# ErrorDocument 500 /500.html - -ErrorDocument 500 "

    Application error

    Rails application failed to start properly" - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands running -on the server.log and development.log. Rails will automatically display debugging -and runtime information to these files. Debugging info will also be shown in the -browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code using -the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1 - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/ including: - -* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/ -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two online (and free) books will bring you up to speed on the Ruby language -and also on programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your Mongrel or -Webrick server with --debugger. This means that you can break out of execution at any point -in the code, investigate and change the model, AND then resume execution! -You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug' -Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.find(:all) - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#nil, \"body\"=>nil, \"id\"=>\"1\"}>, - #\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better is that you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you enter "cont" - - -== Console - -You can interact with the domain model by starting the console through script/console. -Here you'll have all parts of the application configured, just like it is when the -application is running. You can inspect domain models, change values, and save to the -database. Starting the script without arguments will launch it in the development environment. -Passing an argument will specify a different environment, like script/console production. - -To reload your controllers and models after launching the console run reload! - -== dbconsole - -You can go to the command line of your database directly through script/dbconsole. -You would be connected to the database with the credentials defined in database.yml. -Starting the script without arguments will connect you to the development database. Passing an -argument will connect you to a different database, like script/dbconsole production. -Currently works for mysql, postgresql and sqlite. - -== Description of Contents - -app - Holds all the code that's specific to this particular application. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from ApplicationController - which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. - Most models will descend from ActiveRecord::Base. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby - syntax. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the common - header/footer method of wrapping views. In your views, define a layout using the - layout :default and create a file named default.html.erb. Inside default.html.erb, - call <% yield %> to render the view using this layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are generated - for you automatically when using script/generate for controllers. Helpers can be used to - wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all - the sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when generated - using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that doesn't - belong under controllers, models, or helpers. This directory is in the load path. - -public - The directory available for the web server. Contains subdirectories for images, stylesheets, - and javascripts. Also contains the dispatchers and the default HTML files. This should be - set as the DOCUMENT_ROOT of your web server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the script/generate scripts, template - test files will be generated for you and placed in this directory. - -vendor - External libraries that the application depends on. Also includes the plugins subdirectory. - If the app has frozen rails, those gems also go here, under vendor/rails/. - This directory is in the load path. diff --git a/oldstuff/RubyFun/rails/hamster/Rakefile b/oldstuff/RubyFun/rails/hamster/Rakefile deleted file mode 100644 index 3bb0e85..0000000 --- a/oldstuff/RubyFun/rails/hamster/Rakefile +++ /dev/null @@ -1,10 +0,0 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require(File.join(File.dirname(__FILE__), 'config', 'boot')) - -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -require 'tasks/rails' diff --git a/oldstuff/RubyFun/rails/hamster/app/controllers/application_controller.rb b/oldstuff/RubyFun/rails/hamster/app/controllers/application_controller.rb deleted file mode 100644 index 6635a3f..0000000 --- a/oldstuff/RubyFun/rails/hamster/app/controllers/application_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Filters added to this controller apply to all controllers in the application. -# Likewise, all the methods added will be available for all controllers. - -class ApplicationController < ActionController::Base - helper :all # include all helpers, all the time - protect_from_forgery # See ActionController::RequestForgeryProtection for details - - # Scrub sensitive parameters from your log - # filter_parameter_logging :password -end diff --git a/oldstuff/RubyFun/rails/hamster/app/controllers/solr_controller.rb b/oldstuff/RubyFun/rails/hamster/app/controllers/solr_controller.rb deleted file mode 100644 index 1148c53..0000000 --- a/oldstuff/RubyFun/rails/hamster/app/controllers/solr_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'open-uri' -require 'rexml/document' - - -class SolrController < ApplicationController - include SolrHelper - - def simple_query - @search = request[:q] - @results = [] - if @search != nil - @results = get_results(@search) - end - end - - def index - end -end diff --git a/oldstuff/RubyFun/rails/hamster/app/helpers/application_helper.rb b/oldstuff/RubyFun/rails/hamster/app/helpers/application_helper.rb deleted file mode 100644 index 22a7940..0000000 --- a/oldstuff/RubyFun/rails/hamster/app/helpers/application_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -# Methods added to this helper will be available to all templates in the application. -module ApplicationHelper -end diff --git a/oldstuff/RubyFun/rails/hamster/app/helpers/solr_helper.rb b/oldstuff/RubyFun/rails/hamster/app/helpers/solr_helper.rb deleted file mode 100644 index 7f35ac7..0000000 --- a/oldstuff/RubyFun/rails/hamster/app/helpers/solr_helper.rb +++ /dev/null @@ -1,30 +0,0 @@ -module SolrHelper - $select_url = 'http://localhost:8983/solr/select/' - $redis = '/home/me/repos/redis.git/src/redis-cli' - - def get_results(search) - cached = `#{$redis} GET "query:#{search}"` - - if cached.strip().length > 0 - # puts "cached=#{cached}" - xml_results = REXML::Document.new cached - else - raw_results = open("#{$select_url}?q=#{search}").read - # puts "caching '#{raw_results}'" - `#{$redis} SET "query:#{search}" '#{raw_results}'` - - xml_results = REXML::Document.new raw_results - end - - results = [] - REXML::XPath.each(xml_results, '//result/doc') do |doc| - results.push({ - :id => doc.elements['./str[@name="id"]'], - :description => doc.elements['./str[@name="name"]'] - }) - end - - return results - end - -end diff --git a/oldstuff/RubyFun/rails/hamster/app/views/solr/index.html.erb b/oldstuff/RubyFun/rails/hamster/app/views/solr/index.html.erb deleted file mode 100644 index 18121c5..0000000 --- a/oldstuff/RubyFun/rails/hamster/app/views/solr/index.html.erb +++ /dev/null @@ -1 +0,0 @@ -

    Index

    diff --git a/oldstuff/RubyFun/rails/hamster/app/views/solr/simple_query.html.erb b/oldstuff/RubyFun/rails/hamster/app/views/solr/simple_query.html.erb deleted file mode 100644 index 5851caf..0000000 --- a/oldstuff/RubyFun/rails/hamster/app/views/solr/simple_query.html.erb +++ /dev/null @@ -1,16 +0,0 @@ - -

    Find Stuff!

    - -
    - "/> - -
    - -<% if @results.length %> -

    Results for “<%= @search %>”:

    -
      - <% @results.each do |result| %> -
    • <%= result[:id] %>: <%= result[:description] %>
    • - <% end %> -
    -<% end %> diff --git a/oldstuff/RubyFun/rails/hamster/config/boot.rb b/oldstuff/RubyFun/rails/hamster/config/boot.rb deleted file mode 100644 index 6686664..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/boot.rb +++ /dev/null @@ -1,114 +0,0 @@ -# Don't change this file! -# Configure your app in config/environment.rb and config/environments/*.rb - -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) - -module Rails - class << self - def boot! - unless booted? - preinitialize - pick_boot.run - end - end - - def booted? - defined? Rails::Initializer - end - - def pick_boot - (vendor_rails? ? VendorBoot : GemBoot).new - end - - def vendor_rails? - File.exist?("#{RAILS_ROOT}/vendor/rails") - end - - def preinitialize - load(preinitializer_path) if File.exist?(preinitializer_path) - end - - def preinitializer_path - "#{RAILS_ROOT}/config/preinitializer.rb" - end - end - - class Boot - def run - load_initializer - Rails::Initializer.run(:set_load_path) - end - end - - class VendorBoot < Boot - def load_initializer - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" - Rails::Initializer.run(:install_gem_spec_stubs) - Rails::GemDependency.add_frozen_gem_path - end - end - - class GemBoot < Boot - def load_initializer - self.class.load_rubygems - load_rails_gem - require 'initializer' - end - - def load_rails_gem - if version = self.class.gem_version - gem 'rails', version - else - gem 'rails' - end - rescue Gem::LoadError => load_error - if load_error.message =~ /Could not find RubyGem rails/ - STDERR.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) - exit 1 - else - raise - end - end - - class << self - def rubygems_version - Gem::RubyGemsVersion rescue nil - end - - def gem_version - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - elsif ENV.include?('RAILS_GEM_VERSION') - ENV['RAILS_GEM_VERSION'] - else - parse_gem_version(read_environment_rb) - end - end - - def load_rubygems - min_version = '1.3.2' - require 'rubygems' - unless rubygems_version >= min_version - $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) - exit 1 - end - - rescue LoadError - $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) - exit 1 - end - - def parse_gem_version(text) - $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ - end - - private - def read_environment_rb - File.read("#{RAILS_ROOT}/config/environment.rb") - end - end - end -end - -# All that for this: -Rails.boot! diff --git a/oldstuff/RubyFun/rails/hamster/config/database.yml b/oldstuff/RubyFun/rails/hamster/config/database.yml deleted file mode 100644 index 025d62a..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/database.yml +++ /dev/null @@ -1,22 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3-ruby (not necessary on OS X Leopard) -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 diff --git a/oldstuff/RubyFun/rails/hamster/config/environment.rb b/oldstuff/RubyFun/rails/hamster/config/environment.rb deleted file mode 100644 index f47528a..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/environment.rb +++ /dev/null @@ -1,41 +0,0 @@ -# Be sure to restart your server when you modify this file - -# Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION - -# Bootstrap the Rails environment, frameworks, and default configuration -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Add additional load paths for your own custom dirs - # config.autoload_paths += %W( #{RAILS_ROOT}/extras ) - - # Specify gems that this application depends on and have them installed with rake gems:install - # config.gem "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "sqlite3-ruby", :lib => "sqlite3" - # config.gem "aws-s3", :lib => "aws/s3" - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Skip frameworks you're not going to use. To use Rails without a database, - # you must remove the Active Record framework. - # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] - - # Activate observers that should always be running - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. - config.time_zone = 'UTC' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] - # config.i18n.default_locale = :de -end \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/config/environments/development.rb b/oldstuff/RubyFun/rails/hamster/config/environments/development.rb deleted file mode 100644 index 85c9a60..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/environments/development.rb +++ /dev/null @@ -1,17 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# In the development environment your application's code is reloaded on -# every request. This slows down response time but is perfect for development -# since you don't have to restart the webserver when you make code changes. -config.cache_classes = false - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_view.debug_rjs = true -config.action_controller.perform_caching = false - -# Don't care if the mailer can't send -config.action_mailer.raise_delivery_errors = false \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/config/environments/production.rb b/oldstuff/RubyFun/rails/hamster/config/environments/production.rb deleted file mode 100644 index 27119d2..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/environments/production.rb +++ /dev/null @@ -1,28 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# The production environment is meant for finished, "live" apps. -# Code is not reloaded between requests -config.cache_classes = true - -# Full error reports are disabled and caching is turned on -config.action_controller.consider_all_requests_local = false -config.action_controller.perform_caching = true -config.action_view.cache_template_loading = true - -# See everything in the log (default is :info) -# config.log_level = :debug - -# Use a different logger for distributed setups -# config.logger = SyslogLogger.new - -# Use a different cache store in production -# config.cache_store = :mem_cache_store - -# Enable serving of images, stylesheets, and javascripts from an asset server -# config.action_controller.asset_host = "http://assets.example.com" - -# Disable delivery errors, bad email addresses will be ignored -# config.action_mailer.raise_delivery_errors = false - -# Enable threaded mode -# config.threadsafe! \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/config/environments/test.rb b/oldstuff/RubyFun/rails/hamster/config/environments/test.rb deleted file mode 100644 index d6f80a4..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/environments/test.rb +++ /dev/null @@ -1,28 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# The test environment is used exclusively to run your application's -# test suite. You never need to work with it otherwise. Remember that -# your test database is "scratch space" for the test suite and is wiped -# and recreated between test runs. Don't rely on the data there! -config.cache_classes = true - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_controller.perform_caching = false -config.action_view.cache_template_loading = true - -# Disable request forgery protection in test environment -config.action_controller.allow_forgery_protection = false - -# Tell Action Mailer not to deliver emails to the real world. -# The :test delivery method accumulates sent emails in the -# ActionMailer::Base.deliveries array. -config.action_mailer.delivery_method = :test - -# Use SQL instead of Active Record's schema dumper when creating the test database. -# This is necessary if your schema can't be completely dumped by the schema dumper, -# like if you have constraints or database-specific column types -# config.active_record.schema_format = :sql \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/config/initializers/backtrace_silencers.rb b/oldstuff/RubyFun/rails/hamster/config/initializers/backtrace_silencers.rb deleted file mode 100644 index c2169ed..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code. -# Rails.backtrace_cleaner.remove_silencers! \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/config/initializers/cookie_verification_secret.rb b/oldstuff/RubyFun/rails/hamster/config/initializers/cookie_verification_secret.rb deleted file mode 100644 index 19b56de..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/initializers/cookie_verification_secret.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -ActionController::Base.cookie_verifier_secret = 'b83056a0a05ceadfdc69238a002e34c2be26a1b316aed23165d667b1da07ed500cdde9814b96c64256ee390499c29f9bfffc69fa0b9d642c75f0edd4e5b7b220'; diff --git a/oldstuff/RubyFun/rails/hamster/config/initializers/inflections.rb b/oldstuff/RubyFun/rails/hamster/config/initializers/inflections.rb deleted file mode 100644 index d531b8b..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/oldstuff/RubyFun/rails/hamster/config/initializers/mime_types.rb b/oldstuff/RubyFun/rails/hamster/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/oldstuff/RubyFun/rails/hamster/config/initializers/new_rails_defaults.rb b/oldstuff/RubyFun/rails/hamster/config/initializers/new_rails_defaults.rb deleted file mode 100644 index c94db0a..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/initializers/new_rails_defaults.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# These settings change the behavior of Rails 2 apps and will be defaults -# for Rails 3. You can remove this initializer when Rails 3 is released. - -if defined?(ActiveRecord) - # Include Active Record class name as root for JSON serialized output. - ActiveRecord::Base.include_root_in_json = true - - # Store the full class name (including module namespace) in STI type column. - ActiveRecord::Base.store_full_sti_class = true -end - -ActionController::Routing.generate_best_match = false - -# Use ISO 8601 format for JSON serialized times and dates. -ActiveSupport.use_standard_json_time_format = true - -# Don't escape HTML entities in JSON, leave that for the #json_escape helper. -# if you're including raw json in an HTML page. -ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/config/initializers/session_store.rb b/oldstuff/RubyFun/rails/hamster/config/initializers/session_store.rb deleted file mode 100644 index 7427c7b..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/initializers/session_store.rb +++ /dev/null @@ -1,15 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying cookie session data integrity. -# If you change this key, all old sessions will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -ActionController::Base.session = { - :key => '_hamster_session', - :secret => '2104f7ba9267c5757ad50406a224676f17464aa543e646ff03a605558264172423ba137cf9ec607b04f2241e69b16d86617695902c402a88c717e562b13ca654' -} - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rake db:sessions:create") -# ActionController::Base.session_store = :active_record_store diff --git a/oldstuff/RubyFun/rails/hamster/config/locales/en.yml b/oldstuff/RubyFun/rails/hamster/config/locales/en.yml deleted file mode 100644 index f265c06..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/config/routes.rb b/oldstuff/RubyFun/rails/hamster/config/routes.rb deleted file mode 100644 index ea14ce1..0000000 --- a/oldstuff/RubyFun/rails/hamster/config/routes.rb +++ /dev/null @@ -1,43 +0,0 @@ -ActionController::Routing::Routes.draw do |map| - # The priority is based upon order of creation: first created -> highest priority. - - # Sample of regular route: - # map.connect 'products/:id', :controller => 'catalog', :action => 'view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # map.resources :products - - # Sample resource route with options: - # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } - - # Sample resource route with sub-resources: - # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller - - # Sample resource route with more complex sub-resources - # map.resources :products do |products| - # products.resources :comments - # products.resources :sales, :collection => { :recent => :get } - # end - - # Sample resource route within a namespace: - # map.namespace :admin do |admin| - # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb) - # admin.resources :products - # end - - # You can have the root of your site routed with map.root -- just remember to delete public/index.html. - # map.root :controller => "welcome" - - # See how all your routes lay out with "rake routes" - - # Install the default routes as the lowest priority. - # Note: These default routes make all actions in every controller accessible via GET requests. You should - # consider removing or commenting them out if you're using named routes and resources. - map.connect ':controller/:action/:id' - map.connect ':controller/:action/:id.:format' -end diff --git a/oldstuff/RubyFun/rails/hamster/db/schema.rb b/oldstuff/RubyFun/rails/hamster/db/schema.rb deleted file mode 100644 index b81ae5a..0000000 --- a/oldstuff/RubyFun/rails/hamster/db/schema.rb +++ /dev/null @@ -1,14 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead of editing this file, -# please use the migrations feature of Active Record to incrementally modify your database, and -# then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your database schema. If you need -# to create the application database on another system, you should be using db:schema:load, not running -# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 0) do - -end diff --git a/oldstuff/RubyFun/rails/hamster/db/seeds.rb b/oldstuff/RubyFun/rails/hamster/db/seeds.rb deleted file mode 100644 index 3174d0c..0000000 --- a/oldstuff/RubyFun/rails/hamster/db/seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) -# Major.create(:name => 'Daley', :city => cities.first) diff --git a/oldstuff/RubyFun/rails/hamster/doc/README_FOR_APP b/oldstuff/RubyFun/rails/hamster/doc/README_FOR_APP deleted file mode 100644 index fe41f5c..0000000 --- a/oldstuff/RubyFun/rails/hamster/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/oldstuff/RubyFun/rails/hamster/public/404.html b/oldstuff/RubyFun/rails/hamster/public/404.html deleted file mode 100644 index eff660b..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/404.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - The page you were looking for doesn't exist (404) - - - - - -
    -

    The page you were looking for doesn't exist.

    -

    You may have mistyped the address or the page may have moved.

    -
    - - \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/public/422.html b/oldstuff/RubyFun/rails/hamster/public/422.html deleted file mode 100644 index b54e4a3..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/422.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - The change you wanted was rejected (422) - - - - - -
    -

    The change you wanted was rejected.

    -

    Maybe you tried to change something you didn't have access to.

    -
    - - \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/public/500.html b/oldstuff/RubyFun/rails/hamster/public/500.html deleted file mode 100644 index ec3bbf0..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/500.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - We're sorry, but something went wrong (500) - - - - - -
    -

    We're sorry, but something went wrong.

    -

    We've been notified about this issue and we'll take a look at it shortly.

    -
    - - diff --git a/oldstuff/RubyFun/rails/hamster/public/favicon.ico b/oldstuff/RubyFun/rails/hamster/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/RubyFun/rails/hamster/public/images/rails.png b/oldstuff/RubyFun/rails/hamster/public/images/rails.png deleted file mode 100644 index d5edc04..0000000 Binary files a/oldstuff/RubyFun/rails/hamster/public/images/rails.png and /dev/null differ diff --git a/oldstuff/RubyFun/rails/hamster/public/index.html b/oldstuff/RubyFun/rails/hamster/public/index.html deleted file mode 100644 index 0dd5189..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/index.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - - Ruby on Rails: Welcome aboard - - - - - - -
    - - -
    - - - - -
    -

    Getting started

    -

    Here’s how to get rolling:

    - -
      -
    1. -

      Use script/generate to create your models and controllers

      -

      To see all available options, run it without parameters.

      -
    2. - -
    3. -

      Set up a default route and remove or rename this file

      -

      Routes are set up in config/routes.rb.

      -
    4. - -
    5. -

      Create your database

      -

      Run rake db:migrate to create your database. If you're not using SQLite (the default), edit config/database.yml with your username and password.

      -
    6. -
    -
    -
    - - -
    - - \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/public/javascripts/application.js b/oldstuff/RubyFun/rails/hamster/public/javascripts/application.js deleted file mode 100644 index fe45776..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/javascripts/application.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place your application-specific JavaScript functions and classes here -// This file is automatically included by javascript_include_tag :defaults diff --git a/oldstuff/RubyFun/rails/hamster/public/javascripts/controls.js b/oldstuff/RubyFun/rails/hamster/public/javascripts/controls.js deleted file mode 100644 index ca29aef..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/javascripts/controls.js +++ /dev/null @@ -1,963 +0,0 @@ -// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan) -// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) -// Contributors: -// Richard Livsey -// Rahul Bhargava -// Rob Wills -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// Autocompleter.Base handles all the autocompletion functionality -// that's independent of the data source for autocompletion. This -// includes drawing the autocompletion menu, observing keyboard -// and mouse events, and similar. -// -// Specific autocompleters need to provide, at the very least, -// a getUpdatedChoices function that will be invoked every time -// the text inside the monitored textbox changes. This method -// should get the text for which to provide autocompletion by -// invoking this.getToken(), NOT by directly accessing -// this.element.value. This is to allow incremental tokenized -// autocompletion. Specific auto-completion logic (AJAX, etc) -// belongs in getUpdatedChoices. -// -// Tokenized incremental autocompletion is enabled automatically -// when an autocompleter is instantiated with the 'tokens' option -// in the options parameter, e.g.: -// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); -// will incrementally autocomplete with a comma as the token. -// Additionally, ',' in the above example can be replaced with -// a token array, e.g. { tokens: [',', '\n'] } which -// enables autocompletion on multiple tokens. This is most -// useful when one of the tokens is \n (a newline), as it -// allows smart autocompletion after linebreaks. - -if(typeof Effect == 'undefined') - throw("controls.js requires including script.aculo.us' effects.js library"); - -var Autocompleter = { }; -Autocompleter.Base = Class.create({ - baseInitialize: function(element, update, options) { - element = $(element); - this.element = element; - this.update = $(update); - this.hasFocus = false; - this.changed = false; - this.active = false; - this.index = 0; - this.entryCount = 0; - this.oldElementValue = this.element.value; - - if(this.setOptions) - this.setOptions(options); - else - this.options = options || { }; - - this.options.paramName = this.options.paramName || this.element.name; - this.options.tokens = this.options.tokens || []; - this.options.frequency = this.options.frequency || 0.4; - this.options.minChars = this.options.minChars || 1; - this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - Position.clone(element, update, { - setHeight: false, - offsetTop: element.offsetHeight - }); - } - Effect.Appear(update,{duration:0.15}); - }; - this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - - if(typeof(this.options.tokens) == 'string') - this.options.tokens = new Array(this.options.tokens); - // Force carriage returns as token delimiters anyway - if (!this.options.tokens.include('\n')) - this.options.tokens.push('\n'); - - this.observer = null; - - this.element.setAttribute('autocomplete','off'); - - Element.hide(this.update); - - Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); - }, - - show: function() { - if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && - (Prototype.Browser.IE) && - (Element.getStyle(this.update, 'position')=='absolute')) { - new Insertion.After(this.update, - ''); - this.iefix = $(this.update.id+'_iefix'); - } - if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); - }, - - fixIEOverlapping: function() { - Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); - this.iefix.style.zIndex = 1; - this.update.style.zIndex = 2; - Element.show(this.iefix); - }, - - hide: function() { - this.stopIndicator(); - if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); - if(this.iefix) Element.hide(this.iefix); - }, - - startIndicator: function() { - if(this.options.indicator) Element.show(this.options.indicator); - }, - - stopIndicator: function() { - if(this.options.indicator) Element.hide(this.options.indicator); - }, - - onKeyPress: function(event) { - if(this.active) - switch(event.keyCode) { - case Event.KEY_TAB: - case Event.KEY_RETURN: - this.selectEntry(); - Event.stop(event); - case Event.KEY_ESC: - this.hide(); - this.active = false; - Event.stop(event); - return; - case Event.KEY_LEFT: - case Event.KEY_RIGHT: - return; - case Event.KEY_UP: - this.markPrevious(); - this.render(); - Event.stop(event); - return; - case Event.KEY_DOWN: - this.markNext(); - this.render(); - Event.stop(event); - return; - } - else - if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || - (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; - - this.changed = true; - this.hasFocus = true; - - if(this.observer) clearTimeout(this.observer); - this.observer = - setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); - }, - - activate: function() { - this.changed = false; - this.hasFocus = true; - this.getUpdatedChoices(); - }, - - onHover: function(event) { - var element = Event.findElement(event, 'LI'); - if(this.index != element.autocompleteIndex) - { - this.index = element.autocompleteIndex; - this.render(); - } - Event.stop(event); - }, - - onClick: function(event) { - var element = Event.findElement(event, 'LI'); - this.index = element.autocompleteIndex; - this.selectEntry(); - this.hide(); - }, - - onBlur: function(event) { - // needed to make click events working - setTimeout(this.hide.bind(this), 250); - this.hasFocus = false; - this.active = false; - }, - - render: function() { - if(this.entryCount > 0) { - for (var i = 0; i < this.entryCount; i++) - this.index==i ? - Element.addClassName(this.getEntry(i),"selected") : - Element.removeClassName(this.getEntry(i),"selected"); - if(this.hasFocus) { - this.show(); - this.active = true; - } - } else { - this.active = false; - this.hide(); - } - }, - - markPrevious: function() { - if(this.index > 0) this.index--; - else this.index = this.entryCount-1; - this.getEntry(this.index).scrollIntoView(true); - }, - - markNext: function() { - if(this.index < this.entryCount-1) this.index++; - else this.index = 0; - this.getEntry(this.index).scrollIntoView(false); - }, - - getEntry: function(index) { - return this.update.firstChild.childNodes[index]; - }, - - getCurrentEntry: function() { - return this.getEntry(this.index); - }, - - selectEntry: function() { - this.active = false; - this.updateElement(this.getCurrentEntry()); - }, - - updateElement: function(selectedElement) { - if (this.options.updateElement) { - this.options.updateElement(selectedElement); - return; - } - var value = ''; - if (this.options.select) { - var nodes = $(selectedElement).select('.' + this.options.select) || []; - if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); - } else - value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); - - var bounds = this.getTokenBounds(); - if (bounds[0] != -1) { - var newValue = this.element.value.substr(0, bounds[0]); - var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); - if (whitespace) - newValue += whitespace[0]; - this.element.value = newValue + value + this.element.value.substr(bounds[1]); - } else { - this.element.value = value; - } - this.oldElementValue = this.element.value; - this.element.focus(); - - if (this.options.afterUpdateElement) - this.options.afterUpdateElement(this.element, selectedElement); - }, - - updateChoices: function(choices) { - if(!this.changed && this.hasFocus) { - this.update.innerHTML = choices; - Element.cleanWhitespace(this.update); - Element.cleanWhitespace(this.update.down()); - - if(this.update.firstChild && this.update.down().childNodes) { - this.entryCount = - this.update.down().childNodes.length; - for (var i = 0; i < this.entryCount; i++) { - var entry = this.getEntry(i); - entry.autocompleteIndex = i; - this.addObservers(entry); - } - } else { - this.entryCount = 0; - } - - this.stopIndicator(); - this.index = 0; - - if(this.entryCount==1 && this.options.autoSelect) { - this.selectEntry(); - this.hide(); - } else { - this.render(); - } - } - }, - - addObservers: function(element) { - Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); - Event.observe(element, "click", this.onClick.bindAsEventListener(this)); - }, - - onObserverEvent: function() { - this.changed = false; - this.tokenBounds = null; - if(this.getToken().length>=this.options.minChars) { - this.getUpdatedChoices(); - } else { - this.active = false; - this.hide(); - } - this.oldElementValue = this.element.value; - }, - - getToken: function() { - var bounds = this.getTokenBounds(); - return this.element.value.substring(bounds[0], bounds[1]).strip(); - }, - - getTokenBounds: function() { - if (null != this.tokenBounds) return this.tokenBounds; - var value = this.element.value; - if (value.strip().empty()) return [-1, 0]; - var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); - var offset = (diff == this.oldElementValue.length ? 1 : 0); - var prevTokenPos = -1, nextTokenPos = value.length; - var tp; - for (var index = 0, l = this.options.tokens.length; index < l; ++index) { - tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); - if (tp > prevTokenPos) prevTokenPos = tp; - tp = value.indexOf(this.options.tokens[index], diff + offset); - if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; - } - return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); - } -}); - -Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { - var boundary = Math.min(newS.length, oldS.length); - for (var index = 0; index < boundary; ++index) - if (newS[index] != oldS[index]) - return index; - return boundary; -}; - -Ajax.Autocompleter = Class.create(Autocompleter.Base, { - initialize: function(element, update, url, options) { - this.baseInitialize(element, update, options); - this.options.asynchronous = true; - this.options.onComplete = this.onComplete.bind(this); - this.options.defaultParams = this.options.parameters || null; - this.url = url; - }, - - getUpdatedChoices: function() { - this.startIndicator(); - - var entry = encodeURIComponent(this.options.paramName) + '=' + - encodeURIComponent(this.getToken()); - - this.options.parameters = this.options.callback ? - this.options.callback(this.element, entry) : entry; - - if(this.options.defaultParams) - this.options.parameters += '&' + this.options.defaultParams; - - new Ajax.Request(this.url, this.options); - }, - - onComplete: function(request) { - this.updateChoices(request.responseText); - } -}); - -// The local array autocompleter. Used when you'd prefer to -// inject an array of autocompletion options into the page, rather -// than sending out Ajax queries, which can be quite slow sometimes. -// -// The constructor takes four parameters. The first two are, as usual, -// the id of the monitored textbox, and id of the autocompletion menu. -// The third is the array you want to autocomplete from, and the fourth -// is the options block. -// -// Extra local autocompletion options: -// - choices - How many autocompletion choices to offer -// -// - partialSearch - If false, the autocompleter will match entered -// text only at the beginning of strings in the -// autocomplete array. Defaults to true, which will -// match text at the beginning of any *word* in the -// strings in the autocomplete array. If you want to -// search anywhere in the string, additionally set -// the option fullSearch to true (default: off). -// -// - fullSsearch - Search anywhere in autocomplete array strings. -// -// - partialChars - How many characters to enter before triggering -// a partial match (unlike minChars, which defines -// how many characters are required to do any match -// at all). Defaults to 2. -// -// - ignoreCase - Whether to ignore case when autocompleting. -// Defaults to true. -// -// It's possible to pass in a custom function as the 'selector' -// option, if you prefer to write your own autocompletion logic. -// In that case, the other options above will not apply unless -// you support them. - -Autocompleter.Local = Class.create(Autocompleter.Base, { - initialize: function(element, update, array, options) { - this.baseInitialize(element, update, options); - this.options.array = array; - }, - - getUpdatedChoices: function() { - this.updateChoices(this.options.selector(this)); - }, - - setOptions: function(options) { - this.options = Object.extend({ - choices: 10, - partialSearch: true, - partialChars: 2, - ignoreCase: true, - fullSearch: false, - selector: function(instance) { - var ret = []; // Beginning matches - var partial = []; // Inside matches - var entry = instance.getToken(); - var count = 0; - - for (var i = 0; i < instance.options.array.length && - ret.length < instance.options.choices ; i++) { - - var elem = instance.options.array[i]; - var foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase()) : - elem.indexOf(entry); - - while (foundPos != -1) { - if (foundPos == 0 && elem.length != entry.length) { - ret.push("
  • " + elem.substr(0, entry.length) + "" + - elem.substr(entry.length) + "
  • "); - break; - } else if (entry.length >= instance.options.partialChars && - instance.options.partialSearch && foundPos != -1) { - if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { - partial.push("
  • " + elem.substr(0, foundPos) + "" + - elem.substr(foundPos, entry.length) + "" + elem.substr( - foundPos + entry.length) + "
  • "); - break; - } - } - - foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : - elem.indexOf(entry, foundPos + 1); - - } - } - if (partial.length) - ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)); - return "
      " + ret.join('') + "
    "; - } - }, options || { }); - } -}); - -// AJAX in-place editor and collection editor -// Full rewrite by Christophe Porteneuve (April 2007). - -// Use this if you notice weird scrolling problems on some browsers, -// the DOM might be a bit confused when this gets called so do this -// waits 1 ms (with setTimeout) until it does the activation -Field.scrollFreeActivate = function(field) { - setTimeout(function() { - Field.activate(field); - }, 1); -}; - -Ajax.InPlaceEditor = Class.create({ - initialize: function(element, url, options) { - this.url = url; - this.element = element = $(element); - this.prepareOptions(); - this._controls = { }; - arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! - Object.extend(this.options, options || { }); - if (!this.options.formId && this.element.id) { - this.options.formId = this.element.id + '-inplaceeditor'; - if ($(this.options.formId)) - this.options.formId = ''; - } - if (this.options.externalControl) - this.options.externalControl = $(this.options.externalControl); - if (!this.options.externalControl) - this.options.externalControlOnly = false; - this._originalBackground = this.element.getStyle('background-color') || 'transparent'; - this.element.title = this.options.clickToEditText; - this._boundCancelHandler = this.handleFormCancellation.bind(this); - this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); - this._boundFailureHandler = this.handleAJAXFailure.bind(this); - this._boundSubmitHandler = this.handleFormSubmission.bind(this); - this._boundWrapperHandler = this.wrapUp.bind(this); - this.registerListeners(); - }, - checkForEscapeOrReturn: function(e) { - if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; - if (Event.KEY_ESC == e.keyCode) - this.handleFormCancellation(e); - else if (Event.KEY_RETURN == e.keyCode) - this.handleFormSubmission(e); - }, - createControl: function(mode, handler, extraClasses) { - var control = this.options[mode + 'Control']; - var text = this.options[mode + 'Text']; - if ('button' == control) { - var btn = document.createElement('input'); - btn.type = 'submit'; - btn.value = text; - btn.className = 'editor_' + mode + '_button'; - if ('cancel' == mode) - btn.onclick = this._boundCancelHandler; - this._form.appendChild(btn); - this._controls[mode] = btn; - } else if ('link' == control) { - var link = document.createElement('a'); - link.href = '#'; - link.appendChild(document.createTextNode(text)); - link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; - link.className = 'editor_' + mode + '_link'; - if (extraClasses) - link.className += ' ' + extraClasses; - this._form.appendChild(link); - this._controls[mode] = link; - } - }, - createEditField: function() { - var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); - var fld; - if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { - fld = document.createElement('input'); - fld.type = 'text'; - var size = this.options.size || this.options.cols || 0; - if (0 < size) fld.size = size; - } else { - fld = document.createElement('textarea'); - fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); - fld.cols = this.options.cols || 40; - } - fld.name = this.options.paramName; - fld.value = text; // No HTML breaks conversion anymore - fld.className = 'editor_field'; - if (this.options.submitOnBlur) - fld.onblur = this._boundSubmitHandler; - this._controls.editor = fld; - if (this.options.loadTextURL) - this.loadExternalText(); - this._form.appendChild(this._controls.editor); - }, - createForm: function() { - var ipe = this; - function addText(mode, condition) { - var text = ipe.options['text' + mode + 'Controls']; - if (!text || condition === false) return; - ipe._form.appendChild(document.createTextNode(text)); - }; - this._form = $(document.createElement('form')); - this._form.id = this.options.formId; - this._form.addClassName(this.options.formClassName); - this._form.onsubmit = this._boundSubmitHandler; - this.createEditField(); - if ('textarea' == this._controls.editor.tagName.toLowerCase()) - this._form.appendChild(document.createElement('br')); - if (this.options.onFormCustomization) - this.options.onFormCustomization(this, this._form); - addText('Before', this.options.okControl || this.options.cancelControl); - this.createControl('ok', this._boundSubmitHandler); - addText('Between', this.options.okControl && this.options.cancelControl); - this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); - addText('After', this.options.okControl || this.options.cancelControl); - }, - destroy: function() { - if (this._oldInnerHTML) - this.element.innerHTML = this._oldInnerHTML; - this.leaveEditMode(); - this.unregisterListeners(); - }, - enterEditMode: function(e) { - if (this._saving || this._editing) return; - this._editing = true; - this.triggerCallback('onEnterEditMode'); - if (this.options.externalControl) - this.options.externalControl.hide(); - this.element.hide(); - this.createForm(); - this.element.parentNode.insertBefore(this._form, this.element); - if (!this.options.loadTextURL) - this.postProcessEditField(); - if (e) Event.stop(e); - }, - enterHover: function(e) { - if (this.options.hoverClassName) - this.element.addClassName(this.options.hoverClassName); - if (this._saving) return; - this.triggerCallback('onEnterHover'); - }, - getText: function() { - return this.element.innerHTML.unescapeHTML(); - }, - handleAJAXFailure: function(transport) { - this.triggerCallback('onFailure', transport); - if (this._oldInnerHTML) { - this.element.innerHTML = this._oldInnerHTML; - this._oldInnerHTML = null; - } - }, - handleFormCancellation: function(e) { - this.wrapUp(); - if (e) Event.stop(e); - }, - handleFormSubmission: function(e) { - var form = this._form; - var value = $F(this._controls.editor); - this.prepareSubmission(); - var params = this.options.callback(form, value) || ''; - if (Object.isString(params)) - params = params.toQueryParams(); - params.editorId = this.element.id; - if (this.options.htmlResponse) { - var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); - Object.extend(options, { - parameters: params, - onComplete: this._boundWrapperHandler, - onFailure: this._boundFailureHandler - }); - new Ajax.Updater({ success: this.element }, this.url, options); - } else { - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: params, - onComplete: this._boundWrapperHandler, - onFailure: this._boundFailureHandler - }); - new Ajax.Request(this.url, options); - } - if (e) Event.stop(e); - }, - leaveEditMode: function() { - this.element.removeClassName(this.options.savingClassName); - this.removeForm(); - this.leaveHover(); - this.element.style.backgroundColor = this._originalBackground; - this.element.show(); - if (this.options.externalControl) - this.options.externalControl.show(); - this._saving = false; - this._editing = false; - this._oldInnerHTML = null; - this.triggerCallback('onLeaveEditMode'); - }, - leaveHover: function(e) { - if (this.options.hoverClassName) - this.element.removeClassName(this.options.hoverClassName); - if (this._saving) return; - this.triggerCallback('onLeaveHover'); - }, - loadExternalText: function() { - this._form.addClassName(this.options.loadingClassName); - this._controls.editor.disabled = true; - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - this._form.removeClassName(this.options.loadingClassName); - var text = transport.responseText; - if (this.options.stripLoadedTextTags) - text = text.stripTags(); - this._controls.editor.value = text; - this._controls.editor.disabled = false; - this.postProcessEditField(); - }.bind(this), - onFailure: this._boundFailureHandler - }); - new Ajax.Request(this.options.loadTextURL, options); - }, - postProcessEditField: function() { - var fpc = this.options.fieldPostCreation; - if (fpc) - $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); - }, - prepareOptions: function() { - this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); - Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); - [this._extraDefaultOptions].flatten().compact().each(function(defs) { - Object.extend(this.options, defs); - }.bind(this)); - }, - prepareSubmission: function() { - this._saving = true; - this.removeForm(); - this.leaveHover(); - this.showSaving(); - }, - registerListeners: function() { - this._listeners = { }; - var listener; - $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { - listener = this[pair.value].bind(this); - this._listeners[pair.key] = listener; - if (!this.options.externalControlOnly) - this.element.observe(pair.key, listener); - if (this.options.externalControl) - this.options.externalControl.observe(pair.key, listener); - }.bind(this)); - }, - removeForm: function() { - if (!this._form) return; - this._form.remove(); - this._form = null; - this._controls = { }; - }, - showSaving: function() { - this._oldInnerHTML = this.element.innerHTML; - this.element.innerHTML = this.options.savingText; - this.element.addClassName(this.options.savingClassName); - this.element.style.backgroundColor = this._originalBackground; - this.element.show(); - }, - triggerCallback: function(cbName, arg) { - if ('function' == typeof this.options[cbName]) { - this.options[cbName](this, arg); - } - }, - unregisterListeners: function() { - $H(this._listeners).each(function(pair) { - if (!this.options.externalControlOnly) - this.element.stopObserving(pair.key, pair.value); - if (this.options.externalControl) - this.options.externalControl.stopObserving(pair.key, pair.value); - }.bind(this)); - }, - wrapUp: function(transport) { - this.leaveEditMode(); - // Can't use triggerCallback due to backward compatibility: requires - // binding + direct element - this._boundComplete(transport, this.element); - } -}); - -Object.extend(Ajax.InPlaceEditor.prototype, { - dispose: Ajax.InPlaceEditor.prototype.destroy -}); - -Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { - initialize: function($super, element, url, options) { - this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; - $super(element, url, options); - }, - - createEditField: function() { - var list = document.createElement('select'); - list.name = this.options.paramName; - list.size = 1; - this._controls.editor = list; - this._collection = this.options.collection || []; - if (this.options.loadCollectionURL) - this.loadCollection(); - else - this.checkForExternalText(); - this._form.appendChild(this._controls.editor); - }, - - loadCollection: function() { - this._form.addClassName(this.options.loadingClassName); - this.showLoadingText(this.options.loadingCollectionText); - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - var js = transport.responseText.strip(); - if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check - throw('Server returned an invalid collection representation.'); - this._collection = eval(js); - this.checkForExternalText(); - }.bind(this), - onFailure: this.onFailure - }); - new Ajax.Request(this.options.loadCollectionURL, options); - }, - - showLoadingText: function(text) { - this._controls.editor.disabled = true; - var tempOption = this._controls.editor.firstChild; - if (!tempOption) { - tempOption = document.createElement('option'); - tempOption.value = ''; - this._controls.editor.appendChild(tempOption); - tempOption.selected = true; - } - tempOption.update((text || '').stripScripts().stripTags()); - }, - - checkForExternalText: function() { - this._text = this.getText(); - if (this.options.loadTextURL) - this.loadExternalText(); - else - this.buildOptionList(); - }, - - loadExternalText: function() { - this.showLoadingText(this.options.loadingText); - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - this._text = transport.responseText.strip(); - this.buildOptionList(); - }.bind(this), - onFailure: this.onFailure - }); - new Ajax.Request(this.options.loadTextURL, options); - }, - - buildOptionList: function() { - this._form.removeClassName(this.options.loadingClassName); - this._collection = this._collection.map(function(entry) { - return 2 === entry.length ? entry : [entry, entry].flatten(); - }); - var marker = ('value' in this.options) ? this.options.value : this._text; - var textFound = this._collection.any(function(entry) { - return entry[0] == marker; - }.bind(this)); - this._controls.editor.update(''); - var option; - this._collection.each(function(entry, index) { - option = document.createElement('option'); - option.value = entry[0]; - option.selected = textFound ? entry[0] == marker : 0 == index; - option.appendChild(document.createTextNode(entry[1])); - this._controls.editor.appendChild(option); - }.bind(this)); - this._controls.editor.disabled = false; - Field.scrollFreeActivate(this._controls.editor); - } -}); - -//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** -//**** This only exists for a while, in order to let **** -//**** users adapt to the new API. Read up on the new **** -//**** API and convert your code to it ASAP! **** - -Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { - if (!options) return; - function fallback(name, expr) { - if (name in options || expr === undefined) return; - options[name] = expr; - }; - fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : - options.cancelLink == options.cancelButton == false ? false : undefined))); - fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : - options.okLink == options.okButton == false ? false : undefined))); - fallback('highlightColor', options.highlightcolor); - fallback('highlightEndColor', options.highlightendcolor); -}; - -Object.extend(Ajax.InPlaceEditor, { - DefaultOptions: { - ajaxOptions: { }, - autoRows: 3, // Use when multi-line w/ rows == 1 - cancelControl: 'link', // 'link'|'button'|false - cancelText: 'cancel', - clickToEditText: 'Click to edit', - externalControl: null, // id|elt - externalControlOnly: false, - fieldPostCreation: 'activate', // 'activate'|'focus'|false - formClassName: 'inplaceeditor-form', - formId: null, // id|elt - highlightColor: '#ffff99', - highlightEndColor: '#ffffff', - hoverClassName: '', - htmlResponse: true, - loadingClassName: 'inplaceeditor-loading', - loadingText: 'Loading...', - okControl: 'button', // 'link'|'button'|false - okText: 'ok', - paramName: 'value', - rows: 1, // If 1 and multi-line, uses autoRows - savingClassName: 'inplaceeditor-saving', - savingText: 'Saving...', - size: 0, - stripLoadedTextTags: false, - submitOnBlur: false, - textAfterControls: '', - textBeforeControls: '', - textBetweenControls: '' - }, - DefaultCallbacks: { - callback: function(form) { - return Form.serialize(form); - }, - onComplete: function(transport, element) { - // For backward compatibility, this one is bound to the IPE, and passes - // the element directly. It was too often customized, so we don't break it. - new Effect.Highlight(element, { - startcolor: this.options.highlightColor, keepBackgroundImage: true }); - }, - onEnterEditMode: null, - onEnterHover: function(ipe) { - ipe.element.style.backgroundColor = ipe.options.highlightColor; - if (ipe._effect) - ipe._effect.cancel(); - }, - onFailure: function(transport, ipe) { - alert('Error communication with the server: ' + transport.responseText.stripTags()); - }, - onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. - onLeaveEditMode: null, - onLeaveHover: function(ipe) { - ipe._effect = new Effect.Highlight(ipe.element, { - startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, - restorecolor: ipe._originalBackground, keepBackgroundImage: true - }); - } - }, - Listeners: { - click: 'enterEditMode', - keydown: 'checkForEscapeOrReturn', - mouseover: 'enterHover', - mouseout: 'leaveHover' - } -}); - -Ajax.InPlaceCollectionEditor.DefaultOptions = { - loadingCollectionText: 'Loading options...' -}; - -// Delayed observer, like Form.Element.Observer, -// but waits for delay after last key input -// Ideal for live-search fields - -Form.Element.DelayedObserver = Class.create({ - initialize: function(element, delay, callback) { - this.delay = delay || 0.5; - this.element = $(element); - this.callback = callback; - this.timer = null; - this.lastValue = $F(this.element); - Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); - }, - delayedListener: function(event) { - if(this.lastValue == $F(this.element)) return; - if(this.timer) clearTimeout(this.timer); - this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); - this.lastValue = $F(this.element); - }, - onTimerEvent: function() { - this.timer = null; - this.callback(this.element, $F(this.element)); - } -}); \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/public/javascripts/dragdrop.js b/oldstuff/RubyFun/rails/hamster/public/javascripts/dragdrop.js deleted file mode 100644 index 07229f9..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/javascripts/dragdrop.js +++ /dev/null @@ -1,973 +0,0 @@ -// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005-2008 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -if(Object.isUndefined(Effect)) - throw("dragdrop.js requires including script.aculo.us' effects.js library"); - -var Droppables = { - drops: [], - - remove: function(element) { - this.drops = this.drops.reject(function(d) { return d.element==$(element) }); - }, - - add: function(element) { - element = $(element); - var options = Object.extend({ - greedy: true, - hoverclass: null, - tree: false - }, arguments[1] || { }); - - // cache containers - if(options.containment) { - options._containers = []; - var containment = options.containment; - if(Object.isArray(containment)) { - containment.each( function(c) { options._containers.push($(c)) }); - } else { - options._containers.push($(containment)); - } - } - - if(options.accept) options.accept = [options.accept].flatten(); - - Element.makePositioned(element); // fix IE - options.element = element; - - this.drops.push(options); - }, - - findDeepestChild: function(drops) { - deepest = drops[0]; - - for (i = 1; i < drops.length; ++i) - if (Element.isParent(drops[i].element, deepest.element)) - deepest = drops[i]; - - return deepest; - }, - - isContained: function(element, drop) { - var containmentNode; - if(drop.tree) { - containmentNode = element.treeNode; - } else { - containmentNode = element.parentNode; - } - return drop._containers.detect(function(c) { return containmentNode == c }); - }, - - isAffected: function(point, element, drop) { - return ( - (drop.element!=element) && - ((!drop._containers) || - this.isContained(element, drop)) && - ((!drop.accept) || - (Element.classNames(element).detect( - function(v) { return drop.accept.include(v) } ) )) && - Position.within(drop.element, point[0], point[1]) ); - }, - - deactivate: function(drop) { - if(drop.hoverclass) - Element.removeClassName(drop.element, drop.hoverclass); - this.last_active = null; - }, - - activate: function(drop) { - if(drop.hoverclass) - Element.addClassName(drop.element, drop.hoverclass); - this.last_active = drop; - }, - - show: function(point, element) { - if(!this.drops.length) return; - var drop, affected = []; - - this.drops.each( function(drop) { - if(Droppables.isAffected(point, element, drop)) - affected.push(drop); - }); - - if(affected.length>0) - drop = Droppables.findDeepestChild(affected); - - if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); - if (drop) { - Position.within(drop.element, point[0], point[1]); - if(drop.onHover) - drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); - - if (drop != this.last_active) Droppables.activate(drop); - } - }, - - fire: function(event, element) { - if(!this.last_active) return; - Position.prepare(); - - if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) - if (this.last_active.onDrop) { - this.last_active.onDrop(element, this.last_active.element, event); - return true; - } - }, - - reset: function() { - if(this.last_active) - this.deactivate(this.last_active); - } -}; - -var Draggables = { - drags: [], - observers: [], - - register: function(draggable) { - if(this.drags.length == 0) { - this.eventMouseUp = this.endDrag.bindAsEventListener(this); - this.eventMouseMove = this.updateDrag.bindAsEventListener(this); - this.eventKeypress = this.keyPress.bindAsEventListener(this); - - Event.observe(document, "mouseup", this.eventMouseUp); - Event.observe(document, "mousemove", this.eventMouseMove); - Event.observe(document, "keypress", this.eventKeypress); - } - this.drags.push(draggable); - }, - - unregister: function(draggable) { - this.drags = this.drags.reject(function(d) { return d==draggable }); - if(this.drags.length == 0) { - Event.stopObserving(document, "mouseup", this.eventMouseUp); - Event.stopObserving(document, "mousemove", this.eventMouseMove); - Event.stopObserving(document, "keypress", this.eventKeypress); - } - }, - - activate: function(draggable) { - if(draggable.options.delay) { - this._timeout = setTimeout(function() { - Draggables._timeout = null; - window.focus(); - Draggables.activeDraggable = draggable; - }.bind(this), draggable.options.delay); - } else { - window.focus(); // allows keypress events if window isn't currently focused, fails for Safari - this.activeDraggable = draggable; - } - }, - - deactivate: function() { - this.activeDraggable = null; - }, - - updateDrag: function(event) { - if(!this.activeDraggable) return; - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - // Mozilla-based browsers fire successive mousemove events with - // the same coordinates, prevent needless redrawing (moz bug?) - if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; - this._lastPointer = pointer; - - this.activeDraggable.updateDrag(event, pointer); - }, - - endDrag: function(event) { - if(this._timeout) { - clearTimeout(this._timeout); - this._timeout = null; - } - if(!this.activeDraggable) return; - this._lastPointer = null; - this.activeDraggable.endDrag(event); - this.activeDraggable = null; - }, - - keyPress: function(event) { - if(this.activeDraggable) - this.activeDraggable.keyPress(event); - }, - - addObserver: function(observer) { - this.observers.push(observer); - this._cacheObserverCallbacks(); - }, - - removeObserver: function(element) { // element instead of observer fixes mem leaks - this.observers = this.observers.reject( function(o) { return o.element==element }); - this._cacheObserverCallbacks(); - }, - - notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' - if(this[eventName+'Count'] > 0) - this.observers.each( function(o) { - if(o[eventName]) o[eventName](eventName, draggable, event); - }); - if(draggable.options[eventName]) draggable.options[eventName](draggable, event); - }, - - _cacheObserverCallbacks: function() { - ['onStart','onEnd','onDrag'].each( function(eventName) { - Draggables[eventName+'Count'] = Draggables.observers.select( - function(o) { return o[eventName]; } - ).length; - }); - } -}; - -/*--------------------------------------------------------------------------*/ - -var Draggable = Class.create({ - initialize: function(element) { - var defaults = { - handle: false, - reverteffect: function(element, top_offset, left_offset) { - var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; - new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, - queue: {scope:'_draggable', position:'end'} - }); - }, - endeffect: function(element) { - var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; - new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, - queue: {scope:'_draggable', position:'end'}, - afterFinish: function(){ - Draggable._dragging[element] = false - } - }); - }, - zindex: 1000, - revert: false, - quiet: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } - delay: 0 - }; - - if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) - Object.extend(defaults, { - starteffect: function(element) { - element._opacity = Element.getOpacity(element); - Draggable._dragging[element] = true; - new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); - } - }); - - var options = Object.extend(defaults, arguments[1] || { }); - - this.element = $(element); - - if(options.handle && Object.isString(options.handle)) - this.handle = this.element.down('.'+options.handle, 0); - - if(!this.handle) this.handle = $(options.handle); - if(!this.handle) this.handle = this.element; - - if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { - options.scroll = $(options.scroll); - this._isScrollChild = Element.childOf(this.element, options.scroll); - } - - Element.makePositioned(this.element); // fix IE - - this.options = options; - this.dragging = false; - - this.eventMouseDown = this.initDrag.bindAsEventListener(this); - Event.observe(this.handle, "mousedown", this.eventMouseDown); - - Draggables.register(this); - }, - - destroy: function() { - Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); - Draggables.unregister(this); - }, - - currentDelta: function() { - return([ - parseInt(Element.getStyle(this.element,'left') || '0'), - parseInt(Element.getStyle(this.element,'top') || '0')]); - }, - - initDrag: function(event) { - if(!Object.isUndefined(Draggable._dragging[this.element]) && - Draggable._dragging[this.element]) return; - if(Event.isLeftClick(event)) { - // abort on form elements, fixes a Firefox issue - var src = Event.element(event); - if((tag_name = src.tagName.toUpperCase()) && ( - tag_name=='INPUT' || - tag_name=='SELECT' || - tag_name=='OPTION' || - tag_name=='BUTTON' || - tag_name=='TEXTAREA')) return; - - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - var pos = Position.cumulativeOffset(this.element); - this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); - - Draggables.activate(this); - Event.stop(event); - } - }, - - startDrag: function(event) { - this.dragging = true; - if(!this.delta) - this.delta = this.currentDelta(); - - if(this.options.zindex) { - this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); - this.element.style.zIndex = this.options.zindex; - } - - if(this.options.ghosting) { - this._clone = this.element.cloneNode(true); - this._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); - if (!this._originallyAbsolute) - Position.absolutize(this.element); - this.element.parentNode.insertBefore(this._clone, this.element); - } - - if(this.options.scroll) { - if (this.options.scroll == window) { - var where = this._getWindowScroll(this.options.scroll); - this.originalScrollLeft = where.left; - this.originalScrollTop = where.top; - } else { - this.originalScrollLeft = this.options.scroll.scrollLeft; - this.originalScrollTop = this.options.scroll.scrollTop; - } - } - - Draggables.notify('onStart', this, event); - - if(this.options.starteffect) this.options.starteffect(this.element); - }, - - updateDrag: function(event, pointer) { - if(!this.dragging) this.startDrag(event); - - if(!this.options.quiet){ - Position.prepare(); - Droppables.show(pointer, this.element); - } - - Draggables.notify('onDrag', this, event); - - this.draw(pointer); - if(this.options.change) this.options.change(this); - - if(this.options.scroll) { - this.stopScrolling(); - - var p; - if (this.options.scroll == window) { - with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } - } else { - p = Position.page(this.options.scroll); - p[0] += this.options.scroll.scrollLeft + Position.deltaX; - p[1] += this.options.scroll.scrollTop + Position.deltaY; - p.push(p[0]+this.options.scroll.offsetWidth); - p.push(p[1]+this.options.scroll.offsetHeight); - } - var speed = [0,0]; - if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); - if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); - if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); - if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); - this.startScrolling(speed); - } - - // fix AppleWebKit rendering - if(Prototype.Browser.WebKit) window.scrollBy(0,0); - - Event.stop(event); - }, - - finishDrag: function(event, success) { - this.dragging = false; - - if(this.options.quiet){ - Position.prepare(); - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - Droppables.show(pointer, this.element); - } - - if(this.options.ghosting) { - if (!this._originallyAbsolute) - Position.relativize(this.element); - delete this._originallyAbsolute; - Element.remove(this._clone); - this._clone = null; - } - - var dropped = false; - if(success) { - dropped = Droppables.fire(event, this.element); - if (!dropped) dropped = false; - } - if(dropped && this.options.onDropped) this.options.onDropped(this.element); - Draggables.notify('onEnd', this, event); - - var revert = this.options.revert; - if(revert && Object.isFunction(revert)) revert = revert(this.element); - - var d = this.currentDelta(); - if(revert && this.options.reverteffect) { - if (dropped == 0 || revert != 'failure') - this.options.reverteffect(this.element, - d[1]-this.delta[1], d[0]-this.delta[0]); - } else { - this.delta = d; - } - - if(this.options.zindex) - this.element.style.zIndex = this.originalZ; - - if(this.options.endeffect) - this.options.endeffect(this.element); - - Draggables.deactivate(this); - Droppables.reset(); - }, - - keyPress: function(event) { - if(event.keyCode!=Event.KEY_ESC) return; - this.finishDrag(event, false); - Event.stop(event); - }, - - endDrag: function(event) { - if(!this.dragging) return; - this.stopScrolling(); - this.finishDrag(event, true); - Event.stop(event); - }, - - draw: function(point) { - var pos = Position.cumulativeOffset(this.element); - if(this.options.ghosting) { - var r = Position.realOffset(this.element); - pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; - } - - var d = this.currentDelta(); - pos[0] -= d[0]; pos[1] -= d[1]; - - if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { - pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; - pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; - } - - var p = [0,1].map(function(i){ - return (point[i]-pos[i]-this.offset[i]) - }.bind(this)); - - if(this.options.snap) { - if(Object.isFunction(this.options.snap)) { - p = this.options.snap(p[0],p[1],this); - } else { - if(Object.isArray(this.options.snap)) { - p = p.map( function(v, i) { - return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)); - } else { - p = p.map( function(v) { - return (v/this.options.snap).round()*this.options.snap }.bind(this)); - } - }} - - var style = this.element.style; - if((!this.options.constraint) || (this.options.constraint=='horizontal')) - style.left = p[0] + "px"; - if((!this.options.constraint) || (this.options.constraint=='vertical')) - style.top = p[1] + "px"; - - if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering - }, - - stopScrolling: function() { - if(this.scrollInterval) { - clearInterval(this.scrollInterval); - this.scrollInterval = null; - Draggables._lastScrollPointer = null; - } - }, - - startScrolling: function(speed) { - if(!(speed[0] || speed[1])) return; - this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; - this.lastScrolled = new Date(); - this.scrollInterval = setInterval(this.scroll.bind(this), 10); - }, - - scroll: function() { - var current = new Date(); - var delta = current - this.lastScrolled; - this.lastScrolled = current; - if(this.options.scroll == window) { - with (this._getWindowScroll(this.options.scroll)) { - if (this.scrollSpeed[0] || this.scrollSpeed[1]) { - var d = delta / 1000; - this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); - } - } - } else { - this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; - this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; - } - - Position.prepare(); - Droppables.show(Draggables._lastPointer, this.element); - Draggables.notify('onDrag', this); - if (this._isScrollChild) { - Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); - Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; - Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; - if (Draggables._lastScrollPointer[0] < 0) - Draggables._lastScrollPointer[0] = 0; - if (Draggables._lastScrollPointer[1] < 0) - Draggables._lastScrollPointer[1] = 0; - this.draw(Draggables._lastScrollPointer); - } - - if(this.options.change) this.options.change(this); - }, - - _getWindowScroll: function(w) { - var T, L, W, H; - with (w.document) { - if (w.document.documentElement && documentElement.scrollTop) { - T = documentElement.scrollTop; - L = documentElement.scrollLeft; - } else if (w.document.body) { - T = body.scrollTop; - L = body.scrollLeft; - } - if (w.innerWidth) { - W = w.innerWidth; - H = w.innerHeight; - } else if (w.document.documentElement && documentElement.clientWidth) { - W = documentElement.clientWidth; - H = documentElement.clientHeight; - } else { - W = body.offsetWidth; - H = body.offsetHeight; - } - } - return { top: T, left: L, width: W, height: H }; - } -}); - -Draggable._dragging = { }; - -/*--------------------------------------------------------------------------*/ - -var SortableObserver = Class.create({ - initialize: function(element, observer) { - this.element = $(element); - this.observer = observer; - this.lastValue = Sortable.serialize(this.element); - }, - - onStart: function() { - this.lastValue = Sortable.serialize(this.element); - }, - - onEnd: function() { - Sortable.unmark(); - if(this.lastValue != Sortable.serialize(this.element)) - this.observer(this.element) - } -}); - -var Sortable = { - SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, - - sortables: { }, - - _findRootElement: function(element) { - while (element.tagName.toUpperCase() != "BODY") { - if(element.id && Sortable.sortables[element.id]) return element; - element = element.parentNode; - } - }, - - options: function(element) { - element = Sortable._findRootElement($(element)); - if(!element) return; - return Sortable.sortables[element.id]; - }, - - destroy: function(element){ - element = $(element); - var s = Sortable.sortables[element.id]; - - if(s) { - Draggables.removeObserver(s.element); - s.droppables.each(function(d){ Droppables.remove(d) }); - s.draggables.invoke('destroy'); - - delete Sortable.sortables[s.element.id]; - } - }, - - create: function(element) { - element = $(element); - var options = Object.extend({ - element: element, - tag: 'li', // assumes li children, override with tag: 'tagname' - dropOnEmpty: false, - tree: false, - treeTag: 'ul', - overlap: 'vertical', // one of 'vertical', 'horizontal' - constraint: 'vertical', // one of 'vertical', 'horizontal', false - containment: element, // also takes array of elements (or id's); or false - handle: false, // or a CSS class - only: false, - delay: 0, - hoverclass: null, - ghosting: false, - quiet: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - format: this.SERIALIZE_RULE, - - // these take arrays of elements or ids and can be - // used for better initialization performance - elements: false, - handles: false, - - onChange: Prototype.emptyFunction, - onUpdate: Prototype.emptyFunction - }, arguments[1] || { }); - - // clear any old sortable with same element - this.destroy(element); - - // build options for the draggables - var options_for_draggable = { - revert: true, - quiet: options.quiet, - scroll: options.scroll, - scrollSpeed: options.scrollSpeed, - scrollSensitivity: options.scrollSensitivity, - delay: options.delay, - ghosting: options.ghosting, - constraint: options.constraint, - handle: options.handle }; - - if(options.starteffect) - options_for_draggable.starteffect = options.starteffect; - - if(options.reverteffect) - options_for_draggable.reverteffect = options.reverteffect; - else - if(options.ghosting) options_for_draggable.reverteffect = function(element) { - element.style.top = 0; - element.style.left = 0; - }; - - if(options.endeffect) - options_for_draggable.endeffect = options.endeffect; - - if(options.zindex) - options_for_draggable.zindex = options.zindex; - - // build options for the droppables - var options_for_droppable = { - overlap: options.overlap, - containment: options.containment, - tree: options.tree, - hoverclass: options.hoverclass, - onHover: Sortable.onHover - }; - - var options_for_tree = { - onHover: Sortable.onEmptyHover, - overlap: options.overlap, - containment: options.containment, - hoverclass: options.hoverclass - }; - - // fix for gecko engine - Element.cleanWhitespace(element); - - options.draggables = []; - options.droppables = []; - - // drop on empty handling - if(options.dropOnEmpty || options.tree) { - Droppables.add(element, options_for_tree); - options.droppables.push(element); - } - - (options.elements || this.findElements(element, options) || []).each( function(e,i) { - var handle = options.handles ? $(options.handles[i]) : - (options.handle ? $(e).select('.' + options.handle)[0] : e); - options.draggables.push( - new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); - Droppables.add(e, options_for_droppable); - if(options.tree) e.treeNode = element; - options.droppables.push(e); - }); - - if(options.tree) { - (Sortable.findTreeElements(element, options) || []).each( function(e) { - Droppables.add(e, options_for_tree); - e.treeNode = element; - options.droppables.push(e); - }); - } - - // keep reference - this.sortables[element.id] = options; - - // for onupdate - Draggables.addObserver(new SortableObserver(element, options.onUpdate)); - - }, - - // return all suitable-for-sortable elements in a guaranteed order - findElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.tag); - }, - - findTreeElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.treeTag); - }, - - onHover: function(element, dropon, overlap) { - if(Element.isParent(dropon, element)) return; - - if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { - return; - } else if(overlap>0.5) { - Sortable.mark(dropon, 'before'); - if(dropon.previousSibling != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, dropon); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } else { - Sortable.mark(dropon, 'after'); - var nextElement = dropon.nextSibling || null; - if(nextElement != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, nextElement); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } - }, - - onEmptyHover: function(element, dropon, overlap) { - var oldParentNode = element.parentNode; - var droponOptions = Sortable.options(dropon); - - if(!Element.isParent(dropon, element)) { - var index; - - var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); - var child = null; - - if(children) { - var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); - - for (index = 0; index < children.length; index += 1) { - if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { - offset -= Element.offsetSize (children[index], droponOptions.overlap); - } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { - child = index + 1 < children.length ? children[index + 1] : null; - break; - } else { - child = children[index]; - break; - } - } - } - - dropon.insertBefore(element, child); - - Sortable.options(oldParentNode).onChange(element); - droponOptions.onChange(element); - } - }, - - unmark: function() { - if(Sortable._marker) Sortable._marker.hide(); - }, - - mark: function(dropon, position) { - // mark on ghosting only - var sortable = Sortable.options(dropon.parentNode); - if(sortable && !sortable.ghosting) return; - - if(!Sortable._marker) { - Sortable._marker = - ($('dropmarker') || Element.extend(document.createElement('DIV'))). - hide().addClassName('dropmarker').setStyle({position:'absolute'}); - document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); - } - var offsets = Position.cumulativeOffset(dropon); - Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); - - if(position=='after') - if(sortable.overlap == 'horizontal') - Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); - else - Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); - - Sortable._marker.show(); - }, - - _tree: function(element, options, parent) { - var children = Sortable.findElements(element, options) || []; - - for (var i = 0; i < children.length; ++i) { - var match = children[i].id.match(options.format); - - if (!match) continue; - - var child = { - id: encodeURIComponent(match ? match[1] : null), - element: element, - parent: parent, - children: [], - position: parent.children.length, - container: $(children[i]).down(options.treeTag) - }; - - /* Get the element containing the children and recurse over it */ - if (child.container) - this._tree(child.container, options, child); - - parent.children.push (child); - } - - return parent; - }, - - tree: function(element) { - element = $(element); - var sortableOptions = this.options(element); - var options = Object.extend({ - tag: sortableOptions.tag, - treeTag: sortableOptions.treeTag, - only: sortableOptions.only, - name: element.id, - format: sortableOptions.format - }, arguments[1] || { }); - - var root = { - id: null, - parent: null, - children: [], - container: element, - position: 0 - }; - - return Sortable._tree(element, options, root); - }, - - /* Construct a [i] index for a particular node */ - _constructIndex: function(node) { - var index = ''; - do { - if (node.id) index = '[' + node.position + ']' + index; - } while ((node = node.parent) != null); - return index; - }, - - sequence: function(element) { - element = $(element); - var options = Object.extend(this.options(element), arguments[1] || { }); - - return $(this.findElements(element, options) || []).map( function(item) { - return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; - }); - }, - - setSequence: function(element, new_sequence) { - element = $(element); - var options = Object.extend(this.options(element), arguments[2] || { }); - - var nodeMap = { }; - this.findElements(element, options).each( function(n) { - if (n.id.match(options.format)) - nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; - n.parentNode.removeChild(n); - }); - - new_sequence.each(function(ident) { - var n = nodeMap[ident]; - if (n) { - n[1].appendChild(n[0]); - delete nodeMap[ident]; - } - }); - }, - - serialize: function(element) { - element = $(element); - var options = Object.extend(Sortable.options(element), arguments[1] || { }); - var name = encodeURIComponent( - (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); - - if (options.tree) { - return Sortable.tree(element, arguments[1]).children.map( function (item) { - return [name + Sortable._constructIndex(item) + "[id]=" + - encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); - }).flatten().join('&'); - } else { - return Sortable.sequence(element, arguments[1]).map( function(item) { - return name + "[]=" + encodeURIComponent(item); - }).join('&'); - } - } -}; - -// Returns true if child is contained within element -Element.isParent = function(child, element) { - if (!child.parentNode || child == element) return false; - if (child.parentNode == element) return true; - return Element.isParent(child.parentNode, element); -}; - -Element.findChildren = function(element, only, recursive, tagName) { - if(!element.hasChildNodes()) return null; - tagName = tagName.toUpperCase(); - if(only) only = [only].flatten(); - var elements = []; - $A(element.childNodes).each( function(e) { - if(e.tagName && e.tagName.toUpperCase()==tagName && - (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) - elements.push(e); - if(recursive) { - var grandchildren = Element.findChildren(e, only, recursive, tagName); - if(grandchildren) elements.push(grandchildren); - } - }); - - return (elements.length>0 ? elements.flatten() : []); -}; - -Element.offsetSize = function (element, type) { - return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; -}; \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/public/javascripts/effects.js b/oldstuff/RubyFun/rails/hamster/public/javascripts/effects.js deleted file mode 100644 index 5a639d2..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/javascripts/effects.js +++ /dev/null @@ -1,1128 +0,0 @@ -// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// Contributors: -// Justin Palmer (http://encytemedia.com/) -// Mark Pilgrim (http://diveintomark.org/) -// Martin Bialasinki -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// converts rgb() and #xxx to #xxxxxx format, -// returns self (or first argument) if not convertable -String.prototype.parseColor = function() { - var color = '#'; - if (this.slice(0,4) == 'rgb(') { - var cols = this.slice(4,this.length-1).split(','); - var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); - } else { - if (this.slice(0,1) == '#') { - if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); - if (this.length==7) color = this.toLowerCase(); - } - } - return (color.length==7 ? color : (arguments[0] || this)); -}; - -/*--------------------------------------------------------------------------*/ - -Element.collectTextNodes = function(element) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); - }).flatten().join(''); -}; - -Element.collectTextNodesIgnoreClass = function(element, className) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? - Element.collectTextNodesIgnoreClass(node, className) : '')); - }).flatten().join(''); -}; - -Element.setContentZoom = function(element, percent) { - element = $(element); - element.setStyle({fontSize: (percent/100) + 'em'}); - if (Prototype.Browser.WebKit) window.scrollBy(0,0); - return element; -}; - -Element.getInlineOpacity = function(element){ - return $(element).style.opacity || ''; -}; - -Element.forceRerendering = function(element) { - try { - element = $(element); - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch(e) { } -}; - -/*--------------------------------------------------------------------------*/ - -var Effect = { - _elementDoesNotExistError: { - name: 'ElementDoesNotExistError', - message: 'The specified DOM element does not exist, but is required for this effect to operate' - }, - Transitions: { - linear: Prototype.K, - sinoidal: function(pos) { - return (-Math.cos(pos*Math.PI)/2) + .5; - }, - reverse: function(pos) { - return 1-pos; - }, - flicker: function(pos) { - var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4; - return pos > 1 ? 1 : pos; - }, - wobble: function(pos) { - return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5; - }, - pulse: function(pos, pulses) { - return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5; - }, - spring: function(pos) { - return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); - }, - none: function(pos) { - return 0; - }, - full: function(pos) { - return 1; - } - }, - DefaultOptions: { - duration: 1.0, // seconds - fps: 100, // 100= assume 66fps max. - sync: false, // true for combining - from: 0.0, - to: 1.0, - delay: 0.0, - queue: 'parallel' - }, - tagifyText: function(element) { - var tagifyStyle = 'position:relative'; - if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; - - element = $(element); - $A(element.childNodes).each( function(child) { - if (child.nodeType==3) { - child.nodeValue.toArray().each( function(character) { - element.insertBefore( - new Element('span', {style: tagifyStyle}).update( - character == ' ' ? String.fromCharCode(160) : character), - child); - }); - Element.remove(child); - } - }); - }, - multiple: function(element, effect) { - var elements; - if (((typeof element == 'object') || - Object.isFunction(element)) && - (element.length)) - elements = element; - else - elements = $(element).childNodes; - - var options = Object.extend({ - speed: 0.1, - delay: 0.0 - }, arguments[2] || { }); - var masterDelay = options.delay; - - $A(elements).each( function(element, index) { - new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); - }); - }, - PAIRS: { - 'slide': ['SlideDown','SlideUp'], - 'blind': ['BlindDown','BlindUp'], - 'appear': ['Appear','Fade'] - }, - toggle: function(element, effect) { - element = $(element); - effect = (effect || 'appear').toLowerCase(); - var options = Object.extend({ - queue: { position:'end', scope:(element.id || 'global'), limit: 1 } - }, arguments[2] || { }); - Effect[element.visible() ? - Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); - } -}; - -Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; - -/* ------------- core effects ------------- */ - -Effect.ScopedQueue = Class.create(Enumerable, { - initialize: function() { - this.effects = []; - this.interval = null; - }, - _each: function(iterator) { - this.effects._each(iterator); - }, - add: function(effect) { - var timestamp = new Date().getTime(); - - var position = Object.isString(effect.options.queue) ? - effect.options.queue : effect.options.queue.position; - - switch(position) { - case 'front': - // move unstarted effects after this effect - this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { - e.startOn += effect.finishOn; - e.finishOn += effect.finishOn; - }); - break; - case 'with-last': - timestamp = this.effects.pluck('startOn').max() || timestamp; - break; - case 'end': - // start effect after last queued effect has finished - timestamp = this.effects.pluck('finishOn').max() || timestamp; - break; - } - - effect.startOn += timestamp; - effect.finishOn += timestamp; - - if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) - this.effects.push(effect); - - if (!this.interval) - this.interval = setInterval(this.loop.bind(this), 15); - }, - remove: function(effect) { - this.effects = this.effects.reject(function(e) { return e==effect }); - if (this.effects.length == 0) { - clearInterval(this.interval); - this.interval = null; - } - }, - loop: function() { - var timePos = new Date().getTime(); - for(var i=0, len=this.effects.length;i= this.startOn) { - if (timePos >= this.finishOn) { - this.render(1.0); - this.cancel(); - this.event('beforeFinish'); - if (this.finish) this.finish(); - this.event('afterFinish'); - return; - } - var pos = (timePos - this.startOn) / this.totalTime, - frame = (pos * this.totalFrames).round(); - if (frame > this.currentFrame) { - this.render(pos); - this.currentFrame = frame; - } - } - }, - cancel: function() { - if (!this.options.sync) - Effect.Queues.get(Object.isString(this.options.queue) ? - 'global' : this.options.queue.scope).remove(this); - this.state = 'finished'; - }, - event: function(eventName) { - if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); - if (this.options[eventName]) this.options[eventName](this); - }, - inspect: function() { - var data = $H(); - for(property in this) - if (!Object.isFunction(this[property])) data.set(property, this[property]); - return '#'; - } -}); - -Effect.Parallel = Class.create(Effect.Base, { - initialize: function(effects) { - this.effects = effects || []; - this.start(arguments[1]); - }, - update: function(position) { - this.effects.invoke('render', position); - }, - finish: function(position) { - this.effects.each( function(effect) { - effect.render(1.0); - effect.cancel(); - effect.event('beforeFinish'); - if (effect.finish) effect.finish(position); - effect.event('afterFinish'); - }); - } -}); - -Effect.Tween = Class.create(Effect.Base, { - initialize: function(object, from, to) { - object = Object.isString(object) ? $(object) : object; - var args = $A(arguments), method = args.last(), - options = args.length == 5 ? args[3] : null; - this.method = Object.isFunction(method) ? method.bind(object) : - Object.isFunction(object[method]) ? object[method].bind(object) : - function(value) { object[method] = value }; - this.start(Object.extend({ from: from, to: to }, options || { })); - }, - update: function(position) { - this.method(position); - } -}); - -Effect.Event = Class.create(Effect.Base, { - initialize: function() { - this.start(Object.extend({ duration: 0 }, arguments[0] || { })); - }, - update: Prototype.emptyFunction -}); - -Effect.Opacity = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - // make this work on IE on elements without 'layout' - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - var options = Object.extend({ - from: this.element.getOpacity() || 0.0, - to: 1.0 - }, arguments[1] || { }); - this.start(options); - }, - update: function(position) { - this.element.setOpacity(position); - } -}); - -Effect.Move = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - x: 0, - y: 0, - mode: 'relative' - }, arguments[1] || { }); - this.start(options); - }, - setup: function() { - this.element.makePositioned(); - this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); - this.originalTop = parseFloat(this.element.getStyle('top') || '0'); - if (this.options.mode == 'absolute') { - this.options.x = this.options.x - this.originalLeft; - this.options.y = this.options.y - this.originalTop; - } - }, - update: function(position) { - this.element.setStyle({ - left: (this.options.x * position + this.originalLeft).round() + 'px', - top: (this.options.y * position + this.originalTop).round() + 'px' - }); - } -}); - -// for backwards compatibility -Effect.MoveBy = function(element, toTop, toLeft) { - return new Effect.Move(element, - Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); -}; - -Effect.Scale = Class.create(Effect.Base, { - initialize: function(element, percent) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - scaleX: true, - scaleY: true, - scaleContent: true, - scaleFromCenter: false, - scaleMode: 'box', // 'box' or 'contents' or { } with provided values - scaleFrom: 100.0, - scaleTo: percent - }, arguments[2] || { }); - this.start(options); - }, - setup: function() { - this.restoreAfterFinish = this.options.restoreAfterFinish || false; - this.elementPositioning = this.element.getStyle('position'); - - this.originalStyle = { }; - ['top','left','width','height','fontSize'].each( function(k) { - this.originalStyle[k] = this.element.style[k]; - }.bind(this)); - - this.originalTop = this.element.offsetTop; - this.originalLeft = this.element.offsetLeft; - - var fontSize = this.element.getStyle('font-size') || '100%'; - ['em','px','%','pt'].each( function(fontSizeType) { - if (fontSize.indexOf(fontSizeType)>0) { - this.fontSize = parseFloat(fontSize); - this.fontSizeType = fontSizeType; - } - }.bind(this)); - - this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; - - this.dims = null; - if (this.options.scaleMode=='box') - this.dims = [this.element.offsetHeight, this.element.offsetWidth]; - if (/^content/.test(this.options.scaleMode)) - this.dims = [this.element.scrollHeight, this.element.scrollWidth]; - if (!this.dims) - this.dims = [this.options.scaleMode.originalHeight, - this.options.scaleMode.originalWidth]; - }, - update: function(position) { - var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); - if (this.options.scaleContent && this.fontSize) - this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); - this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); - }, - finish: function(position) { - if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); - }, - setDimensions: function(height, width) { - var d = { }; - if (this.options.scaleX) d.width = width.round() + 'px'; - if (this.options.scaleY) d.height = height.round() + 'px'; - if (this.options.scaleFromCenter) { - var topd = (height - this.dims[0])/2; - var leftd = (width - this.dims[1])/2; - if (this.elementPositioning == 'absolute') { - if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; - if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; - } else { - if (this.options.scaleY) d.top = -topd + 'px'; - if (this.options.scaleX) d.left = -leftd + 'px'; - } - } - this.element.setStyle(d); - } -}); - -Effect.Highlight = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); - this.start(options); - }, - setup: function() { - // Prevent executing on elements not in the layout flow - if (this.element.getStyle('display')=='none') { this.cancel(); return; } - // Disable background image during the effect - this.oldStyle = { }; - if (!this.options.keepBackgroundImage) { - this.oldStyle.backgroundImage = this.element.getStyle('background-image'); - this.element.setStyle({backgroundImage: 'none'}); - } - if (!this.options.endcolor) - this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); - if (!this.options.restorecolor) - this.options.restorecolor = this.element.getStyle('background-color'); - // init color calculations - this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); - this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); - }, - update: function(position) { - this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ - return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); - }, - finish: function() { - this.element.setStyle(Object.extend(this.oldStyle, { - backgroundColor: this.options.restorecolor - })); - } -}); - -Effect.ScrollTo = function(element) { - var options = arguments[1] || { }, - scrollOffsets = document.viewport.getScrollOffsets(), - elementOffsets = $(element).cumulativeOffset(); - - if (options.offset) elementOffsets[1] += options.offset; - - return new Effect.Tween(null, - scrollOffsets.top, - elementOffsets[1], - options, - function(p){ scrollTo(scrollOffsets.left, p.round()); } - ); -}; - -/* ------------- combination effects ------------- */ - -Effect.Fade = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - var options = Object.extend({ - from: element.getOpacity() || 1.0, - to: 0.0, - afterFinishInternal: function(effect) { - if (effect.options.to!=0) return; - effect.element.hide().setStyle({opacity: oldOpacity}); - } - }, arguments[1] || { }); - return new Effect.Opacity(element,options); -}; - -Effect.Appear = function(element) { - element = $(element); - var options = Object.extend({ - from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), - to: 1.0, - // force Safari to render floated elements properly - afterFinishInternal: function(effect) { - effect.element.forceRerendering(); - }, - beforeSetup: function(effect) { - effect.element.setOpacity(effect.options.from).show(); - }}, arguments[1] || { }); - return new Effect.Opacity(element,options); -}; - -Effect.Puff = function(element) { - element = $(element); - var oldStyle = { - opacity: element.getInlineOpacity(), - position: element.getStyle('position'), - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height - }; - return new Effect.Parallel( - [ new Effect.Scale(element, 200, - { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], - Object.extend({ duration: 1.0, - beforeSetupInternal: function(effect) { - Position.absolutize(effect.effects[0].element); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().setStyle(oldStyle); } - }, arguments[1] || { }) - ); -}; - -Effect.BlindUp = function(element) { - element = $(element); - element.makeClipping(); - return new Effect.Scale(element, 0, - Object.extend({ scaleContent: false, - scaleX: false, - restoreAfterFinish: true, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }, arguments[1] || { }) - ); -}; - -Effect.BlindDown = function(element) { - element = $(element); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: 0, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping(); - } - }, arguments[1] || { })); -}; - -Effect.SwitchOff = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - return new Effect.Appear(element, Object.extend({ - duration: 0.4, - from: 0, - transition: Effect.Transitions.flicker, - afterFinishInternal: function(effect) { - new Effect.Scale(effect.element, 1, { - duration: 0.3, scaleFromCenter: true, - scaleX: false, scaleContent: false, restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); - } - }); - } - }, arguments[1] || { })); -}; - -Effect.DropOut = function(element) { - element = $(element); - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left'), - opacity: element.getInlineOpacity() }; - return new Effect.Parallel( - [ new Effect.Move(element, {x: 0, y: 100, sync: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 }) ], - Object.extend( - { duration: 0.5, - beforeSetup: function(effect) { - effect.effects[0].element.makePositioned(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); - } - }, arguments[1] || { })); -}; - -Effect.Shake = function(element) { - element = $(element); - var options = Object.extend({ - distance: 20, - duration: 0.5 - }, arguments[1] || {}); - var distance = parseFloat(options.distance); - var split = parseFloat(options.duration) / 10.0; - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left') }; - return new Effect.Move(element, - { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { - effect.element.undoPositioned().setStyle(oldStyle); - }}); }}); }}); }}); }}); }}); -}; - -Effect.SlideDown = function(element) { - element = $(element).cleanWhitespace(); - // SlideDown need to have the content of the element wrapped in a container element with fixed height! - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: window.opera ? 0 : 1, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } - }, arguments[1] || { }) - ); -}; - -Effect.SlideUp = function(element) { - element = $(element).cleanWhitespace(); - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, window.opera ? 0 : 1, - Object.extend({ scaleContent: false, - scaleX: false, - scaleMode: 'box', - scaleFrom: 100, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); - } - }, arguments[1] || { }) - ); -}; - -// Bug in opera makes the TD containing this element expand for a instance after finish -Effect.Squish = function(element) { - return new Effect.Scale(element, window.opera ? 1 : 0, { - restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }); -}; - -Effect.Grow = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.full - }, arguments[1] || { }); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var initialMoveX, initialMoveY; - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - initialMoveX = initialMoveY = moveX = moveY = 0; - break; - case 'top-right': - initialMoveX = dims.width; - initialMoveY = moveY = 0; - moveX = -dims.width; - break; - case 'bottom-left': - initialMoveX = moveX = 0; - initialMoveY = dims.height; - moveY = -dims.height; - break; - case 'bottom-right': - initialMoveX = dims.width; - initialMoveY = dims.height; - moveX = -dims.width; - moveY = -dims.height; - break; - case 'center': - initialMoveX = dims.width / 2; - initialMoveY = dims.height / 2; - moveX = -dims.width / 2; - moveY = -dims.height / 2; - break; - } - - return new Effect.Move(element, { - x: initialMoveX, - y: initialMoveY, - duration: 0.01, - beforeSetup: function(effect) { - effect.element.hide().makeClipping().makePositioned(); - }, - afterFinishInternal: function(effect) { - new Effect.Parallel( - [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), - new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), - new Effect.Scale(effect.element, 100, { - scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, - sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) - ], Object.extend({ - beforeSetup: function(effect) { - effect.effects[0].element.setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); - } - }, options) - ); - } - }); -}; - -Effect.Shrink = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.none - }, arguments[1] || { }); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - moveX = moveY = 0; - break; - case 'top-right': - moveX = dims.width; - moveY = 0; - break; - case 'bottom-left': - moveX = 0; - moveY = dims.height; - break; - case 'bottom-right': - moveX = dims.width; - moveY = dims.height; - break; - case 'center': - moveX = dims.width / 2; - moveY = dims.height / 2; - break; - } - - return new Effect.Parallel( - [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), - new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), - new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) - ], Object.extend({ - beforeStartInternal: function(effect) { - effect.effects[0].element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } - }, options) - ); -}; - -Effect.Pulsate = function(element) { - element = $(element); - var options = arguments[1] || { }, - oldOpacity = element.getInlineOpacity(), - transition = options.transition || Effect.Transitions.linear, - reverser = function(pos){ - return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5); - }; - - return new Effect.Opacity(element, - Object.extend(Object.extend({ duration: 2.0, from: 0, - afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } - }, options), {transition: reverser})); -}; - -Effect.Fold = function(element) { - element = $(element); - var oldStyle = { - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height }; - element.makeClipping(); - return new Effect.Scale(element, 5, Object.extend({ - scaleContent: false, - scaleX: false, - afterFinishInternal: function(effect) { - new Effect.Scale(element, 1, { - scaleContent: false, - scaleY: false, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().setStyle(oldStyle); - } }); - }}, arguments[1] || { })); -}; - -Effect.Morph = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - style: { } - }, arguments[1] || { }); - - if (!Object.isString(options.style)) this.style = $H(options.style); - else { - if (options.style.include(':')) - this.style = options.style.parseStyle(); - else { - this.element.addClassName(options.style); - this.style = $H(this.element.getStyles()); - this.element.removeClassName(options.style); - var css = this.element.getStyles(); - this.style = this.style.reject(function(style) { - return style.value == css[style.key]; - }); - options.afterFinishInternal = function(effect) { - effect.element.addClassName(effect.options.style); - effect.transforms.each(function(transform) { - effect.element.style[transform.style] = ''; - }); - }; - } - } - this.start(options); - }, - - setup: function(){ - function parseColor(color){ - if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; - color = color.parseColor(); - return $R(0,2).map(function(i){ - return parseInt( color.slice(i*2+1,i*2+3), 16 ); - }); - } - this.transforms = this.style.map(function(pair){ - var property = pair[0], value = pair[1], unit = null; - - if (value.parseColor('#zzzzzz') != '#zzzzzz') { - value = value.parseColor(); - unit = 'color'; - } else if (property == 'opacity') { - value = parseFloat(value); - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - } else if (Element.CSS_LENGTH.test(value)) { - var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); - value = parseFloat(components[1]); - unit = (components.length == 3) ? components[2] : null; - } - - var originalValue = this.element.getStyle(property); - return { - style: property.camelize(), - originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), - targetValue: unit=='color' ? parseColor(value) : value, - unit: unit - }; - }.bind(this)).reject(function(transform){ - return ( - (transform.originalValue == transform.targetValue) || - ( - transform.unit != 'color' && - (isNaN(transform.originalValue) || isNaN(transform.targetValue)) - ) - ); - }); - }, - update: function(position) { - var style = { }, transform, i = this.transforms.length; - while(i--) - style[(transform = this.transforms[i]).style] = - transform.unit=='color' ? '#'+ - (Math.round(transform.originalValue[0]+ - (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + - (Math.round(transform.originalValue[1]+ - (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + - (Math.round(transform.originalValue[2]+ - (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : - (transform.originalValue + - (transform.targetValue - transform.originalValue) * position).toFixed(3) + - (transform.unit === null ? '' : transform.unit); - this.element.setStyle(style, true); - } -}); - -Effect.Transform = Class.create({ - initialize: function(tracks){ - this.tracks = []; - this.options = arguments[1] || { }; - this.addTracks(tracks); - }, - addTracks: function(tracks){ - tracks.each(function(track){ - track = $H(track); - var data = track.values().first(); - this.tracks.push($H({ - ids: track.keys().first(), - effect: Effect.Morph, - options: { style: data } - })); - }.bind(this)); - return this; - }, - play: function(){ - return new Effect.Parallel( - this.tracks.map(function(track){ - var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); - var elements = [$(ids) || $$(ids)].flatten(); - return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); - }).flatten(), - this.options - ); - } -}); - -Element.CSS_PROPERTIES = $w( - 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + - 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + - 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + - 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + - 'fontSize fontWeight height left letterSpacing lineHeight ' + - 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ - 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + - 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + - 'right textIndent top width wordSpacing zIndex'); - -Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; - -String.__parseStyleElement = document.createElement('div'); -String.prototype.parseStyle = function(){ - var style, styleRules = $H(); - if (Prototype.Browser.WebKit) - style = new Element('div',{style:this}).style; - else { - String.__parseStyleElement.innerHTML = '
    '; - style = String.__parseStyleElement.childNodes[0].style; - } - - Element.CSS_PROPERTIES.each(function(property){ - if (style[property]) styleRules.set(property, style[property]); - }); - - if (Prototype.Browser.IE && this.include('opacity')) - styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); - - return styleRules; -}; - -if (document.defaultView && document.defaultView.getComputedStyle) { - Element.getStyles = function(element) { - var css = document.defaultView.getComputedStyle($(element), null); - return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { - styles[property] = css[property]; - return styles; - }); - }; -} else { - Element.getStyles = function(element) { - element = $(element); - var css = element.currentStyle, styles; - styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { - results[property] = css[property]; - return results; - }); - if (!styles.opacity) styles.opacity = element.getOpacity(); - return styles; - }; -} - -Effect.Methods = { - morph: function(element, style) { - element = $(element); - new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); - return element; - }, - visualEffect: function(element, effect, options) { - element = $(element); - var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); - new Effect[klass](element, options); - return element; - }, - highlight: function(element, options) { - element = $(element); - new Effect.Highlight(element, options); - return element; - } -}; - -$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ - 'pulsate shake puff squish switchOff dropOut').each( - function(effect) { - Effect.Methods[effect] = function(element, options){ - element = $(element); - Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); - return element; - }; - } -); - -$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( - function(f) { Effect.Methods[f] = Element[f]; } -); - -Element.addMethods(Effect.Methods); \ No newline at end of file diff --git a/oldstuff/RubyFun/rails/hamster/public/javascripts/prototype.js b/oldstuff/RubyFun/rails/hamster/public/javascripts/prototype.js deleted file mode 100644 index dfe8ab4..0000000 --- a/oldstuff/RubyFun/rails/hamster/public/javascripts/prototype.js +++ /dev/null @@ -1,4320 +0,0 @@ -/* Prototype JavaScript framework, version 1.6.0.3 - * (c) 2005-2008 Sam Stephenson - * - * Prototype is freely distributable under the terms of an MIT-style license. - * For details, see the Prototype web site: http://www.prototypejs.org/ - * - *--------------------------------------------------------------------------*/ - -var Prototype = { - Version: '1.6.0.3', - - Browser: { - IE: !!(window.attachEvent && - navigator.userAgent.indexOf('Opera') === -1), - Opera: navigator.userAgent.indexOf('Opera') > -1, - WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, - Gecko: navigator.userAgent.indexOf('Gecko') > -1 && - navigator.userAgent.indexOf('KHTML') === -1, - MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) - }, - - BrowserFeatures: { - XPath: !!document.evaluate, - SelectorsAPI: !!document.querySelector, - ElementExtensions: !!window.HTMLElement, - SpecificElementExtensions: - document.createElement('div')['__proto__'] && - document.createElement('div')['__proto__'] !== - document.createElement('form')['__proto__'] - }, - - ScriptFragment: ']*>([\\S\\s]*?)<\/script>', - JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, - - emptyFunction: function() { }, - K: function(x) { return x } -}; - -if (Prototype.Browser.MobileSafari) - Prototype.BrowserFeatures.SpecificElementExtensions = false; - - -/* Based on Alex Arnell's inheritance implementation. */ -var Class = { - create: function() { - var parent = null, properties = $A(arguments); - if (Object.isFunction(properties[0])) - parent = properties.shift(); - - function klass() { - this.initialize.apply(this, arguments); - } - - Object.extend(klass, Class.Methods); - klass.superclass = parent; - klass.subclasses = []; - - if (parent) { - var subclass = function() { }; - subclass.prototype = parent.prototype; - klass.prototype = new subclass; - parent.subclasses.push(klass); - } - - for (var i = 0; i < properties.length; i++) - klass.addMethods(properties[i]); - - if (!klass.prototype.initialize) - klass.prototype.initialize = Prototype.emptyFunction; - - klass.prototype.constructor = klass; - - return klass; - } -}; - -Class.Methods = { - addMethods: function(source) { - var ancestor = this.superclass && this.superclass.prototype; - var properties = Object.keys(source); - - if (!Object.keys({ toString: true }).length) - properties.push("toString", "valueOf"); - - for (var i = 0, length = properties.length; i < length; i++) { - var property = properties[i], value = source[property]; - if (ancestor && Object.isFunction(value) && - value.argumentNames().first() == "$super") { - var method = value; - value = (function(m) { - return function() { return ancestor[m].apply(this, arguments) }; - })(property).wrap(method); - - value.valueOf = method.valueOf.bind(method); - value.toString = method.toString.bind(method); - } - this.prototype[property] = value; - } - - return this; - } -}; - -var Abstract = { }; - -Object.extend = function(destination, source) { - for (var property in source) - destination[property] = source[property]; - return destination; -}; - -Object.extend(Object, { - inspect: function(object) { - try { - if (Object.isUndefined(object)) return 'undefined'; - if (object === null) return 'null'; - return object.inspect ? object.inspect() : String(object); - } catch (e) { - if (e instanceof RangeError) return '...'; - throw e; - } - }, - - toJSON: function(object) { - var type = typeof object; - switch (type) { - case 'undefined': - case 'function': - case 'unknown': return; - case 'boolean': return object.toString(); - } - - if (object === null) return 'null'; - if (object.toJSON) return object.toJSON(); - if (Object.isElement(object)) return; - - var results = []; - for (var property in object) { - var value = Object.toJSON(object[property]); - if (!Object.isUndefined(value)) - results.push(property.toJSON() + ': ' + value); - } - - return '{' + results.join(', ') + '}'; - }, - - toQueryString: function(object) { - return $H(object).toQueryString(); - }, - - toHTML: function(object) { - return object && object.toHTML ? object.toHTML() : String.interpret(object); - }, - - keys: function(object) { - var keys = []; - for (var property in object) - keys.push(property); - return keys; - }, - - values: function(object) { - var values = []; - for (var property in object) - values.push(object[property]); - return values; - }, - - clone: function(object) { - return Object.extend({ }, object); - }, - - isElement: function(object) { - return !!(object && object.nodeType == 1); - }, - - isArray: function(object) { - return object != null && typeof object == "object" && - 'splice' in object && 'join' in object; - }, - - isHash: function(object) { - return object instanceof Hash; - }, - - isFunction: function(object) { - return typeof object == "function"; - }, - - isString: function(object) { - return typeof object == "string"; - }, - - isNumber: function(object) { - return typeof object == "number"; - }, - - isUndefined: function(object) { - return typeof object == "undefined"; - } -}); - -Object.extend(Function.prototype, { - argumentNames: function() { - var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1] - .replace(/\s+/g, '').split(','); - return names.length == 1 && !names[0] ? [] : names; - }, - - bind: function() { - if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; - var __method = this, args = $A(arguments), object = args.shift(); - return function() { - return __method.apply(object, args.concat($A(arguments))); - } - }, - - bindAsEventListener: function() { - var __method = this, args = $A(arguments), object = args.shift(); - return function(event) { - return __method.apply(object, [event || window.event].concat(args)); - } - }, - - curry: function() { - if (!arguments.length) return this; - var __method = this, args = $A(arguments); - return function() { - return __method.apply(this, args.concat($A(arguments))); - } - }, - - delay: function() { - var __method = this, args = $A(arguments), timeout = args.shift() * 1000; - return window.setTimeout(function() { - return __method.apply(__method, args); - }, timeout); - }, - - defer: function() { - var args = [0.01].concat($A(arguments)); - return this.delay.apply(this, args); - }, - - wrap: function(wrapper) { - var __method = this; - return function() { - return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); - } - }, - - methodize: function() { - if (this._methodized) return this._methodized; - var __method = this; - return this._methodized = function() { - return __method.apply(null, [this].concat($A(arguments))); - }; - } -}); - -Date.prototype.toJSON = function() { - return '"' + this.getUTCFullYear() + '-' + - (this.getUTCMonth() + 1).toPaddedString(2) + '-' + - this.getUTCDate().toPaddedString(2) + 'T' + - this.getUTCHours().toPaddedString(2) + ':' + - this.getUTCMinutes().toPaddedString(2) + ':' + - this.getUTCSeconds().toPaddedString(2) + 'Z"'; -}; - -var Try = { - these: function() { - var returnValue; - - for (var i = 0, length = arguments.length; i < length; i++) { - var lambda = arguments[i]; - try { - returnValue = lambda(); - break; - } catch (e) { } - } - - return returnValue; - } -}; - -RegExp.prototype.match = RegExp.prototype.test; - -RegExp.escape = function(str) { - return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); -}; - -/*--------------------------------------------------------------------------*/ - -var PeriodicalExecuter = Class.create({ - initialize: function(callback, frequency) { - this.callback = callback; - this.frequency = frequency; - this.currentlyExecuting = false; - - this.registerCallback(); - }, - - registerCallback: function() { - this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - execute: function() { - this.callback(this); - }, - - stop: function() { - if (!this.timer) return; - clearInterval(this.timer); - this.timer = null; - }, - - onTimerEvent: function() { - if (!this.currentlyExecuting) { - try { - this.currentlyExecuting = true; - this.execute(); - } finally { - this.currentlyExecuting = false; - } - } - } -}); -Object.extend(String, { - interpret: function(value) { - return value == null ? '' : String(value); - }, - specialChar: { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '\\': '\\\\' - } -}); - -Object.extend(String.prototype, { - gsub: function(pattern, replacement) { - var result = '', source = this, match; - replacement = arguments.callee.prepareReplacement(replacement); - - while (source.length > 0) { - if (match = source.match(pattern)) { - result += source.slice(0, match.index); - result += String.interpret(replacement(match)); - source = source.slice(match.index + match[0].length); - } else { - result += source, source = ''; - } - } - return result; - }, - - sub: function(pattern, replacement, count) { - replacement = this.gsub.prepareReplacement(replacement); - count = Object.isUndefined(count) ? 1 : count; - - return this.gsub(pattern, function(match) { - if (--count < 0) return match[0]; - return replacement(match); - }); - }, - - scan: function(pattern, iterator) { - this.gsub(pattern, iterator); - return String(this); - }, - - truncate: function(length, truncation) { - length = length || 30; - truncation = Object.isUndefined(truncation) ? '...' : truncation; - return this.length > length ? - this.slice(0, length - truncation.length) + truncation : String(this); - }, - - strip: function() { - return this.replace(/^\s+/, '').replace(/\s+$/, ''); - }, - - stripTags: function() { - return this.replace(/<\/?[^>]+>/gi, ''); - }, - - stripScripts: function() { - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); - }, - - extractScripts: function() { - var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); - var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); - return (this.match(matchAll) || []).map(function(scriptTag) { - return (scriptTag.match(matchOne) || ['', ''])[1]; - }); - }, - - evalScripts: function() { - return this.extractScripts().map(function(script) { return eval(script) }); - }, - - escapeHTML: function() { - var self = arguments.callee; - self.text.data = this; - return self.div.innerHTML; - }, - - unescapeHTML: function() { - var div = new Element('div'); - div.innerHTML = this.stripTags(); - return div.childNodes[0] ? (div.childNodes.length > 1 ? - $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : - div.childNodes[0].nodeValue) : ''; - }, - - toQueryParams: function(separator) { - var match = this.strip().match(/([^?#]*)(#.*)?$/); - if (!match) return { }; - - return match[1].split(separator || '&').inject({ }, function(hash, pair) { - if ((pair = pair.split('='))[0]) { - var key = decodeURIComponent(pair.shift()); - var value = pair.length > 1 ? pair.join('=') : pair[0]; - if (value != undefined) value = decodeURIComponent(value); - - if (key in hash) { - if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; - hash[key].push(value); - } - else hash[key] = value; - } - return hash; - }); - }, - - toArray: function() { - return this.split(''); - }, - - succ: function() { - return this.slice(0, this.length - 1) + - String.fromCharCode(this.charCodeAt(this.length - 1) + 1); - }, - - times: function(count) { - return count < 1 ? '' : new Array(count + 1).join(this); - }, - - camelize: function() { - var parts = this.split('-'), len = parts.length; - if (len == 1) return parts[0]; - - var camelized = this.charAt(0) == '-' - ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) - : parts[0]; - - for (var i = 1; i < len; i++) - camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); - - return camelized; - }, - - capitalize: function() { - return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); - }, - - underscore: function() { - return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); - }, - - dasherize: function() { - return this.gsub(/_/,'-'); - }, - - inspect: function(useDoubleQuotes) { - var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { - var character = String.specialChar[match[0]]; - return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); - }); - if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; - return "'" + escapedString.replace(/'/g, '\\\'') + "'"; - }, - - toJSON: function() { - return this.inspect(true); - }, - - unfilterJSON: function(filter) { - return this.sub(filter || Prototype.JSONFilter, '#{1}'); - }, - - isJSON: function() { - var str = this; - if (str.blank()) return false; - str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); - return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); - }, - - evalJSON: function(sanitize) { - var json = this.unfilterJSON(); - try { - if (!sanitize || json.isJSON()) return eval('(' + json + ')'); - } catch (e) { } - throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); - }, - - include: function(pattern) { - return this.indexOf(pattern) > -1; - }, - - startsWith: function(pattern) { - return this.indexOf(pattern) === 0; - }, - - endsWith: function(pattern) { - var d = this.length - pattern.length; - return d >= 0 && this.lastIndexOf(pattern) === d; - }, - - empty: function() { - return this == ''; - }, - - blank: function() { - return /^\s*$/.test(this); - }, - - interpolate: function(object, pattern) { - return new Template(this, pattern).evaluate(object); - } -}); - -if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { - escapeHTML: function() { - return this.replace(/&/g,'&').replace(//g,'>'); - }, - unescapeHTML: function() { - return this.stripTags().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); - } -}); - -String.prototype.gsub.prepareReplacement = function(replacement) { - if (Object.isFunction(replacement)) return replacement; - var template = new Template(replacement); - return function(match) { return template.evaluate(match) }; -}; - -String.prototype.parseQuery = String.prototype.toQueryParams; - -Object.extend(String.prototype.escapeHTML, { - div: document.createElement('div'), - text: document.createTextNode('') -}); - -String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text); - -var Template = Class.create({ - initialize: function(template, pattern) { - this.template = template.toString(); - this.pattern = pattern || Template.Pattern; - }, - - evaluate: function(object) { - if (Object.isFunction(object.toTemplateReplacements)) - object = object.toTemplateReplacements(); - - return this.template.gsub(this.pattern, function(match) { - if (object == null) return ''; - - var before = match[1] || ''; - if (before == '\\') return match[2]; - - var ctx = object, expr = match[3]; - var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; - match = pattern.exec(expr); - if (match == null) return before; - - while (match != null) { - var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; - ctx = ctx[comp]; - if (null == ctx || '' == match[3]) break; - expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); - match = pattern.exec(expr); - } - - return before + String.interpret(ctx); - }); - } -}); -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; - -var $break = { }; - -var Enumerable = { - each: function(iterator, context) { - var index = 0; - try { - this._each(function(value) { - iterator.call(context, value, index++); - }); - } catch (e) { - if (e != $break) throw e; - } - return this; - }, - - eachSlice: function(number, iterator, context) { - var index = -number, slices = [], array = this.toArray(); - if (number < 1) return array; - while ((index += number) < array.length) - slices.push(array.slice(index, index+number)); - return slices.collect(iterator, context); - }, - - all: function(iterator, context) { - iterator = iterator || Prototype.K; - var result = true; - this.each(function(value, index) { - result = result && !!iterator.call(context, value, index); - if (!result) throw $break; - }); - return result; - }, - - any: function(iterator, context) { - iterator = iterator || Prototype.K; - var result = false; - this.each(function(value, index) { - if (result = !!iterator.call(context, value, index)) - throw $break; - }); - return result; - }, - - collect: function(iterator, context) { - iterator = iterator || Prototype.K; - var results = []; - this.each(function(value, index) { - results.push(iterator.call(context, value, index)); - }); - return results; - }, - - detect: function(iterator, context) { - var result; - this.each(function(value, index) { - if (iterator.call(context, value, index)) { - result = value; - throw $break; - } - }); - return result; - }, - - findAll: function(iterator, context) { - var results = []; - this.each(function(value, index) { - if (iterator.call(context, value, index)) - results.push(value); - }); - return results; - }, - - grep: function(filter, iterator, context) { - iterator = iterator || Prototype.K; - var results = []; - - if (Object.isString(filter)) - filter = new RegExp(filter); - - this.each(function(value, index) { - if (filter.match(value)) - results.push(iterator.call(context, value, index)); - }); - return results; - }, - - include: function(object) { - if (Object.isFunction(this.indexOf)) - if (this.indexOf(object) != -1) return true; - - var found = false; - this.each(function(value) { - if (value == object) { - found = true; - throw $break; - } - }); - return found; - }, - - inGroupsOf: function(number, fillWith) { - fillWith = Object.isUndefined(fillWith) ? null : fillWith; - return this.eachSlice(number, function(slice) { - while(slice.length < number) slice.push(fillWith); - return slice; - }); - }, - - inject: function(memo, iterator, context) { - this.each(function(value, index) { - memo = iterator.call(context, memo, value, index); - }); - return memo; - }, - - invoke: function(method) { - var args = $A(arguments).slice(1); - return this.map(function(value) { - return value[method].apply(value, args); - }); - }, - - max: function(iterator, context) { - iterator = iterator || Prototype.K; - var result; - this.each(function(value, index) { - value = iterator.call(context, value, index); - if (result == null || value >= result) - result = value; - }); - return result; - }, - - min: function(iterator, context) { - iterator = iterator || Prototype.K; - var result; - this.each(function(value, index) { - value = iterator.call(context, value, index); - if (result == null || value < result) - result = value; - }); - return result; - }, - - partition: function(iterator, context) { - iterator = iterator || Prototype.K; - var trues = [], falses = []; - this.each(function(value, index) { - (iterator.call(context, value, index) ? - trues : falses).push(value); - }); - return [trues, falses]; - }, - - pluck: function(property) { - var results = []; - this.each(function(value) { - results.push(value[property]); - }); - return results; - }, - - reject: function(iterator, context) { - var results = []; - this.each(function(value, index) { - if (!iterator.call(context, value, index)) - results.push(value); - }); - return results; - }, - - sortBy: function(iterator, context) { - return this.map(function(value, index) { - return { - value: value, - criteria: iterator.call(context, value, index) - }; - }).sort(function(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }).pluck('value'); - }, - - toArray: function() { - return this.map(); - }, - - zip: function() { - var iterator = Prototype.K, args = $A(arguments); - if (Object.isFunction(args.last())) - iterator = args.pop(); - - var collections = [this].concat(args).map($A); - return this.map(function(value, index) { - return iterator(collections.pluck(index)); - }); - }, - - size: function() { - return this.toArray().length; - }, - - inspect: function() { - return '#'; - } -}; - -Object.extend(Enumerable, { - map: Enumerable.collect, - find: Enumerable.detect, - select: Enumerable.findAll, - filter: Enumerable.findAll, - member: Enumerable.include, - entries: Enumerable.toArray, - every: Enumerable.all, - some: Enumerable.any -}); -function $A(iterable) { - if (!iterable) return []; - if (iterable.toArray) return iterable.toArray(); - var length = iterable.length || 0, results = new Array(length); - while (length--) results[length] = iterable[length]; - return results; -} - -if (Prototype.Browser.WebKit) { - $A = function(iterable) { - if (!iterable) return []; - // In Safari, only use the `toArray` method if it's not a NodeList. - // A NodeList is a function, has an function `item` property, and a numeric - // `length` property. Adapted from Google Doctype. - if (!(typeof iterable === 'function' && typeof iterable.length === - 'number' && typeof iterable.item === 'function') && iterable.toArray) - return iterable.toArray(); - var length = iterable.length || 0, results = new Array(length); - while (length--) results[length] = iterable[length]; - return results; - }; -} - -Array.from = $A; - -Object.extend(Array.prototype, Enumerable); - -if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; - -Object.extend(Array.prototype, { - _each: function(iterator) { - for (var i = 0, length = this.length; i < length; i++) - iterator(this[i]); - }, - - clear: function() { - this.length = 0; - return this; - }, - - first: function() { - return this[0]; - }, - - last: function() { - return this[this.length - 1]; - }, - - compact: function() { - return this.select(function(value) { - return value != null; - }); - }, - - flatten: function() { - return this.inject([], function(array, value) { - return array.concat(Object.isArray(value) ? - value.flatten() : [value]); - }); - }, - - without: function() { - var values = $A(arguments); - return this.select(function(value) { - return !values.include(value); - }); - }, - - reverse: function(inline) { - return (inline !== false ? this : this.toArray())._reverse(); - }, - - reduce: function() { - return this.length > 1 ? this : this[0]; - }, - - uniq: function(sorted) { - return this.inject([], function(array, value, index) { - if (0 == index || (sorted ? array.last() != value : !array.include(value))) - array.push(value); - return array; - }); - }, - - intersect: function(array) { - return this.uniq().findAll(function(item) { - return array.detect(function(value) { return item === value }); - }); - }, - - clone: function() { - return [].concat(this); - }, - - size: function() { - return this.length; - }, - - inspect: function() { - return '[' + this.map(Object.inspect).join(', ') + ']'; - }, - - toJSON: function() { - var results = []; - this.each(function(object) { - var value = Object.toJSON(object); - if (!Object.isUndefined(value)) results.push(value); - }); - return '[' + results.join(', ') + ']'; - } -}); - -// use native browser JS 1.6 implementation if available -if (Object.isFunction(Array.prototype.forEach)) - Array.prototype._each = Array.prototype.forEach; - -if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) { - i || (i = 0); - var length = this.length; - if (i < 0) i = length + i; - for (; i < length; i++) - if (this[i] === item) return i; - return -1; -}; - -if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) { - i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; - var n = this.slice(0, i).reverse().indexOf(item); - return (n < 0) ? n : i - n - 1; -}; - -Array.prototype.toArray = Array.prototype.clone; - -function $w(string) { - if (!Object.isString(string)) return []; - string = string.strip(); - return string ? string.split(/\s+/) : []; -} - -if (Prototype.Browser.Opera){ - Array.prototype.concat = function() { - var array = []; - for (var i = 0, length = this.length; i < length; i++) array.push(this[i]); - for (var i = 0, length = arguments.length; i < length; i++) { - if (Object.isArray(arguments[i])) { - for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) - array.push(arguments[i][j]); - } else { - array.push(arguments[i]); - } - } - return array; - }; -} -Object.extend(Number.prototype, { - toColorPart: function() { - return this.toPaddedString(2, 16); - }, - - succ: function() { - return this + 1; - }, - - times: function(iterator, context) { - $R(0, this, true).each(iterator, context); - return this; - }, - - toPaddedString: function(length, radix) { - var string = this.toString(radix || 10); - return '0'.times(length - string.length) + string; - }, - - toJSON: function() { - return isFinite(this) ? this.toString() : 'null'; - } -}); - -$w('abs round ceil floor').each(function(method){ - Number.prototype[method] = Math[method].methodize(); -}); -function $H(object) { - return new Hash(object); -}; - -var Hash = Class.create(Enumerable, (function() { - - function toQueryPair(key, value) { - if (Object.isUndefined(value)) return key; - return key + '=' + encodeURIComponent(String.interpret(value)); - } - - return { - initialize: function(object) { - this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); - }, - - _each: function(iterator) { - for (var key in this._object) { - var value = this._object[key], pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); - } - }, - - set: function(key, value) { - return this._object[key] = value; - }, - - get: function(key) { - // simulating poorly supported hasOwnProperty - if (this._object[key] !== Object.prototype[key]) - return this._object[key]; - }, - - unset: function(key) { - var value = this._object[key]; - delete this._object[key]; - return value; - }, - - toObject: function() { - return Object.clone(this._object); - }, - - keys: function() { - return this.pluck('key'); - }, - - values: function() { - return this.pluck('value'); - }, - - index: function(value) { - var match = this.detect(function(pair) { - return pair.value === value; - }); - return match && match.key; - }, - - merge: function(object) { - return this.clone().update(object); - }, - - update: function(object) { - return new Hash(object).inject(this, function(result, pair) { - result.set(pair.key, pair.value); - return result; - }); - }, - - toQueryString: function() { - return this.inject([], function(results, pair) { - var key = encodeURIComponent(pair.key), values = pair.value; - - if (values && typeof values == 'object') { - if (Object.isArray(values)) - return results.concat(values.map(toQueryPair.curry(key))); - } else results.push(toQueryPair(key, values)); - return results; - }).join('&'); - }, - - inspect: function() { - return '#'; - }, - - toJSON: function() { - return Object.toJSON(this.toObject()); - }, - - clone: function() { - return new Hash(this); - } - } -})()); - -Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; -Hash.from = $H; -var ObjectRange = Class.create(Enumerable, { - initialize: function(start, end, exclusive) { - this.start = start; - this.end = end; - this.exclusive = exclusive; - }, - - _each: function(iterator) { - var value = this.start; - while (this.include(value)) { - iterator(value); - value = value.succ(); - } - }, - - include: function(value) { - if (value < this.start) - return false; - if (this.exclusive) - return value < this.end; - return value <= this.end; - } -}); - -var $R = function(start, end, exclusive) { - return new ObjectRange(start, end, exclusive); -}; - -var Ajax = { - getTransport: function() { - return Try.these( - function() {return new XMLHttpRequest()}, - function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')} - ) || false; - }, - - activeRequestCount: 0 -}; - -Ajax.Responders = { - responders: [], - - _each: function(iterator) { - this.responders._each(iterator); - }, - - register: function(responder) { - if (!this.include(responder)) - this.responders.push(responder); - }, - - unregister: function(responder) { - this.responders = this.responders.without(responder); - }, - - dispatch: function(callback, request, transport, json) { - this.each(function(responder) { - if (Object.isFunction(responder[callback])) { - try { - responder[callback].apply(responder, [request, transport, json]); - } catch (e) { } - } - }); - } -}; - -Object.extend(Ajax.Responders, Enumerable); - -Ajax.Responders.register({ - onCreate: function() { Ajax.activeRequestCount++ }, - onComplete: function() { Ajax.activeRequestCount-- } -}); - -Ajax.Base = Class.create({ - initialize: function(options) { - this.options = { - method: 'post', - asynchronous: true, - contentType: 'application/x-www-form-urlencoded', - encoding: 'UTF-8', - parameters: '', - evalJSON: true, - evalJS: true - }; - Object.extend(this.options, options || { }); - - this.options.method = this.options.method.toLowerCase(); - - if (Object.isString(this.options.parameters)) - this.options.parameters = this.options.parameters.toQueryParams(); - else if (Object.isHash(this.options.parameters)) - this.options.parameters = this.options.parameters.toObject(); - } -}); - -Ajax.Request = Class.create(Ajax.Base, { - _complete: false, - - initialize: function($super, url, options) { - $super(options); - this.transport = Ajax.getTransport(); - this.request(url); - }, - - request: function(url) { - this.url = url; - this.method = this.options.method; - var params = Object.clone(this.options.parameters); - - if (!['get', 'post'].include(this.method)) { - // simulate other verbs over post - params['_method'] = this.method; - this.method = 'post'; - } - - this.parameters = params; - - if (params = Object.toQueryString(params)) { - // when GET, append parameters to URL - if (this.method == 'get') - this.url += (this.url.include('?') ? '&' : '?') + params; - else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) - params += '&_='; - } - - try { - var response = new Ajax.Response(this); - if (this.options.onCreate) this.options.onCreate(response); - Ajax.Responders.dispatch('onCreate', this, response); - - this.transport.open(this.method.toUpperCase(), this.url, - this.options.asynchronous); - - if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); - - this.transport.onreadystatechange = this.onStateChange.bind(this); - this.setRequestHeaders(); - - this.body = this.method == 'post' ? (this.options.postBody || params) : null; - this.transport.send(this.body); - - /* Force Firefox to handle ready state 4 for synchronous requests */ - if (!this.options.asynchronous && this.transport.overrideMimeType) - this.onStateChange(); - - } - catch (e) { - this.dispatchException(e); - } - }, - - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState > 1 && !((readyState == 4) && this._complete)) - this.respondToReadyState(this.transport.readyState); - }, - - setRequestHeaders: function() { - var headers = { - 'X-Requested-With': 'XMLHttpRequest', - 'X-Prototype-Version': Prototype.Version, - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - }; - - if (this.method == 'post') { - headers['Content-type'] = this.options.contentType + - (this.options.encoding ? '; charset=' + this.options.encoding : ''); - - /* Force "Connection: close" for older Mozilla browsers to work - * around a bug where XMLHttpRequest sends an incorrect - * Content-length header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType && - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) - headers['Connection'] = 'close'; - } - - // user-defined headers - if (typeof this.options.requestHeaders == 'object') { - var extras = this.options.requestHeaders; - - if (Object.isFunction(extras.push)) - for (var i = 0, length = extras.length; i < length; i += 2) - headers[extras[i]] = extras[i+1]; - else - $H(extras).each(function(pair) { headers[pair.key] = pair.value }); - } - - for (var name in headers) - this.transport.setRequestHeader(name, headers[name]); - }, - - success: function() { - var status = this.getStatus(); - return !status || (status >= 200 && status < 300); - }, - - getStatus: function() { - try { - return this.transport.status || 0; - } catch (e) { return 0 } - }, - - respondToReadyState: function(readyState) { - var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); - - if (state == 'Complete') { - try { - this._complete = true; - (this.options['on' + response.status] - || this.options['on' + (this.success() ? 'Success' : 'Failure')] - || Prototype.emptyFunction)(response, response.headerJSON); - } catch (e) { - this.dispatchException(e); - } - - var contentType = response.getHeader('Content-type'); - if (this.options.evalJS == 'force' - || (this.options.evalJS && this.isSameOrigin() && contentType - && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) - this.evalResponse(); - } - - try { - (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); - Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); - } catch (e) { - this.dispatchException(e); - } - - if (state == 'Complete') { - // avoid memory leak in MSIE: clean up - this.transport.onreadystatechange = Prototype.emptyFunction; - } - }, - - isSameOrigin: function() { - var m = this.url.match(/^\s*https?:\/\/[^\/]*/); - return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ - protocol: location.protocol, - domain: document.domain, - port: location.port ? ':' + location.port : '' - })); - }, - - getHeader: function(name) { - try { - return this.transport.getResponseHeader(name) || null; - } catch (e) { return null } - }, - - evalResponse: function() { - try { - return eval((this.transport.responseText || '').unfilterJSON()); - } catch (e) { - this.dispatchException(e); - } - }, - - dispatchException: function(exception) { - (this.options.onException || Prototype.emptyFunction)(this, exception); - Ajax.Responders.dispatch('onException', this, exception); - } -}); - -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - -Ajax.Response = Class.create({ - initialize: function(request){ - this.request = request; - var transport = this.transport = request.transport, - readyState = this.readyState = transport.readyState; - - if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { - this.status = this.getStatus(); - this.statusText = this.getStatusText(); - this.responseText = String.interpret(transport.responseText); - this.headerJSON = this._getHeaderJSON(); - } - - if(readyState == 4) { - var xml = transport.responseXML; - this.responseXML = Object.isUndefined(xml) ? null : xml; - this.responseJSON = this._getResponseJSON(); - } - }, - - status: 0, - statusText: '', - - getStatus: Ajax.Request.prototype.getStatus, - - getStatusText: function() { - try { - return this.transport.statusText || ''; - } catch (e) { return '' } - }, - - getHeader: Ajax.Request.prototype.getHeader, - - getAllHeaders: function() { - try { - return this.getAllResponseHeaders(); - } catch (e) { return null } - }, - - getResponseHeader: function(name) { - return this.transport.getResponseHeader(name); - }, - - getAllResponseHeaders: function() { - return this.transport.getAllResponseHeaders(); - }, - - _getHeaderJSON: function() { - var json = this.getHeader('X-JSON'); - if (!json) return null; - json = decodeURIComponent(escape(json)); - try { - return json.evalJSON(this.request.options.sanitizeJSON || - !this.request.isSameOrigin()); - } catch (e) { - this.request.dispatchException(e); - } - }, - - _getResponseJSON: function() { - var options = this.request.options; - if (!options.evalJSON || (options.evalJSON != 'force' && - !(this.getHeader('Content-type') || '').include('application/json')) || - this.responseText.blank()) - return null; - try { - return this.responseText.evalJSON(options.sanitizeJSON || - !this.request.isSameOrigin()); - } catch (e) { - this.request.dispatchException(e); - } - } -}); - -Ajax.Updater = Class.create(Ajax.Request, { - initialize: function($super, container, url, options) { - this.container = { - success: (container.success || container), - failure: (container.failure || (container.success ? null : container)) - }; - - options = Object.clone(options); - var onComplete = options.onComplete; - options.onComplete = (function(response, json) { - this.updateContent(response.responseText); - if (Object.isFunction(onComplete)) onComplete(response, json); - }).bind(this); - - $super(url, options); - }, - - updateContent: function(responseText) { - var receiver = this.container[this.success() ? 'success' : 'failure'], - options = this.options; - - if (!options.evalScripts) responseText = responseText.stripScripts(); - - if (receiver = $(receiver)) { - if (options.insertion) { - if (Object.isString(options.insertion)) { - var insertion = { }; insertion[options.insertion] = responseText; - receiver.insert(insertion); - } - else options.insertion(receiver, responseText); - } - else receiver.update(responseText); - } - } -}); - -Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { - initialize: function($super, container, url, options) { - $super(options); - this.onComplete = this.options.onComplete; - - this.frequency = (this.options.frequency || 2); - this.decay = (this.options.decay || 1); - - this.updater = { }; - this.container = container; - this.url = url; - - this.start(); - }, - - start: function() { - this.options.onComplete = this.updateComplete.bind(this); - this.onTimerEvent(); - }, - - stop: function() { - this.updater.options.onComplete = undefined; - clearTimeout(this.timer); - (this.onComplete || Prototype.emptyFunction).apply(this, arguments); - }, - - updateComplete: function(response) { - if (this.options.decay) { - this.decay = (response.responseText == this.lastText ? - this.decay * this.options.decay : 1); - - this.lastText = response.responseText; - } - this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); - }, - - onTimerEvent: function() { - this.updater = new Ajax.Updater(this.container, this.url, this.options); - } -}); -function $(element) { - if (arguments.length > 1) { - for (var i = 0, elements = [], length = arguments.length; i < length; i++) - elements.push($(arguments[i])); - return elements; - } - if (Object.isString(element)) - element = document.getElementById(element); - return Element.extend(element); -} - -if (Prototype.BrowserFeatures.XPath) { - document._getElementsByXPath = function(expression, parentElement) { - var results = []; - var query = document.evaluate(expression, $(parentElement) || document, - null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); - for (var i = 0, length = query.snapshotLength; i < length; i++) - results.push(Element.extend(query.snapshotItem(i))); - return results; - }; -} - -/*--------------------------------------------------------------------------*/ - -if (!window.Node) var Node = { }; - -if (!Node.ELEMENT_NODE) { - // DOM level 2 ECMAScript Language Binding - Object.extend(Node, { - ELEMENT_NODE: 1, - ATTRIBUTE_NODE: 2, - TEXT_NODE: 3, - CDATA_SECTION_NODE: 4, - ENTITY_REFERENCE_NODE: 5, - ENTITY_NODE: 6, - PROCESSING_INSTRUCTION_NODE: 7, - COMMENT_NODE: 8, - DOCUMENT_NODE: 9, - DOCUMENT_TYPE_NODE: 10, - DOCUMENT_FRAGMENT_NODE: 11, - NOTATION_NODE: 12 - }); -} - -(function() { - var element = this.Element; - this.Element = function(tagName, attributes) { - attributes = attributes || { }; - tagName = tagName.toLowerCase(); - var cache = Element.cache; - if (Prototype.Browser.IE && attributes.name) { - tagName = '<' + tagName + ' name="' + attributes.name + '">'; - delete attributes.name; - return Element.writeAttribute(document.createElement(tagName), attributes); - } - if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); - return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); - }; - Object.extend(this.Element, element || { }); - if (element) this.Element.prototype = element.prototype; -}).call(window); - -Element.cache = { }; - -Element.Methods = { - visible: function(element) { - return $(element).style.display != 'none'; - }, - - toggle: function(element) { - element = $(element); - Element[Element.visible(element) ? 'hide' : 'show'](element); - return element; - }, - - hide: function(element) { - element = $(element); - element.style.display = 'none'; - return element; - }, - - show: function(element) { - element = $(element); - element.style.display = ''; - return element; - }, - - remove: function(element) { - element = $(element); - element.parentNode.removeChild(element); - return element; - }, - - update: function(element, content) { - element = $(element); - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) return element.update().insert(content); - content = Object.toHTML(content); - element.innerHTML = content.stripScripts(); - content.evalScripts.bind(content).defer(); - return element; - }, - - replace: function(element, content) { - element = $(element); - if (content && content.toElement) content = content.toElement(); - else if (!Object.isElement(content)) { - content = Object.toHTML(content); - var range = element.ownerDocument.createRange(); - range.selectNode(element); - content.evalScripts.bind(content).defer(); - content = range.createContextualFragment(content.stripScripts()); - } - element.parentNode.replaceChild(content, element); - return element; - }, - - insert: function(element, insertions) { - element = $(element); - - if (Object.isString(insertions) || Object.isNumber(insertions) || - Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) - insertions = {bottom:insertions}; - - var content, insert, tagName, childNodes; - - for (var position in insertions) { - content = insertions[position]; - position = position.toLowerCase(); - insert = Element._insertionTranslations[position]; - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) { - insert(element, content); - continue; - } - - content = Object.toHTML(content); - - tagName = ((position == 'before' || position == 'after') - ? element.parentNode : element).tagName.toUpperCase(); - - childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); - - if (position == 'top' || position == 'after') childNodes.reverse(); - childNodes.each(insert.curry(element)); - - content.evalScripts.bind(content).defer(); - } - - return element; - }, - - wrap: function(element, wrapper, attributes) { - element = $(element); - if (Object.isElement(wrapper)) - $(wrapper).writeAttribute(attributes || { }); - else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); - else wrapper = new Element('div', wrapper); - if (element.parentNode) - element.parentNode.replaceChild(wrapper, element); - wrapper.appendChild(element); - return wrapper; - }, - - inspect: function(element) { - element = $(element); - var result = '<' + element.tagName.toLowerCase(); - $H({'id': 'id', 'className': 'class'}).each(function(pair) { - var property = pair.first(), attribute = pair.last(); - var value = (element[property] || '').toString(); - if (value) result += ' ' + attribute + '=' + value.inspect(true); - }); - return result + '>'; - }, - - recursivelyCollect: function(element, property) { - element = $(element); - var elements = []; - while (element = element[property]) - if (element.nodeType == 1) - elements.push(Element.extend(element)); - return elements; - }, - - ancestors: function(element) { - return $(element).recursivelyCollect('parentNode'); - }, - - descendants: function(element) { - return $(element).select("*"); - }, - - firstDescendant: function(element) { - element = $(element).firstChild; - while (element && element.nodeType != 1) element = element.nextSibling; - return $(element); - }, - - immediateDescendants: function(element) { - if (!(element = $(element).firstChild)) return []; - while (element && element.nodeType != 1) element = element.nextSibling; - if (element) return [element].concat($(element).nextSiblings()); - return []; - }, - - previousSiblings: function(element) { - return $(element).recursivelyCollect('previousSibling'); - }, - - nextSiblings: function(element) { - return $(element).recursivelyCollect('nextSibling'); - }, - - siblings: function(element) { - element = $(element); - return element.previousSiblings().reverse().concat(element.nextSiblings()); - }, - - match: function(element, selector) { - if (Object.isString(selector)) - selector = new Selector(selector); - return selector.match($(element)); - }, - - up: function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return $(element.parentNode); - var ancestors = element.ancestors(); - return Object.isNumber(expression) ? ancestors[expression] : - Selector.findElement(ancestors, expression, index); - }, - - down: function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return element.firstDescendant(); - return Object.isNumber(expression) ? element.descendants()[expression] : - Element.select(element, expression)[index || 0]; - }, - - previous: function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); - var previousSiblings = element.previousSiblings(); - return Object.isNumber(expression) ? previousSiblings[expression] : - Selector.findElement(previousSiblings, expression, index); - }, - - next: function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); - var nextSiblings = element.nextSiblings(); - return Object.isNumber(expression) ? nextSiblings[expression] : - Selector.findElement(nextSiblings, expression, index); - }, - - select: function() { - var args = $A(arguments), element = $(args.shift()); - return Selector.findChildElements(element, args); - }, - - adjacent: function() { - var args = $A(arguments), element = $(args.shift()); - return Selector.findChildElements(element.parentNode, args).without(element); - }, - - identify: function(element) { - element = $(element); - var id = element.readAttribute('id'), self = arguments.callee; - if (id) return id; - do { id = 'anonymous_element_' + self.counter++ } while ($(id)); - element.writeAttribute('id', id); - return id; - }, - - readAttribute: function(element, name) { - element = $(element); - if (Prototype.Browser.IE) { - var t = Element._attributeTranslations.read; - if (t.values[name]) return t.values[name](element, name); - if (t.names[name]) name = t.names[name]; - if (name.include(':')) { - return (!element.attributes || !element.attributes[name]) ? null : - element.attributes[name].value; - } - } - return element.getAttribute(name); - }, - - writeAttribute: function(element, name, value) { - element = $(element); - var attributes = { }, t = Element._attributeTranslations.write; - - if (typeof name == 'object') attributes = name; - else attributes[name] = Object.isUndefined(value) ? true : value; - - for (var attr in attributes) { - name = t.names[attr] || attr; - value = attributes[attr]; - if (t.values[attr]) name = t.values[attr](element, value); - if (value === false || value === null) - element.removeAttribute(name); - else if (value === true) - element.setAttribute(name, name); - else element.setAttribute(name, value); - } - return element; - }, - - getHeight: function(element) { - return $(element).getDimensions().height; - }, - - getWidth: function(element) { - return $(element).getDimensions().width; - }, - - classNames: function(element) { - return new Element.ClassNames(element); - }, - - hasClassName: function(element, className) { - if (!(element = $(element))) return; - var elementClassName = element.className; - return (elementClassName.length > 0 && (elementClassName == className || - new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); - }, - - addClassName: function(element, className) { - if (!(element = $(element))) return; - if (!element.hasClassName(className)) - element.className += (element.className ? ' ' : '') + className; - return element; - }, - - removeClassName: function(element, className) { - if (!(element = $(element))) return; - element.className = element.className.replace( - new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); - return element; - }, - - toggleClassName: function(element, className) { - if (!(element = $(element))) return; - return element[element.hasClassName(className) ? - 'removeClassName' : 'addClassName'](className); - }, - - // removes whitespace-only text node children - cleanWhitespace: function(element) { - element = $(element); - var node = element.firstChild; - while (node) { - var nextNode = node.nextSibling; - if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) - element.removeChild(node); - node = nextNode; - } - return element; - }, - - empty: function(element) { - return $(element).innerHTML.blank(); - }, - - descendantOf: function(element, ancestor) { - element = $(element), ancestor = $(ancestor); - - if (element.compareDocumentPosition) - return (element.compareDocumentPosition(ancestor) & 8) === 8; - - if (ancestor.contains) - return ancestor.contains(element) && ancestor !== element; - - while (element = element.parentNode) - if (element == ancestor) return true; - - return false; - }, - - scrollTo: function(element) { - element = $(element); - var pos = element.cumulativeOffset(); - window.scrollTo(pos[0], pos[1]); - return element; - }, - - getStyle: function(element, style) { - element = $(element); - style = style == 'float' ? 'cssFloat' : style.camelize(); - var value = element.style[style]; - if (!value || value == 'auto') { - var css = document.defaultView.getComputedStyle(element, null); - value = css ? css[style] : null; - } - if (style == 'opacity') return value ? parseFloat(value) : 1.0; - return value == 'auto' ? null : value; - }, - - getOpacity: function(element) { - return $(element).getStyle('opacity'); - }, - - setStyle: function(element, styles) { - element = $(element); - var elementStyle = element.style, match; - if (Object.isString(styles)) { - element.style.cssText += ';' + styles; - return styles.include('opacity') ? - element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; - } - for (var property in styles) - if (property == 'opacity') element.setOpacity(styles[property]); - else - elementStyle[(property == 'float' || property == 'cssFloat') ? - (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : - property] = styles[property]; - - return element; - }, - - setOpacity: function(element, value) { - element = $(element); - element.style.opacity = (value == 1 || value === '') ? '' : - (value < 0.00001) ? 0 : value; - return element; - }, - - getDimensions: function(element) { - element = $(element); - var display = element.getStyle('display'); - if (display != 'none' && display != null) // Safari bug - return {width: element.offsetWidth, height: element.offsetHeight}; - - // All *Width and *Height properties give 0 on elements with display none, - // so enable the element temporarily - var els = element.style; - var originalVisibility = els.visibility; - var originalPosition = els.position; - var originalDisplay = els.display; - els.visibility = 'hidden'; - els.position = 'absolute'; - els.display = 'block'; - var originalWidth = element.clientWidth; - var originalHeight = element.clientHeight; - els.display = originalDisplay; - els.position = originalPosition; - els.visibility = originalVisibility; - return {width: originalWidth, height: originalHeight}; - }, - - makePositioned: function(element) { - element = $(element); - var pos = Element.getStyle(element, 'position'); - if (pos == 'static' || !pos) { - element._madePositioned = true; - element.style.position = 'relative'; - // Opera returns the offset relative to the positioning context, when an - // element is position relative but top and left have not been defined - if (Prototype.Browser.Opera) { - element.style.top = 0; - element.style.left = 0; - } - } - return element; - }, - - undoPositioned: function(element) { - element = $(element); - if (element._madePositioned) { - element._madePositioned = undefined; - element.style.position = - element.style.top = - element.style.left = - element.style.bottom = - element.style.right = ''; - } - return element; - }, - - makeClipping: function(element) { - element = $(element); - if (element._overflow) return element; - element._overflow = Element.getStyle(element, 'overflow') || 'auto'; - if (element._overflow !== 'hidden') - element.style.overflow = 'hidden'; - return element; - }, - - undoClipping: function(element) { - element = $(element); - if (!element._overflow) return element; - element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; - element._overflow = null; - return element; - }, - - cumulativeOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - return Element._returnOffset(valueL, valueT); - }, - - positionedOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - if (element.tagName.toUpperCase() == 'BODY') break; - var p = Element.getStyle(element, 'position'); - if (p !== 'static') break; - } - } while (element); - return Element._returnOffset(valueL, valueT); - }, - - absolutize: function(element) { - element = $(element); - if (element.getStyle('position') == 'absolute') return element; - // Position.prepare(); // To be done manually by Scripty when it needs it. - - var offsets = element.positionedOffset(); - var top = offsets[1]; - var left = offsets[0]; - var width = element.clientWidth; - var height = element.clientHeight; - - element._originalLeft = left - parseFloat(element.style.left || 0); - element._originalTop = top - parseFloat(element.style.top || 0); - element._originalWidth = element.style.width; - element._originalHeight = element.style.height; - - element.style.position = 'absolute'; - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.width = width + 'px'; - element.style.height = height + 'px'; - return element; - }, - - relativize: function(element) { - element = $(element); - if (element.getStyle('position') == 'relative') return element; - // Position.prepare(); // To be done manually by Scripty when it needs it. - - element.style.position = 'relative'; - var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); - var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); - - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.height = element._originalHeight; - element.style.width = element._originalWidth; - return element; - }, - - cumulativeScrollOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return Element._returnOffset(valueL, valueT); - }, - - getOffsetParent: function(element) { - if (element.offsetParent) return $(element.offsetParent); - if (element == document.body) return $(element); - - while ((element = element.parentNode) && element != document.body) - if (Element.getStyle(element, 'position') != 'static') - return $(element); - - return $(document.body); - }, - - viewportOffset: function(forElement) { - var valueT = 0, valueL = 0; - - var element = forElement; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - - // Safari fix - if (element.offsetParent == document.body && - Element.getStyle(element, 'position') == 'absolute') break; - - } while (element = element.offsetParent); - - element = forElement; - do { - if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } - } while (element = element.parentNode); - - return Element._returnOffset(valueL, valueT); - }, - - clonePosition: function(element, source) { - var options = Object.extend({ - setLeft: true, - setTop: true, - setWidth: true, - setHeight: true, - offsetTop: 0, - offsetLeft: 0 - }, arguments[2] || { }); - - // find page position of source - source = $(source); - var p = source.viewportOffset(); - - // find coordinate system to use - element = $(element); - var delta = [0, 0]; - var parent = null; - // delta [0,0] will do fine with position: fixed elements, - // position:absolute needs offsetParent deltas - if (Element.getStyle(element, 'position') == 'absolute') { - parent = element.getOffsetParent(); - delta = parent.viewportOffset(); - } - - // correct by body offsets (fixes Safari) - if (parent == document.body) { - delta[0] -= document.body.offsetLeft; - delta[1] -= document.body.offsetTop; - } - - // set position - if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; - if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; - if (options.setWidth) element.style.width = source.offsetWidth + 'px'; - if (options.setHeight) element.style.height = source.offsetHeight + 'px'; - return element; - } -}; - -Element.Methods.identify.counter = 1; - -Object.extend(Element.Methods, { - getElementsBySelector: Element.Methods.select, - childElements: Element.Methods.immediateDescendants -}); - -Element._attributeTranslations = { - write: { - names: { - className: 'class', - htmlFor: 'for' - }, - values: { } - } -}; - -if (Prototype.Browser.Opera) { - Element.Methods.getStyle = Element.Methods.getStyle.wrap( - function(proceed, element, style) { - switch (style) { - case 'left': case 'top': case 'right': case 'bottom': - if (proceed(element, 'position') === 'static') return null; - case 'height': case 'width': - // returns '0px' for hidden elements; we want it to return null - if (!Element.visible(element)) return null; - - // returns the border-box dimensions rather than the content-box - // dimensions, so we subtract padding and borders from the value - var dim = parseInt(proceed(element, style), 10); - - if (dim !== element['offset' + style.capitalize()]) - return dim + 'px'; - - var properties; - if (style === 'height') { - properties = ['border-top-width', 'padding-top', - 'padding-bottom', 'border-bottom-width']; - } - else { - properties = ['border-left-width', 'padding-left', - 'padding-right', 'border-right-width']; - } - return properties.inject(dim, function(memo, property) { - var val = proceed(element, property); - return val === null ? memo : memo - parseInt(val, 10); - }) + 'px'; - default: return proceed(element, style); - } - } - ); - - Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( - function(proceed, element, attribute) { - if (attribute === 'title') return element.title; - return proceed(element, attribute); - } - ); -} - -else if (Prototype.Browser.IE) { - // IE doesn't report offsets correctly for static elements, so we change them - // to "relative" to get the values, then change them back. - Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( - function(proceed, element) { - element = $(element); - // IE throws an error if element is not in document - try { element.offsetParent } - catch(e) { return $(document.body) } - var position = element.getStyle('position'); - if (position !== 'static') return proceed(element); - element.setStyle({ position: 'relative' }); - var value = proceed(element); - element.setStyle({ position: position }); - return value; - } - ); - - $w('positionedOffset viewportOffset').each(function(method) { - Element.Methods[method] = Element.Methods[method].wrap( - function(proceed, element) { - element = $(element); - try { element.offsetParent } - catch(e) { return Element._returnOffset(0,0) } - var position = element.getStyle('position'); - if (position !== 'static') return proceed(element); - // Trigger hasLayout on the offset parent so that IE6 reports - // accurate offsetTop and offsetLeft values for position: fixed. - var offsetParent = element.getOffsetParent(); - if (offsetParent && offsetParent.getStyle('position') === 'fixed') - offsetParent.setStyle({ zoom: 1 }); - element.setStyle({ position: 'relative' }); - var value = proceed(element); - element.setStyle({ position: position }); - return value; - } - ); - }); - - Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap( - function(proceed, element) { - try { element.offsetParent } - catch(e) { return Element._returnOffset(0,0) } - return proceed(element); - } - ); - - Element.Methods.getStyle = function(element, style) { - element = $(element); - style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); - var value = element.style[style]; - if (!value && element.currentStyle) value = element.currentStyle[style]; - - if (style == 'opacity') { - if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) - if (value[1]) return parseFloat(value[1]) / 100; - return 1.0; - } - - if (value == 'auto') { - if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) - return element['offset' + style.capitalize()] + 'px'; - return null; - } - return value; - }; - - Element.Methods.setOpacity = function(element, value) { - function stripAlpha(filter){ - return filter.replace(/alpha\([^\)]*\)/gi,''); - } - element = $(element); - var currentStyle = element.currentStyle; - if ((currentStyle && !currentStyle.hasLayout) || - (!currentStyle && element.style.zoom == 'normal')) - element.style.zoom = 1; - - var filter = element.getStyle('filter'), style = element.style; - if (value == 1 || value === '') { - (filter = stripAlpha(filter)) ? - style.filter = filter : style.removeAttribute('filter'); - return element; - } else if (value < 0.00001) value = 0; - style.filter = stripAlpha(filter) + - 'alpha(opacity=' + (value * 100) + ')'; - return element; - }; - - Element._attributeTranslations = { - read: { - names: { - 'class': 'className', - 'for': 'htmlFor' - }, - values: { - _getAttr: function(element, attribute) { - return element.getAttribute(attribute, 2); - }, - _getAttrNode: function(element, attribute) { - var node = element.getAttributeNode(attribute); - return node ? node.value : ""; - }, - _getEv: function(element, attribute) { - attribute = element.getAttribute(attribute); - return attribute ? attribute.toString().slice(23, -2) : null; - }, - _flag: function(element, attribute) { - return $(element).hasAttribute(attribute) ? attribute : null; - }, - style: function(element) { - return element.style.cssText.toLowerCase(); - }, - title: function(element) { - return element.title; - } - } - } - }; - - Element._attributeTranslations.write = { - names: Object.extend({ - cellpadding: 'cellPadding', - cellspacing: 'cellSpacing' - }, Element._attributeTranslations.read.names), - values: { - checked: function(element, value) { - element.checked = !!value; - }, - - style: function(element, value) { - element.style.cssText = value ? value : ''; - } - } - }; - - Element._attributeTranslations.has = {}; - - $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + - 'encType maxLength readOnly longDesc frameBorder').each(function(attr) { - Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; - Element._attributeTranslations.has[attr.toLowerCase()] = attr; - }); - - (function(v) { - Object.extend(v, { - href: v._getAttr, - src: v._getAttr, - type: v._getAttr, - action: v._getAttrNode, - disabled: v._flag, - checked: v._flag, - readonly: v._flag, - multiple: v._flag, - onload: v._getEv, - onunload: v._getEv, - onclick: v._getEv, - ondblclick: v._getEv, - onmousedown: v._getEv, - onmouseup: v._getEv, - onmouseover: v._getEv, - onmousemove: v._getEv, - onmouseout: v._getEv, - onfocus: v._getEv, - onblur: v._getEv, - onkeypress: v._getEv, - onkeydown: v._getEv, - onkeyup: v._getEv, - onsubmit: v._getEv, - onreset: v._getEv, - onselect: v._getEv, - onchange: v._getEv - }); - })(Element._attributeTranslations.read.values); -} - -else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { - Element.Methods.setOpacity = function(element, value) { - element = $(element); - element.style.opacity = (value == 1) ? 0.999999 : - (value === '') ? '' : (value < 0.00001) ? 0 : value; - return element; - }; -} - -else if (Prototype.Browser.WebKit) { - Element.Methods.setOpacity = function(element, value) { - element = $(element); - element.style.opacity = (value == 1 || value === '') ? '' : - (value < 0.00001) ? 0 : value; - - if (value == 1) - if(element.tagName.toUpperCase() == 'IMG' && element.width) { - element.width++; element.width--; - } else try { - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch (e) { } - - return element; - }; - - // Safari returns margins on body which is incorrect if the child is absolutely - // positioned. For performance reasons, redefine Element#cumulativeOffset for - // KHTML/WebKit only. - Element.Methods.cumulativeOffset = function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == document.body) - if (Element.getStyle(element, 'position') == 'absolute') break; - - element = element.offsetParent; - } while (element); - - return Element._returnOffset(valueL, valueT); - }; -} - -if (Prototype.Browser.IE || Prototype.Browser.Opera) { - // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements - Element.Methods.update = function(element, content) { - element = $(element); - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) return element.update().insert(content); - - content = Object.toHTML(content); - var tagName = element.tagName.toUpperCase(); - - if (tagName in Element._insertionTranslations.tags) { - $A(element.childNodes).each(function(node) { element.removeChild(node) }); - Element._getContentFromAnonymousElement(tagName, content.stripScripts()) - .each(function(node) { element.appendChild(node) }); - } - else element.innerHTML = content.stripScripts(); - - content.evalScripts.bind(content).defer(); - return element; - }; -} - -if ('outerHTML' in document.createElement('div')) { - Element.Methods.replace = function(element, content) { - element = $(element); - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) { - element.parentNode.replaceChild(content, element); - return element; - } - - content = Object.toHTML(content); - var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); - - if (Element._insertionTranslations.tags[tagName]) { - var nextSibling = element.next(); - var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); - parent.removeChild(element); - if (nextSibling) - fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); - else - fragments.each(function(node) { parent.appendChild(node) }); - } - else element.outerHTML = content.stripScripts(); - - content.evalScripts.bind(content).defer(); - return element; - }; -} - -Element._returnOffset = function(l, t) { - var result = [l, t]; - result.left = l; - result.top = t; - return result; -}; - -Element._getContentFromAnonymousElement = function(tagName, html) { - var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; - if (t) { - div.innerHTML = t[0] + html + t[1]; - t[2].times(function() { div = div.firstChild }); - } else div.innerHTML = html; - return $A(div.childNodes); -}; - -Element._insertionTranslations = { - before: function(element, node) { - element.parentNode.insertBefore(node, element); - }, - top: function(element, node) { - element.insertBefore(node, element.firstChild); - }, - bottom: function(element, node) { - element.appendChild(node); - }, - after: function(element, node) { - element.parentNode.insertBefore(node, element.nextSibling); - }, - tags: { - TABLE: ['', '
    ', 1], - TBODY: ['', '
    ', 2], - TR: ['', '
    ', 3], - TD: ['
    ', '
    ', 4], - SELECT: ['', 1] - } -}; - -(function() { - Object.extend(this.tags, { - THEAD: this.tags.TBODY, - TFOOT: this.tags.TBODY, - TH: this.tags.TD - }); -}).call(Element._insertionTranslations); - -Element.Methods.Simulated = { - hasAttribute: function(element, attribute) { - attribute = Element._attributeTranslations.has[attribute] || attribute; - var node = $(element).getAttributeNode(attribute); - return !!(node && node.specified); - } -}; - -Element.Methods.ByTag = { }; - -Object.extend(Element, Element.Methods); - -if (!Prototype.BrowserFeatures.ElementExtensions && - document.createElement('div')['__proto__']) { - window.HTMLElement = { }; - window.HTMLElement.prototype = document.createElement('div')['__proto__']; - Prototype.BrowserFeatures.ElementExtensions = true; -} - -Element.extend = (function() { - if (Prototype.BrowserFeatures.SpecificElementExtensions) - return Prototype.K; - - var Methods = { }, ByTag = Element.Methods.ByTag; - - var extend = Object.extend(function(element) { - if (!element || element._extendedByPrototype || - element.nodeType != 1 || element == window) return element; - - var methods = Object.clone(Methods), - tagName = element.tagName.toUpperCase(), property, value; - - // extend methods for specific tags - if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); - - for (property in methods) { - value = methods[property]; - if (Object.isFunction(value) && !(property in element)) - element[property] = value.methodize(); - } - - element._extendedByPrototype = Prototype.emptyFunction; - return element; - - }, { - refresh: function() { - // extend methods for all tags (Safari doesn't need this) - if (!Prototype.BrowserFeatures.ElementExtensions) { - Object.extend(Methods, Element.Methods); - Object.extend(Methods, Element.Methods.Simulated); - } - } - }); - - extend.refresh(); - return extend; -})(); - -Element.hasAttribute = function(element, attribute) { - if (element.hasAttribute) return element.hasAttribute(attribute); - return Element.Methods.Simulated.hasAttribute(element, attribute); -}; - -Element.addMethods = function(methods) { - var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; - - if (!methods) { - Object.extend(Form, Form.Methods); - Object.extend(Form.Element, Form.Element.Methods); - Object.extend(Element.Methods.ByTag, { - "FORM": Object.clone(Form.Methods), - "INPUT": Object.clone(Form.Element.Methods), - "SELECT": Object.clone(Form.Element.Methods), - "TEXTAREA": Object.clone(Form.Element.Methods) - }); - } - - if (arguments.length == 2) { - var tagName = methods; - methods = arguments[1]; - } - - if (!tagName) Object.extend(Element.Methods, methods || { }); - else { - if (Object.isArray(tagName)) tagName.each(extend); - else extend(tagName); - } - - function extend(tagName) { - tagName = tagName.toUpperCase(); - if (!Element.Methods.ByTag[tagName]) - Element.Methods.ByTag[tagName] = { }; - Object.extend(Element.Methods.ByTag[tagName], methods); - } - - function copy(methods, destination, onlyIfAbsent) { - onlyIfAbsent = onlyIfAbsent || false; - for (var property in methods) { - var value = methods[property]; - if (!Object.isFunction(value)) continue; - if (!onlyIfAbsent || !(property in destination)) - destination[property] = value.methodize(); - } - } - - function findDOMClass(tagName) { - var klass; - var trans = { - "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", - "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", - "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", - "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", - "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": - "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": - "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": - "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": - "FrameSet", "IFRAME": "IFrame" - }; - if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; - if (window[klass]) return window[klass]; - klass = 'HTML' + tagName + 'Element'; - if (window[klass]) return window[klass]; - klass = 'HTML' + tagName.capitalize() + 'Element'; - if (window[klass]) return window[klass]; - - window[klass] = { }; - window[klass].prototype = document.createElement(tagName)['__proto__']; - return window[klass]; - } - - if (F.ElementExtensions) { - copy(Element.Methods, HTMLElement.prototype); - copy(Element.Methods.Simulated, HTMLElement.prototype, true); - } - - if (F.SpecificElementExtensions) { - for (var tag in Element.Methods.ByTag) { - var klass = findDOMClass(tag); - if (Object.isUndefined(klass)) continue; - copy(T[tag], klass.prototype); - } - } - - Object.extend(Element, Element.Methods); - delete Element.ByTag; - - if (Element.extend.refresh) Element.extend.refresh(); - Element.cache = { }; -}; - -document.viewport = { - getDimensions: function() { - var dimensions = { }, B = Prototype.Browser; - $w('width height').each(function(d) { - var D = d.capitalize(); - if (B.WebKit && !document.evaluate) { - // Safari <3.0 needs self.innerWidth/Height - dimensions[d] = self['inner' + D]; - } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) { - // Opera <9.5 needs document.body.clientWidth/Height - dimensions[d] = document.body['client' + D] - } else { - dimensions[d] = document.documentElement['client' + D]; - } - }); - return dimensions; - }, - - getWidth: function() { - return this.getDimensions().width; - }, - - getHeight: function() { - return this.getDimensions().height; - }, - - getScrollOffsets: function() { - return Element._returnOffset( - window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, - window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); - } -}; -/* Portions of the Selector class are derived from Jack Slocum's DomQuery, - * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style - * license. Please see http://www.yui-ext.com/ for more information. */ - -var Selector = Class.create({ - initialize: function(expression) { - this.expression = expression.strip(); - - if (this.shouldUseSelectorsAPI()) { - this.mode = 'selectorsAPI'; - } else if (this.shouldUseXPath()) { - this.mode = 'xpath'; - this.compileXPathMatcher(); - } else { - this.mode = "normal"; - this.compileMatcher(); - } - - }, - - shouldUseXPath: function() { - if (!Prototype.BrowserFeatures.XPath) return false; - - var e = this.expression; - - // Safari 3 chokes on :*-of-type and :empty - if (Prototype.Browser.WebKit && - (e.include("-of-type") || e.include(":empty"))) - return false; - - // XPath can't do namespaced attributes, nor can it read - // the "checked" property from DOM nodes - if ((/(\[[\w-]*?:|:checked)/).test(e)) - return false; - - return true; - }, - - shouldUseSelectorsAPI: function() { - if (!Prototype.BrowserFeatures.SelectorsAPI) return false; - - if (!Selector._div) Selector._div = new Element('div'); - - // Make sure the browser treats the selector as valid. Test on an - // isolated element to minimize cost of this check. - try { - Selector._div.querySelector(this.expression); - } catch(e) { - return false; - } - - return true; - }, - - compileMatcher: function() { - var e = this.expression, ps = Selector.patterns, h = Selector.handlers, - c = Selector.criteria, le, p, m; - - if (Selector._cache[e]) { - this.matcher = Selector._cache[e]; - return; - } - - this.matcher = ["this.matcher = function(root) {", - "var r = root, h = Selector.handlers, c = false, n;"]; - - while (e && le != e && (/\S/).test(e)) { - le = e; - for (var i in ps) { - p = ps[i]; - if (m = e.match(p)) { - this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : - new Template(c[i]).evaluate(m)); - e = e.replace(m[0], ''); - break; - } - } - } - - this.matcher.push("return h.unique(n);\n}"); - eval(this.matcher.join('\n')); - Selector._cache[this.expression] = this.matcher; - }, - - compileXPathMatcher: function() { - var e = this.expression, ps = Selector.patterns, - x = Selector.xpath, le, m; - - if (Selector._cache[e]) { - this.xpath = Selector._cache[e]; return; - } - - this.matcher = ['.//*']; - while (e && le != e && (/\S/).test(e)) { - le = e; - for (var i in ps) { - if (m = e.match(ps[i])) { - this.matcher.push(Object.isFunction(x[i]) ? x[i](m) : - new Template(x[i]).evaluate(m)); - e = e.replace(m[0], ''); - break; - } - } - } - - this.xpath = this.matcher.join(''); - Selector._cache[this.expression] = this.xpath; - }, - - findElements: function(root) { - root = root || document; - var e = this.expression, results; - - switch (this.mode) { - case 'selectorsAPI': - // querySelectorAll queries document-wide, then filters to descendants - // of the context element. That's not what we want. - // Add an explicit context to the selector if necessary. - if (root !== document) { - var oldId = root.id, id = $(root).identify(); - e = "#" + id + " " + e; - } - - results = $A(root.querySelectorAll(e)).map(Element.extend); - root.id = oldId; - - return results; - case 'xpath': - return document._getElementsByXPath(this.xpath, root); - default: - return this.matcher(root); - } - }, - - match: function(element) { - this.tokens = []; - - var e = this.expression, ps = Selector.patterns, as = Selector.assertions; - var le, p, m; - - while (e && le !== e && (/\S/).test(e)) { - le = e; - for (var i in ps) { - p = ps[i]; - if (m = e.match(p)) { - // use the Selector.assertions methods unless the selector - // is too complex. - if (as[i]) { - this.tokens.push([i, Object.clone(m)]); - e = e.replace(m[0], ''); - } else { - // reluctantly do a document-wide search - // and look for a match in the array - return this.findElements(document).include(element); - } - } - } - } - - var match = true, name, matches; - for (var i = 0, token; token = this.tokens[i]; i++) { - name = token[0], matches = token[1]; - if (!Selector.assertions[name](element, matches)) { - match = false; break; - } - } - - return match; - }, - - toString: function() { - return this.expression; - }, - - inspect: function() { - return "#"; - } -}); - -Object.extend(Selector, { - _cache: { }, - - xpath: { - descendant: "//*", - child: "/*", - adjacent: "/following-sibling::*[1]", - laterSibling: '/following-sibling::*', - tagName: function(m) { - if (m[1] == '*') return ''; - return "[local-name()='" + m[1].toLowerCase() + - "' or local-name()='" + m[1].toUpperCase() + "']"; - }, - className: "[contains(concat(' ', @class, ' '), ' #{1} ')]", - id: "[@id='#{1}']", - attrPresence: function(m) { - m[1] = m[1].toLowerCase(); - return new Template("[@#{1}]").evaluate(m); - }, - attr: function(m) { - m[1] = m[1].toLowerCase(); - m[3] = m[5] || m[6]; - return new Template(Selector.xpath.operators[m[2]]).evaluate(m); - }, - pseudo: function(m) { - var h = Selector.xpath.pseudos[m[1]]; - if (!h) return ''; - if (Object.isFunction(h)) return h(m); - return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); - }, - operators: { - '=': "[@#{1}='#{3}']", - '!=': "[@#{1}!='#{3}']", - '^=': "[starts-with(@#{1}, '#{3}')]", - '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']", - '*=': "[contains(@#{1}, '#{3}')]", - '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", - '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" - }, - pseudos: { - 'first-child': '[not(preceding-sibling::*)]', - 'last-child': '[not(following-sibling::*)]', - 'only-child': '[not(preceding-sibling::* or following-sibling::*)]', - 'empty': "[count(*) = 0 and (count(text()) = 0)]", - 'checked': "[@checked]", - 'disabled': "[(@disabled) and (@type!='hidden')]", - 'enabled': "[not(@disabled) and (@type!='hidden')]", - 'not': function(m) { - var e = m[6], p = Selector.patterns, - x = Selector.xpath, le, v; - - var exclusion = []; - while (e && le != e && (/\S/).test(e)) { - le = e; - for (var i in p) { - if (m = e.match(p[i])) { - v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m); - exclusion.push("(" + v.substring(1, v.length - 1) + ")"); - e = e.replace(m[0], ''); - break; - } - } - } - return "[not(" + exclusion.join(" and ") + ")]"; - }, - 'nth-child': function(m) { - return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m); - }, - 'nth-last-child': function(m) { - return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m); - }, - 'nth-of-type': function(m) { - return Selector.xpath.pseudos.nth("position() ", m); - }, - 'nth-last-of-type': function(m) { - return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); - }, - 'first-of-type': function(m) { - m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m); - }, - 'last-of-type': function(m) { - m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); - }, - 'only-of-type': function(m) { - var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m); - }, - nth: function(fragment, m) { - var mm, formula = m[6], predicate; - if (formula == 'even') formula = '2n+0'; - if (formula == 'odd') formula = '2n+1'; - if (mm = formula.match(/^(\d+)$/)) // digit only - return '[' + fragment + "= " + mm[1] + ']'; - if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b - if (mm[1] == "-") mm[1] = -1; - var a = mm[1] ? Number(mm[1]) : 1; - var b = mm[2] ? Number(mm[2]) : 0; - predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " + - "((#{fragment} - #{b}) div #{a} >= 0)]"; - return new Template(predicate).evaluate({ - fragment: fragment, a: a, b: b }); - } - } - } - }, - - criteria: { - tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', - className: 'n = h.className(n, r, "#{1}", c); c = false;', - id: 'n = h.id(n, r, "#{1}", c); c = false;', - attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;', - attr: function(m) { - m[3] = (m[5] || m[6]); - return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m); - }, - pseudo: function(m) { - if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); - return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m); - }, - descendant: 'c = "descendant";', - child: 'c = "child";', - adjacent: 'c = "adjacent";', - laterSibling: 'c = "laterSibling";' - }, - - patterns: { - // combinators must be listed first - // (and descendant needs to be last combinator) - laterSibling: /^\s*~\s*/, - child: /^\s*>\s*/, - adjacent: /^\s*\+\s*/, - descendant: /^\s/, - - // selectors follow - tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, - id: /^#([\w\-\*]+)(\b|$)/, - className: /^\.([\w\-\*]+)(\b|$)/, - pseudo: -/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/, - attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/, - attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ - }, - - // for Selector.match and Element#match - assertions: { - tagName: function(element, matches) { - return matches[1].toUpperCase() == element.tagName.toUpperCase(); - }, - - className: function(element, matches) { - return Element.hasClassName(element, matches[1]); - }, - - id: function(element, matches) { - return element.id === matches[1]; - }, - - attrPresence: function(element, matches) { - return Element.hasAttribute(element, matches[1]); - }, - - attr: function(element, matches) { - var nodeValue = Element.readAttribute(element, matches[1]); - return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]); - } - }, - - handlers: { - // UTILITY FUNCTIONS - // joins two collections - concat: function(a, b) { - for (var i = 0, node; node = b[i]; i++) - a.push(node); - return a; - }, - - // marks an array of nodes for counting - mark: function(nodes) { - var _true = Prototype.emptyFunction; - for (var i = 0, node; node = nodes[i]; i++) - node._countedByPrototype = _true; - return nodes; - }, - - unmark: function(nodes) { - for (var i = 0, node; node = nodes[i]; i++) - node._countedByPrototype = undefined; - return nodes; - }, - - // mark each child node with its position (for nth calls) - // "ofType" flag indicates whether we're indexing for nth-of-type - // rather than nth-child - index: function(parentNode, reverse, ofType) { - parentNode._countedByPrototype = Prototype.emptyFunction; - if (reverse) { - for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { - var node = nodes[i]; - if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; - } - } else { - for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) - if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; - } - }, - - // filters out duplicates and extends all nodes - unique: function(nodes) { - if (nodes.length == 0) return nodes; - var results = [], n; - for (var i = 0, l = nodes.length; i < l; i++) - if (!(n = nodes[i])._countedByPrototype) { - n._countedByPrototype = Prototype.emptyFunction; - results.push(Element.extend(n)); - } - return Selector.handlers.unmark(results); - }, - - // COMBINATOR FUNCTIONS - descendant: function(nodes) { - var h = Selector.handlers; - for (var i = 0, results = [], node; node = nodes[i]; i++) - h.concat(results, node.getElementsByTagName('*')); - return results; - }, - - child: function(nodes) { - var h = Selector.handlers; - for (var i = 0, results = [], node; node = nodes[i]; i++) { - for (var j = 0, child; child = node.childNodes[j]; j++) - if (child.nodeType == 1 && child.tagName != '!') results.push(child); - } - return results; - }, - - adjacent: function(nodes) { - for (var i = 0, results = [], node; node = nodes[i]; i++) { - var next = this.nextElementSibling(node); - if (next) results.push(next); - } - return results; - }, - - laterSibling: function(nodes) { - var h = Selector.handlers; - for (var i = 0, results = [], node; node = nodes[i]; i++) - h.concat(results, Element.nextSiblings(node)); - return results; - }, - - nextElementSibling: function(node) { - while (node = node.nextSibling) - if (node.nodeType == 1) return node; - return null; - }, - - previousElementSibling: function(node) { - while (node = node.previousSibling) - if (node.nodeType == 1) return node; - return null; - }, - - // TOKEN FUNCTIONS - tagName: function(nodes, root, tagName, combinator) { - var uTagName = tagName.toUpperCase(); - var results = [], h = Selector.handlers; - if (nodes) { - if (combinator) { - // fastlane for ordinary descendant combinators - if (combinator == "descendant") { - for (var i = 0, node; node = nodes[i]; i++) - h.concat(results, node.getElementsByTagName(tagName)); - return results; - } else nodes = this[combinator](nodes); - if (tagName == "*") return nodes; - } - for (var i = 0, node; node = nodes[i]; i++) - if (node.tagName.toUpperCase() === uTagName) results.push(node); - return results; - } else return root.getElementsByTagName(tagName); - }, - - id: function(nodes, root, id, combinator) { - var targetNode = $(id), h = Selector.handlers; - if (!targetNode) return []; - if (!nodes && root == document) return [targetNode]; - if (nodes) { - if (combinator) { - if (combinator == 'child') { - for (var i = 0, node; node = nodes[i]; i++) - if (targetNode.parentNode == node) return [targetNode]; - } else if (combinator == 'descendant') { - for (var i = 0, node; node = nodes[i]; i++) - if (Element.descendantOf(targetNode, node)) return [targetNode]; - } else if (combinator == 'adjacent') { - for (var i = 0, node; node = nodes[i]; i++) - if (Selector.handlers.previousElementSibling(targetNode) == node) - return [targetNode]; - } else nodes = h[combinator](nodes); - } - for (var i = 0, node; node = nodes[i]; i++) - if (node == targetNode) return [targetNode]; - return []; - } - return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : []; - }, - - className: function(nodes, root, className, combinator) { - if (nodes && combinator) nodes = this[combinator](nodes); - return Selector.handlers.byClassName(nodes, root, className); - }, - - byClassName: function(nodes, root, className) { - if (!nodes) nodes = Selector.handlers.descendant([root]); - var needle = ' ' + className + ' '; - for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) { - nodeClassName = node.className; - if (nodeClassName.length == 0) continue; - if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle)) - results.push(node); - } - return results; - }, - - attrPresence: function(nodes, root, attr, combinator) { - if (!nodes) nodes = root.getElementsByTagName("*"); - if (nodes && combinator) nodes = this[combinator](nodes); - var results = []; - for (var i = 0, node; node = nodes[i]; i++) - if (Element.hasAttribute(node, attr)) results.push(node); - return results; - }, - - attr: function(nodes, root, attr, value, operator, combinator) { - if (!nodes) nodes = root.getElementsByTagName("*"); - if (nodes && combinator) nodes = this[combinator](nodes); - var handler = Selector.operators[operator], results = []; - for (var i = 0, node; node = nodes[i]; i++) { - var nodeValue = Element.readAttribute(node, attr); - if (nodeValue === null) continue; - if (handler(nodeValue, value)) results.push(node); - } - return results; - }, - - pseudo: function(nodes, name, value, root, combinator) { - if (nodes && combinator) nodes = this[combinator](nodes); - if (!nodes) nodes = root.getElementsByTagName("*"); - return Selector.pseudos[name](nodes, value, root); - } - }, - - pseudos: { - 'first-child': function(nodes, value, root) { - for (var i = 0, results = [], node; node = nodes[i]; i++) { - if (Selector.handlers.previousElementSibling(node)) continue; - results.push(node); - } - return results; - }, - 'last-child': function(nodes, value, root) { - for (var i = 0, results = [], node; node = nodes[i]; i++) { - if (Selector.handlers.nextElementSibling(node)) continue; - results.push(node); - } - return results; - }, - 'only-child': function(nodes, value, root) { - var h = Selector.handlers; - for (var i = 0, results = [], node; node = nodes[i]; i++) - if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) - results.push(node); - return results; - }, - 'nth-child': function(nodes, formula, root) { - return Selector.pseudos.nth(nodes, formula, root); - }, - 'nth-last-child': function(nodes, formula, root) { - return Selector.pseudos.nth(nodes, formula, root, true); - }, - 'nth-of-type': function(nodes, formula, root) { - return Selector.pseudos.nth(nodes, formula, root, false, true); - }, - 'nth-last-of-type': function(nodes, formula, root) { - return Selector.pseudos.nth(nodes, formula, root, true, true); - }, - 'first-of-type': function(nodes, formula, root) { - return Selector.pseudos.nth(nodes, "1", root, false, true); - }, - 'last-of-type': function(nodes, formula, root) { - return Selector.pseudos.nth(nodes, "1", root, true, true); - }, - 'only-of-type': function(nodes, formula, root) { - var p = Selector.pseudos; - return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root); - }, - - // handles the an+b logic - getIndices: function(a, b, total) { - if (a == 0) return b > 0 ? [b] : []; - return $R(1, total).inject([], function(memo, i) { - if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i); - return memo; - }); - }, - - // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type - nth: function(nodes, formula, root, reverse, ofType) { - if (nodes.length == 0) return []; - if (formula == 'even') formula = '2n+0'; - if (formula == 'odd') formula = '2n+1'; - var h = Selector.handlers, results = [], indexed = [], m; - h.mark(nodes); - for (var i = 0, node; node = nodes[i]; i++) { - if (!node.parentNode._countedByPrototype) { - h.index(node.parentNode, reverse, ofType); - indexed.push(node.parentNode); - } - } - if (formula.match(/^\d+$/)) { // just a number - formula = Number(formula); - for (var i = 0, node; node = nodes[i]; i++) - if (node.nodeIndex == formula) results.push(node); - } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b - if (m[1] == "-") m[1] = -1; - var a = m[1] ? Number(m[1]) : 1; - var b = m[2] ? Number(m[2]) : 0; - var indices = Selector.pseudos.getIndices(a, b, nodes.length); - for (var i = 0, node, l = indices.length; node = nodes[i]; i++) { - for (var j = 0; j < l; j++) - if (node.nodeIndex == indices[j]) results.push(node); - } - } - h.unmark(nodes); - h.unmark(indexed); - return results; - }, - - 'empty': function(nodes, value, root) { - for (var i = 0, results = [], node; node = nodes[i]; i++) { - // IE treats comments as element nodes - if (node.tagName == '!' || node.firstChild) continue; - results.push(node); - } - return results; - }, - - 'not': function(nodes, selector, root) { - var h = Selector.handlers, selectorType, m; - var exclusions = new Selector(selector).findElements(root); - h.mark(exclusions); - for (var i = 0, results = [], node; node = nodes[i]; i++) - if (!node._countedByPrototype) results.push(node); - h.unmark(exclusions); - return results; - }, - - 'enabled': function(nodes, value, root) { - for (var i = 0, results = [], node; node = nodes[i]; i++) - if (!node.disabled && (!node.type || node.type !== 'hidden')) - results.push(node); - return results; - }, - - 'disabled': function(nodes, value, root) { - for (var i = 0, results = [], node; node = nodes[i]; i++) - if (node.disabled) results.push(node); - return results; - }, - - 'checked': function(nodes, value, root) { - for (var i = 0, results = [], node; node = nodes[i]; i++) - if (node.checked) results.push(node); - return results; - } - }, - - operators: { - '=': function(nv, v) { return nv == v; }, - '!=': function(nv, v) { return nv != v; }, - '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); }, - '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); }, - '*=': function(nv, v) { return nv == v || nv && nv.include(v); }, - '$=': function(nv, v) { return nv.endsWith(v); }, - '*=': function(nv, v) { return nv.include(v); }, - '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); }, - '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() + - '-').include('-' + (v || "").toUpperCase() + '-'); } - }, - - split: function(expression) { - var expressions = []; - expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { - expressions.push(m[1].strip()); - }); - return expressions; - }, - - matchElements: function(elements, expression) { - var matches = $$(expression), h = Selector.handlers; - h.mark(matches); - for (var i = 0, results = [], element; element = elements[i]; i++) - if (element._countedByPrototype) results.push(element); - h.unmark(matches); - return results; - }, - - findElement: function(elements, expression, index) { - if (Object.isNumber(expression)) { - index = expression; expression = false; - } - return Selector.matchElements(elements, expression || '*')[index || 0]; - }, - - findChildElements: function(element, expressions) { - expressions = Selector.split(expressions.join(',')); - var results = [], h = Selector.handlers; - for (var i = 0, l = expressions.length, selector; i < l; i++) { - selector = new Selector(expressions[i].strip()); - h.concat(results, selector.findElements(element)); - } - return (l > 1) ? h.unique(results) : results; - } -}); - -if (Prototype.Browser.IE) { - Object.extend(Selector.handlers, { - // IE returns comment nodes on getElementsByTagName("*"). - // Filter them out. - concat: function(a, b) { - for (var i = 0, node; node = b[i]; i++) - if (node.tagName !== "!") a.push(node); - return a; - }, - - // IE improperly serializes _countedByPrototype in (inner|outer)HTML. - unmark: function(nodes) { - for (var i = 0, node; node = nodes[i]; i++) - node.removeAttribute('_countedByPrototype'); - return nodes; - } - }); -} - -function $$() { - return Selector.findChildElements(document, $A(arguments)); -} -var Form = { - reset: function(form) { - $(form).reset(); - return form; - }, - - serializeElements: function(elements, options) { - if (typeof options != 'object') options = { hash: !!options }; - else if (Object.isUndefined(options.hash)) options.hash = true; - var key, value, submitted = false, submit = options.submit; - - var data = elements.inject({ }, function(result, element) { - if (!element.disabled && element.name) { - key = element.name; value = $(element).getValue(); - if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted && - submit !== false && (!submit || key == submit) && (submitted = true)))) { - if (key in result) { - // a key is already present; construct an array of values - if (!Object.isArray(result[key])) result[key] = [result[key]]; - result[key].push(value); - } - else result[key] = value; - } - } - return result; - }); - - return options.hash ? data : Object.toQueryString(data); - } -}; - -Form.Methods = { - serialize: function(form, options) { - return Form.serializeElements(Form.getElements(form), options); - }, - - getElements: function(form) { - return $A($(form).getElementsByTagName('*')).inject([], - function(elements, child) { - if (Form.Element.Serializers[child.tagName.toLowerCase()]) - elements.push(Element.extend(child)); - return elements; - } - ); - }, - - getInputs: function(form, typeName, name) { - form = $(form); - var inputs = form.getElementsByTagName('input'); - - if (!typeName && !name) return $A(inputs).map(Element.extend); - - for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { - var input = inputs[i]; - if ((typeName && input.type != typeName) || (name && input.name != name)) - continue; - matchingInputs.push(Element.extend(input)); - } - - return matchingInputs; - }, - - disable: function(form) { - form = $(form); - Form.getElements(form).invoke('disable'); - return form; - }, - - enable: function(form) { - form = $(form); - Form.getElements(form).invoke('enable'); - return form; - }, - - findFirstElement: function(form) { - var elements = $(form).getElements().findAll(function(element) { - return 'hidden' != element.type && !element.disabled; - }); - var firstByIndex = elements.findAll(function(element) { - return element.hasAttribute('tabIndex') && element.tabIndex >= 0; - }).sortBy(function(element) { return element.tabIndex }).first(); - - return firstByIndex ? firstByIndex : elements.find(function(element) { - return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); - }); - }, - - focusFirstElement: function(form) { - form = $(form); - form.findFirstElement().activate(); - return form; - }, - - request: function(form, options) { - form = $(form), options = Object.clone(options || { }); - - var params = options.parameters, action = form.readAttribute('action') || ''; - if (action.blank()) action = window.location.href; - options.parameters = form.serialize(true); - - if (params) { - if (Object.isString(params)) params = params.toQueryParams(); - Object.extend(options.parameters, params); - } - - if (form.hasAttribute('method') && !options.method) - options.method = form.method; - - return new Ajax.Request(action, options); - } -}; - -/*--------------------------------------------------------------------------*/ - -Form.Element = { - focus: function(element) { - $(element).focus(); - return element; - }, - - select: function(element) { - $(element).select(); - return element; - } -}; - -Form.Element.Methods = { - serialize: function(element) { - element = $(element); - if (!element.disabled && element.name) { - var value = element.getValue(); - if (value != undefined) { - var pair = { }; - pair[element.name] = value; - return Object.toQueryString(pair); - } - } - return ''; - }, - - getValue: function(element) { - element = $(element); - var method = element.tagName.toLowerCase(); - return Form.Element.Serializers[method](element); - }, - - setValue: function(element, value) { - element = $(element); - var method = element.tagName.toLowerCase(); - Form.Element.Serializers[method](element, value); - return element; - }, - - clear: function(element) { - $(element).value = ''; - return element; - }, - - present: function(element) { - return $(element).value != ''; - }, - - activate: function(element) { - element = $(element); - try { - element.focus(); - if (element.select && (element.tagName.toLowerCase() != 'input' || - !['button', 'reset', 'submit'].include(element.type))) - element.select(); - } catch (e) { } - return element; - }, - - disable: function(element) { - element = $(element); - element.disabled = true; - return element; - }, - - enable: function(element) { - element = $(element); - element.disabled = false; - return element; - } -}; - -/*--------------------------------------------------------------------------*/ - -var Field = Form.Element; -var $F = Form.Element.Methods.getValue; - -/*--------------------------------------------------------------------------*/ - -Form.Element.Serializers = { - input: function(element, value) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - return Form.Element.Serializers.inputSelector(element, value); - default: - return Form.Element.Serializers.textarea(element, value); - } - }, - - inputSelector: function(element, value) { - if (Object.isUndefined(value)) return element.checked ? element.value : null; - else element.checked = !!value; - }, - - textarea: function(element, value) { - if (Object.isUndefined(value)) return element.value; - else element.value = value; - }, - - select: function(element, value) { - if (Object.isUndefined(value)) - return this[element.type == 'select-one' ? - 'selectOne' : 'selectMany'](element); - else { - var opt, currentValue, single = !Object.isArray(value); - for (var i = 0, length = element.length; i < length; i++) { - opt = element.options[i]; - currentValue = this.optionValue(opt); - if (single) { - if (currentValue == value) { - opt.selected = true; - return; - } - } - else opt.selected = value.include(currentValue); - } - } - }, - - selectOne: function(element) { - var index = element.selectedIndex; - return index >= 0 ? this.optionValue(element.options[index]) : null; - }, - - selectMany: function(element) { - var values, length = element.length; - if (!length) return null; - - for (var i = 0, values = []; i < length; i++) { - var opt = element.options[i]; - if (opt.selected) values.push(this.optionValue(opt)); - } - return values; - }, - - optionValue: function(opt) { - // extend element because hasAttribute may not be native - return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; - } -}; - -/*--------------------------------------------------------------------------*/ - -Abstract.TimedObserver = Class.create(PeriodicalExecuter, { - initialize: function($super, element, frequency, callback) { - $super(callback, frequency); - this.element = $(element); - this.lastValue = this.getValue(); - }, - - execute: function() { - var value = this.getValue(); - if (Object.isString(this.lastValue) && Object.isString(value) ? - this.lastValue != value : String(this.lastValue) != String(value)) { - this.callback(this.element, value); - this.lastValue = value; - } - } -}); - -Form.Element.Observer = Class.create(Abstract.TimedObserver, { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.Observer = Class.create(Abstract.TimedObserver, { - getValue: function() { - return Form.serialize(this.element); - } -}); - -/*--------------------------------------------------------------------------*/ - -Abstract.EventObserver = Class.create({ - initialize: function(element, callback) { - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - if (this.element.tagName.toLowerCase() == 'form') - this.registerFormCallbacks(); - else - this.registerCallback(this.element); - }, - - onElementEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - }, - - registerFormCallbacks: function() { - Form.getElements(this.element).each(this.registerCallback, this); - }, - - registerCallback: function(element) { - if (element.type) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - Event.observe(element, 'click', this.onElementEvent.bind(this)); - break; - default: - Event.observe(element, 'change', this.onElementEvent.bind(this)); - break; - } - } - } -}); - -Form.Element.EventObserver = Class.create(Abstract.EventObserver, { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.EventObserver = Class.create(Abstract.EventObserver, { - getValue: function() { - return Form.serialize(this.element); - } -}); -if (!window.Event) var Event = { }; - -Object.extend(Event, { - KEY_BACKSPACE: 8, - KEY_TAB: 9, - KEY_RETURN: 13, - KEY_ESC: 27, - KEY_LEFT: 37, - KEY_UP: 38, - KEY_RIGHT: 39, - KEY_DOWN: 40, - KEY_DELETE: 46, - KEY_HOME: 36, - KEY_END: 35, - KEY_PAGEUP: 33, - KEY_PAGEDOWN: 34, - KEY_INSERT: 45, - - cache: { }, - - relatedTarget: function(event) { - var element; - switch(event.type) { - case 'mouseover': element = event.fromElement; break; - case 'mouseout': element = event.toElement; break; - default: return null; - } - return Element.extend(element); - } -}); - -Event.Methods = (function() { - var isButton; - - if (Prototype.Browser.IE) { - var buttonMap = { 0: 1, 1: 4, 2: 2 }; - isButton = function(event, code) { - return event.button == buttonMap[code]; - }; - - } else if (Prototype.Browser.WebKit) { - isButton = function(event, code) { - switch (code) { - case 0: return event.which == 1 && !event.metaKey; - case 1: return event.which == 1 && event.metaKey; - default: return false; - } - }; - - } else { - isButton = function(event, code) { - return event.which ? (event.which === code + 1) : (event.button === code); - }; - } - - return { - isLeftClick: function(event) { return isButton(event, 0) }, - isMiddleClick: function(event) { return isButton(event, 1) }, - isRightClick: function(event) { return isButton(event, 2) }, - - element: function(event) { - event = Event.extend(event); - - var node = event.target, - type = event.type, - currentTarget = event.currentTarget; - - if (currentTarget && currentTarget.tagName) { - // Firefox screws up the "click" event when moving between radio buttons - // via arrow keys. It also screws up the "load" and "error" events on images, - // reporting the document as the target instead of the original image. - if (type === 'load' || type === 'error' || - (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' - && currentTarget.type === 'radio')) - node = currentTarget; - } - if (node.nodeType == Node.TEXT_NODE) node = node.parentNode; - return Element.extend(node); - }, - - findElement: function(event, expression) { - var element = Event.element(event); - if (!expression) return element; - var elements = [element].concat(element.ancestors()); - return Selector.findElement(elements, expression, 0); - }, - - pointer: function(event) { - var docElement = document.documentElement, - body = document.body || { scrollLeft: 0, scrollTop: 0 }; - return { - x: event.pageX || (event.clientX + - (docElement.scrollLeft || body.scrollLeft) - - (docElement.clientLeft || 0)), - y: event.pageY || (event.clientY + - (docElement.scrollTop || body.scrollTop) - - (docElement.clientTop || 0)) - }; - }, - - pointerX: function(event) { return Event.pointer(event).x }, - pointerY: function(event) { return Event.pointer(event).y }, - - stop: function(event) { - Event.extend(event); - event.preventDefault(); - event.stopPropagation(); - event.stopped = true; - } - }; -})(); - -Event.extend = (function() { - var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { - m[name] = Event.Methods[name].methodize(); - return m; - }); - - if (Prototype.Browser.IE) { - Object.extend(methods, { - stopPropagation: function() { this.cancelBubble = true }, - preventDefault: function() { this.returnValue = false }, - inspect: function() { return "[object Event]" } - }); - - return function(event) { - if (!event) return false; - if (event._extendedByPrototype) return event; - - event._extendedByPrototype = Prototype.emptyFunction; - var pointer = Event.pointer(event); - Object.extend(event, { - target: event.srcElement, - relatedTarget: Event.relatedTarget(event), - pageX: pointer.x, - pageY: pointer.y - }); - return Object.extend(event, methods); - }; - - } else { - Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__']; - Object.extend(Event.prototype, methods); - return Prototype.K; - } -})(); - -Object.extend(Event, (function() { - var cache = Event.cache; - - function getEventID(element) { - if (element._prototypeEventID) return element._prototypeEventID[0]; - arguments.callee.id = arguments.callee.id || 1; - return element._prototypeEventID = [++arguments.callee.id]; - } - - function getDOMEventName(eventName) { - if (eventName && eventName.include(':')) return "dataavailable"; - return eventName; - } - - function getCacheForID(id) { - return cache[id] = cache[id] || { }; - } - - function getWrappersForEventName(id, eventName) { - var c = getCacheForID(id); - return c[eventName] = c[eventName] || []; - } - - function createWrapper(element, eventName, handler) { - var id = getEventID(element); - var c = getWrappersForEventName(id, eventName); - if (c.pluck("handler").include(handler)) return false; - - var wrapper = function(event) { - if (!Event || !Event.extend || - (event.eventName && event.eventName != eventName)) - return false; - - Event.extend(event); - handler.call(element, event); - }; - - wrapper.handler = handler; - c.push(wrapper); - return wrapper; - } - - function findWrapper(id, eventName, handler) { - var c = getWrappersForEventName(id, eventName); - return c.find(function(wrapper) { return wrapper.handler == handler }); - } - - function destroyWrapper(id, eventName, handler) { - var c = getCacheForID(id); - if (!c[eventName]) return false; - c[eventName] = c[eventName].without(findWrapper(id, eventName, handler)); - } - - function destroyCache() { - for (var id in cache) - for (var eventName in cache[id]) - cache[id][eventName] = null; - } - - - // Internet Explorer needs to remove event handlers on page unload - // in order to avoid memory leaks. - if (window.attachEvent) { - window.attachEvent("onunload", destroyCache); - } - - // Safari has a dummy event handler on page unload so that it won't - // use its bfcache. Safari <= 3.1 has an issue with restoring the "document" - // object when page is returned to via the back button using its bfcache. - if (Prototype.Browser.WebKit) { - window.addEventListener('unload', Prototype.emptyFunction, false); - } - - return { - observe: function(element, eventName, handler) { - element = $(element); - var name = getDOMEventName(eventName); - - var wrapper = createWrapper(element, eventName, handler); - if (!wrapper) return element; - - if (element.addEventListener) { - element.addEventListener(name, wrapper, false); - } else { - element.attachEvent("on" + name, wrapper); - } - - return element; - }, - - stopObserving: function(element, eventName, handler) { - element = $(element); - var id = getEventID(element), name = getDOMEventName(eventName); - - if (!handler && eventName) { - getWrappersForEventName(id, eventName).each(function(wrapper) { - element.stopObserving(eventName, wrapper.handler); - }); - return element; - - } else if (!eventName) { - Object.keys(getCacheForID(id)).each(function(eventName) { - element.stopObserving(eventName); - }); - return element; - } - - var wrapper = findWrapper(id, eventName, handler); - if (!wrapper) return element; - - if (element.removeEventListener) { - element.removeEventListener(name, wrapper, false); - } else { - element.detachEvent("on" + name, wrapper); - } - - destroyWrapper(id, eventName, handler); - - return element; - }, - - fire: function(element, eventName, memo) { - element = $(element); - if (element == document && document.createEvent && !element.dispatchEvent) - element = document.documentElement; - - var event; - if (document.createEvent) { - event = document.createEvent("HTMLEvents"); - event.initEvent("dataavailable", true, true); - } else { - event = document.createEventObject(); - event.eventType = "ondataavailable"; - } - - event.eventName = eventName; - event.memo = memo || { }; - - if (document.createEvent) { - element.dispatchEvent(event); - } else { - element.fireEvent(event.eventType, event); - } - - return Event.extend(event); - } - }; -})()); - -Object.extend(Event, Event.Methods); - -Element.addMethods({ - fire: Event.fire, - observe: Event.observe, - stopObserving: Event.stopObserving -}); - -Object.extend(document, { - fire: Element.Methods.fire.methodize(), - observe: Element.Methods.observe.methodize(), - stopObserving: Element.Methods.stopObserving.methodize(), - loaded: false -}); - -(function() { - /* Support for the DOMContentLoaded event is based on work by Dan Webb, - Matthias Miller, Dean Edwards and John Resig. */ - - var timer; - - function fireContentLoadedEvent() { - if (document.loaded) return; - if (timer) window.clearInterval(timer); - document.fire("dom:loaded"); - document.loaded = true; - } - - if (document.addEventListener) { - if (Prototype.Browser.WebKit) { - timer = window.setInterval(function() { - if (/loaded|complete/.test(document.readyState)) - fireContentLoadedEvent(); - }, 0); - - Event.observe(window, "load", fireContentLoadedEvent); - - } else { - document.addEventListener("DOMContentLoaded", - fireContentLoadedEvent, false); - } - - } else { - document.write(" - - diff --git a/oldstuff/html5/server.go b/oldstuff/html5/server.go deleted file mode 100644 index 8ba58e1..0000000 --- a/oldstuff/html5/server.go +++ /dev/null @@ -1,22 +0,0 @@ -// I wanted to practice, plus maaaaaybe I'll want something dynamic on the -// server side (???) -package main - -import ( - "flag" - "fmt" - "net/http" -) - -var ( - docroot = flag.String("d", ".", "docroot for server") - addr = flag.String("a", ":8990", "address on which to listen") -) - -func main() { - flag.Parse() - - http.Handle("/", http.FileServer(http.Dir(*docroot))) - fmt.Printf("Serving %q on %v\n", *docroot, *addr) - http.ListenAndServe(*addr, nil) -} diff --git a/oldstuff/intro-to-algorithms/README b/oldstuff/intro-to-algorithms/README deleted file mode 100644 index 20fadaf..0000000 --- a/oldstuff/intro-to-algorithms/README +++ /dev/null @@ -1,19 +0,0 @@ - _________________________________________ -/ Finally reading through the Cormen \ -| Leiserson Rivest Stein algorithms book, | -\ mannn. / - ----------------------------------------- -\ . . - \ / `. .' " - \ .---. < > < > .---. - \ | \ \ - ~ ~ - / / | - _____ ..-~ ~-..-~ - | | \~~~\.' `./~~~/ - --------- \__/ \__/ - .' O \ / / \ " - (_____, `._.' | } \/~~~/ - `----. / } | / \__/ - `-. | / | / `. ,~~| - ~-.__| /_ - ~ ^| /- _ `..-' - | / | / ~-. `-. _ _ _ - |_____| |_____| ~ - . _ _ _ _ _> diff --git a/oldstuff/intro-to-algorithms/ch02.py b/oldstuff/intro-to-algorithms/ch02.py deleted file mode 100644 index 38e8f41..0000000 --- a/oldstuff/intro-to-algorithms/ch02.py +++ /dev/null @@ -1,57 +0,0 @@ -from __future__ import print_function - -import os -import random -import timeit - - -DEBUG = os.environ.get('DEBUG') == '1' - - -def debug(msg): - if DEBUG: - print(msg) - - -def insertion_sort(arr): - debug('BEGIN') - for j in range(1, len(arr)): - key = arr[j] - i = j - 1 - debug('FOR:\tj={}, key={}, i={}'.format(j, key, i)) - - while i > -1 and arr[i] > key: - arr[i + 1] = arr[i] - debug('WHILE:\tset: arr[{}] = {}'.format(i + 1, arr[i])) - i = i - 1 - - arr[i + 1] = key - debug('FOR:\tset: arr[{}] = {}'.format(i + 1, key)) - - debug('END') - return arr - - -def main(): - for power in range(1, 5): - to_sort = list(range(10 ** power)) - to_sort_sorted = to_sort[:] - to_sort_reversed = list(reversed(to_sort[:])) - - for i in range(3): - random.shuffle(to_sort) - - for arr, desc in ( - (to_sort_sorted, 'sorted'), - (to_sort, 'shuffled'), - (to_sort_reversed, 'reversed')): - - timing = timeit.timeit( - lambda: insertion_sort(arr), - number=10 - ) - print('{} {}: {}'.format(10 ** power, desc, timing)) - - -if __name__ == '__main__': - main() diff --git a/oldstuff/intro-to-crafty/Makefile b/oldstuff/intro-to-crafty/Makefile deleted file mode 100644 index 261910e..0000000 --- a/oldstuff/intro-to-crafty/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -INTRO_ASSETS_ZIP := tmp/crafty_bng_tut_assets.zip -INTRO_ASSETS_EXTRACTED_README := tmp/crafty_bng_tut_assets/README - -.PHONY: all -all: lib/crafty.js assets/README - -.PHONY: serve -serve: - python3 -m http.server - -lib/crafty.js: - curl -sSL -o $@ http://craftyjs.com/release/0.5.3/crafty.js - -assets/README: $(INTRO_ASSETS_EXTRACTED_README) - rsync -av $(dir $(INTRO_ASSETS_EXTRACTED_README)) assets/ - -$(INTRO_ASSETS_EXTRACTED_README): $(INTRO_ASSETS_ZIP) - cd tmp && \ - unzip -o $(notdir $(INTRO_ASSETS_ZIP)) && \ - find . -type f | xargs touch - -$(INTRO_ASSETS_ZIP): - curl -sSL -o $@ http://buildnewgames.com/assets/article//introduction-to-crafty/crafty_bng_tut_assets.zip diff --git a/oldstuff/intro-to-crafty/README.md b/oldstuff/intro-to-crafty/README.md deleted file mode 100644 index fa676df..0000000 --- a/oldstuff/intro-to-crafty/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Intro To Crafty - -As presented at http://buildnewgames.com/introduction-to-crafty/. diff --git a/oldstuff/intro-to-crafty/assets/.gitkeep b/oldstuff/intro-to-crafty/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/intro-to-crafty/index.html b/oldstuff/intro-to-crafty/index.html deleted file mode 100644 index 67eb0cb..0000000 --- a/oldstuff/intro-to-crafty/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/oldstuff/intro-to-crafty/src/components.js b/oldstuff/intro-to-crafty/src/components.js deleted file mode 100644 index 24c16ae..0000000 --- a/oldstuff/intro-to-crafty/src/components.js +++ /dev/null @@ -1,81 +0,0 @@ -Crafty.c('Grid', { - init: function() { - this.attr({ - w: Game.map_grid.tile.width, - h: Game.map_grid.tile.height - }) - }, - - at: function(x, y) { - if (x === undefined && y === undefined) { - return { - x: this.x / Game.map_grid.tile.width, - y: this.y / Game.map_grid.tile.height - } - } else { - this.attr({ - x: x * Game.map_grid.tile.width, - y: y * Game.map_grid.tile.height - }); - return this; - } - } -}); - -Crafty.c('Actor', { - init: function() { - this.requires('2D, Canvas, Grid'); - } -}); - -Crafty.c('Tree', { - init: function() { - this.requires('Actor, Color, Solid') - .color('rgb(20, 125, 40)'); - } -}); - -Crafty.c('Bush', { - init: function() { - this.requires('Actor, Color, Solid') - .color('rgb(20, 185, 40)'); - } -}); - -Crafty.c('PlayerCharacter', { - init: function() { - this.requires('Actor, Fourway, Color, Collision') - .fourway(4) - .color('rgb(20, 75, 40)') - .stopOnSolids() - .onHit('Village', this.visitVillage); - }, - - stopOnSolids: function() { - this.onHit('Solid', this.stopMovement); - return this; - }, - - stopMovement: function() { - this._speed = 0; - if (this._movement) { - this.x -= this._movement.x; - this.y -= this._movement.y; - } - }, - - visitVillage: function(data) { - data[0].obj.collect(); - } -}); - -Crafty.c('Village', { - init: function() { - this.requires('Actor, Color') - .color('rgb(170, 125, 40)'); - }, - - collect: function() { - this.destroy(); - } -}); diff --git a/oldstuff/intro-to-crafty/src/game.js b/oldstuff/intro-to-crafty/src/game.js deleted file mode 100644 index 75fa8f2..0000000 --- a/oldstuff/intro-to-crafty/src/game.js +++ /dev/null @@ -1,46 +0,0 @@ -Game = { - map_grid: { - width: 24, - height: 16, - tile: { - width: 16, - height: 16 - } - }, - - width: function() { - return this.map_grid.width * this.map_grid.tile.width; - }, - - height: function() { - return this.map_grid.height * this.map_grid.tile.height; - }, - - start: function() { - Crafty.init(Game.width(), Game.height()); - Crafty.background('rgb(249, 223, 125)'); - - Crafty.e('PlayerCharacter').at(5, 5); - - var max_villages = 5; - - for (var x = 0; x < Game.map_grid.width; x++) { - for (var y = 0; y < Game.map_grid.height; y++) { - var at_edge = x == 0 || - x == Game.map_grid.width - 1 || - y == 0 || - y == Game.map_grid.height - 1; - - if (at_edge) { - Crafty.e('Tree').at(x, y); - } else if (Math.random() < 0.06) { - Crafty.e('Bush').at(x, y); - } - - if (Math.random() < 0.02 && Crafty('Village').length < max_villages) { - Crafty.e('Village').at(x, y); - } - } - } - } -} diff --git a/oldstuff/intro-to-crafty/tmp/.gitkeep b/oldstuff/intro-to-crafty/tmp/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/kiddofun/quiz.rb b/oldstuff/kiddofun/quiz.rb deleted file mode 100644 index 3310946..0000000 --- a/oldstuff/kiddofun/quiz.rb +++ /dev/null @@ -1,38 +0,0 @@ -def main - loop do - secret_number = rand(0..99) - hint_0 = secret_number - rand(0..49) - - loop do - say "#{secret_number - hint_0} + #{hint_0} is", newline: false - print '?: ' - begin - answer = Integer($stdin.readline.strip) - if answer == secret_number - say 'You got it!' - break - else - say 'That is so incorrect!' - end - rescue => e - $stderr.puts e - say 'NO, Human!' - end - end - - say 'Do you want to play again? ', newline: false - print '[Y/n] ' - if $stdin.readline.strip.downcase =~ /^n/ - say 'Goodbye, Human!' - break - end - end -end - -def say(msg, newline: true) - print msg - print "\n" if newline - system "say -v ralph #{msg.inspect}" -end - -main diff --git a/oldstuff/kiddofun/rounding.go b/oldstuff/kiddofun/rounding.go deleted file mode 100644 index 0999528..0000000 --- a/oldstuff/kiddofun/rounding.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -import ( - "fmt" -) - -func main() { - number := 43 - - fmt.Printf("%-2d - number\n", number) - fmt.Printf("%-2d - number tens place\n", number/10) - fmt.Printf("%-2d - number tens place multiplied by 10\n", (number/10)*10) -} diff --git a/oldstuff/kiddofun/rounding.rb b/oldstuff/kiddofun/rounding.rb deleted file mode 100644 index 552032e..0000000 --- a/oldstuff/kiddofun/rounding.rb +++ /dev/null @@ -1,9 +0,0 @@ -number = Integer(ARGV.fetch(0)) -divisor = Float(ARGV.fetch(1, 10.0)) - -raise 'Invalid divisor' unless divisor % 10 == 0 - -puts "#{number} - number" -puts "#{(Float(number) / divisor).round(0)} - number divided by #{divisor}" -puts "#{(Float(number) / divisor).round(0) * Integer(divisor)} - " \ - "number divided by #{divisor}, multiplied by #{Integer(divisor)}" diff --git a/oldstuff/lcthw-remnants-2/.gitignore b/oldstuff/lcthw-remnants-2/.gitignore deleted file mode 100644 index 3860bfb..0000000 --- a/oldstuff/lcthw-remnants-2/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.dat -ex* -!ex29 -!ex*.c -devpkgzed -*.log diff --git a/oldstuff/lcthw-remnants-2/Dockerfile b/oldstuff/lcthw-remnants-2/Dockerfile deleted file mode 100644 index 0ccf6c0..0000000 --- a/oldstuff/lcthw-remnants-2/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:xenial - -ENV DEBIAN_FRONTEND noninteractive - -WORKDIR /app - -RUN apt-get update -yq -RUN apt-get install -yq --no-install-recommends --no-install-suggests \ - build-essential \ - curl \ - file \ - gdb \ - git \ - man \ - sudo \ - vim-tiny \ - zsh -RUN echo "kernel.yama.ptrace_scope = 0" > /etc/sysctl.d/10-ptrace.conf - -CMD ["zsh", "-l"] diff --git a/oldstuff/lcthw-remnants-2/Makefile b/oldstuff/lcthw-remnants-2/Makefile deleted file mode 100644 index b9b8c93..0000000 --- a/oldstuff/lcthw-remnants-2/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -SHELL = /bin/bash -CFLAGS = -Wall -g -DNDEBUG -fPIC -LDLIBS = -ldl - -EXERCISES := $(shell ./list-exercises) - -all: $(EXERCISES) - -ex19: object.o - -ex22_main: ex22.o - -clean: - shopt -s nullglob ; \ - $(RM) $(EXERCISES) *.o *.a - -test: - @./runtests - -exercises: - @echo $(EXERCISES) - -.PHONY: docker-image -docker-image: - docker build -t meatballhat/lcthw:latest . - -.PHONY: docker-run -docker-run: - docker run -it -v $(PWD):/app meatballhat/lcthw diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/.gitignore b/oldstuff/lcthw-remnants-2/c-skeleton/.gitignore deleted file mode 100644 index 790f18a..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -tests/runtests -tests/*_tests -tests/**/*_tests diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/LICENSE b/oldstuff/lcthw-remnants-2/c-skeleton/LICENSE deleted file mode 100644 index c5b39b0..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (C) 2016 Dan Buch - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/Makefile b/oldstuff/lcthw-remnants-2/c-skeleton/Makefile deleted file mode 100644 index fae7993..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -CFLAGS = -g -O2 -Wall -Wextra -Isrc -Lbuild -rdynamic -DNDEBUG $(OPTFLAGS) -LDLIBS = -ldl $(OPTLIBS) - -PREFIX ?= /usr/local - -SOURCES = $(wildcard src/**/*.c src/*.c) -OBJECTS = $(patsubst %.c,%.o,$(SOURCES)) - -TEST_SRC = $(wildcard tests/*_tests.c) -TESTS = $(patsubst %.c,%,$(TEST_SRC)) - -LIBNAME = YOUR_LIBRARY -TARGET = build/lib$(LIBNAME).a -SO_TARGET = $(patsubst %.a,%.so,$(TARGET)) - -# The Target Build -all: $(TARGET) $(SO_TARGET) tests - -dev: CFLAGS = -g -Wall -Isrc -Wall -Wextra $(OPTFLAGS) -dev: all - -$(TARGET): CFLAGS += -fPIC -$(TARGET): build $(OBJECTS) - $(AR) rcs $@ $(OBJECTS) - ranlib $@ - -$(SO_TARGET): $(TARGET) $(OBJECTS) - $(CC) -shared -o $@ $(OBJECTS) - -build: - @mkdir -p build - @mkdir -p bin - -# The Unit Tests -.PHONY: tests -tests: LDLIBS += -static -l$(LIBNAME) -tests: ./tests/runtests $(TESTS) - ./tests/runtests - -valgrind: - VALGRIND="valgrind --log-file=/tmp/valgrind-%p.log" $(MAKE) - -# The Cleaner -clean: - rm -rf build $(OBJECTS) $(TESTS) - rm -f tests/tests.log tests/runtests - find . -name "*.gc*" -exec rm {} \; - rm -rf `find . -name "*.dSYM" -print` - -# The Install -install: all - install -d $(DESTDIR)/$(PREFIX)/lib/ - install $(TARGET) $(DESTDIR)/$(PREFIX)/lib/ - -# The Checker -BADFUNCS='[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)' -check: - @echo Files with potentially dangerous functions - @egrep $(BADFUNCS) $(SOURCES) || true diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/README.md b/oldstuff/lcthw-remnants-2/c-skeleton/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/src/dbg.h b/oldstuff/lcthw-remnants-2/c-skeleton/src/dbg.h deleted file mode 100644 index a7aaa6a..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/src/dbg.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __dbg_h__ -#define __dbg_h__ - -#include -#include -#include - -#ifdef NDEBUG -#define debug(M, ...) -#else -#define debug(M, ...) fprintf(stderr, "DEBUG %s:%d:%s: " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) -#endif - -#define clean_errno() (errno == 0 ? "None" : strerror(errno)) - -#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d:%s) " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) - -#define check(A, M, ...) if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define sentinel(M, ...) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define check_mem(A) check((A), "Out of memory.") - -#define check_debug(A, M, ...) if(!(A)) { debug(M, ##__VA_ARGS__); errno=0; goto error; } - -#endif diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/src/your_library.c b/oldstuff/lcthw-remnants-2/c-skeleton/src/your_library.c deleted file mode 100644 index 24b58f6..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/src/your_library.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "your_library.h" - -int howmanyweasels() -{ - return WEASELS; -} diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/src/your_library.h b/oldstuff/lcthw-remnants-2/c-skeleton/src/your_library.h deleted file mode 100644 index 53e21f0..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/src/your_library.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _your_library_h -#define _your_library_h - -#define WEASELS 23 - -int howmanyweasels(); - -#endif diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/tests/minunit.h b/oldstuff/lcthw-remnants-2/c-skeleton/tests/minunit.h deleted file mode 100644 index 047ab81..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/tests/minunit.h +++ /dev/null @@ -1,38 +0,0 @@ -#undef DNDEBUG -#ifndef _minunit_h -#define _minunit_h - -#include -#include -#include - -#define mu_suite_start() char *message = NULL - -#define mu_assert(test, message) if (!(test)) {\ - log_err(message); return message;\ - }\ - assertions_made++; -#define mu_run_test(test) debug("\n-----%s", " " #test); \ - message = test(); tests_run++; if (message) return message; - -#define RUN_TESTS(name) int main(int argc, char *argv[]) {\ - argc = argc; \ - argv = argv; \ - debug("----- RUNNING: %s", argv[0]);\ - printf("----\nRUNNING: %s\n", argv[0]);\ - char *result = name();\ - if (result != 0) {\ - printf("FAILED: %s\n", result);\ - }\ - else {\ - printf("ALL TESTS PASSED\n");\ - }\ - printf("Tests run: %d\n", tests_run);\ - printf("Assertions made: %d\n", assertions_made);\ - exit(result != 0);\ -} - -int tests_run; -int assertions_made; - -#endif diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/tests/runtests.c b/oldstuff/lcthw-remnants-2/c-skeleton/tests/runtests.c deleted file mode 100644 index fffa8f7..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/tests/runtests.c +++ /dev/null @@ -1,107 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int test_selector(const struct dirent *ep) -{ - return fnmatch("*_tests", ep->d_name, 0) == 0; -} - -int run_tests_file(char *filename) -{ - if(access(filename, R_OK | X_OK) == 0) { - return system(filename); - } - - return -1; -} - -int main(int argc, char *argv[]) -{ - int entcount = 0; - int rc = 0; - int i = 0; - int ntests = 0; - char *testsdir = NULL; - char *valgrind = getenv("VALGRIND"); - struct dirent **namelist = NULL; - struct dirent *ep = NULL; - - if(argc > 1) { - testsdir = argv[1]; - } - - if(!testsdir) { - testsdir = getenv("TESTS"); - } - - if(!testsdir) { - testsdir = "./tests"; - } - - entcount = scandir((const char *)testsdir, &namelist, test_selector, alphasort); - check(entcount > -1, "Failed to scan tests dir"); - - for(i = 0; i < entcount; i++) { - ep = namelist[i]; - check(ep, "Dirent is missing."); - - char filename[256]; - rc = sprintf(filename, "%s/%s", testsdir, ep->d_name); - check(rc > -1, "Failed to build filename."); - debug("Found filename '%s'", filename); - - free(ep); - - if(valgrind) { - char command[1024]; - rc = sprintf(command, "%s %s", valgrind, filename); - check(rc > -1, "Failed to build command with valgrind."); - rc = run_tests_file(command); - } else { - rc = run_tests_file(filename); - } - - if(rc > 0) { - debug("Skipping '%s'", filename); - continue; - } - - ntests++; - - if(rc == 0) { - printf("%s PASS\n", filename); - continue; - } - - printf("ERROR in test %s", filename); - if(access("tests/tests.log", R_OK) == 0) { - printf(": here's tests/tests.log\n"); - printf("------\n"); - rc = system("tail tests/tests.log"); - } else { - printf("\n"); - } - goto error; - } - - printf("------\n"); - printf("Total of %d test file%s run.\n", ntests, ntests > 1 ? "s" : ""); - - if(namelist) { - free(namelist); - } - - return 0; - -error: - if(namelist) { - free(namelist); - } - - return rc != 0 ? rc : 1; -} diff --git a/oldstuff/lcthw-remnants-2/c-skeleton/tests/your_library_tests.c b/oldstuff/lcthw-remnants-2/c-skeleton/tests/your_library_tests.c deleted file mode 100644 index dcd1ed6..0000000 --- a/oldstuff/lcthw-remnants-2/c-skeleton/tests/your_library_tests.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include "your_library.h" - -int main() -{ - printf("WEASELS: %d\n", howmanyweasels()); - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/dbg.h b/oldstuff/lcthw-remnants-2/dbg.h deleted file mode 100644 index a7aaa6a..0000000 --- a/oldstuff/lcthw-remnants-2/dbg.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __dbg_h__ -#define __dbg_h__ - -#include -#include -#include - -#ifdef NDEBUG -#define debug(M, ...) -#else -#define debug(M, ...) fprintf(stderr, "DEBUG %s:%d:%s: " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) -#endif - -#define clean_errno() (errno == 0 ? "None" : strerror(errno)) - -#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d:%s) " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) - -#define check(A, M, ...) if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define sentinel(M, ...) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define check_mem(A) check((A), "Out of memory.") - -#define check_debug(A, M, ...) if(!(A)) { debug(M, ##__VA_ARGS__); errno=0; goto error; } - -#endif diff --git a/oldstuff/lcthw-remnants-2/devpkg/.gitignore b/oldstuff/lcthw-remnants-2/devpkg/.gitignore deleted file mode 100644 index e8e5ca9..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bstrlib.* -devpkg diff --git a/oldstuff/lcthw-remnants-2/devpkg/Makefile b/oldstuff/lcthw-remnants-2/devpkg/Makefile deleted file mode 100644 index 40cf514..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -BSTRLIB_BASE_URL ?= https://raw.githubusercontent.com/websnarf/bstrlib/208b1f2a4dfc96b806ed499bd1909e87ec15981d -PREFIX ?= /usr/local -CFLAGS = -g -Wall -I${PREFIX}/apr/include/apr-1 -I${PREFIX}/apr/include/apr-util-1 -LDFLAGS = -L${PREFIX}/apr/lib -LDLIBS = -lapr-1 -pthread -laprutil-1 - -all: devpkg - -devpkg: bstrlib.o db.o shell.o commands.o - -prebuild: - sudo mkdir -p /etc/ld.so.conf.d - echo $(DESTDIR)/$(PREFIX)/lib | sudo tee /etc/ld.so.conf.d/devpkg.conf - sudo ldconfig - -install: all - install -d $(DESTDIR)/$(PREFIX)/bin/ - install devpkg $(DESTDIR)/$(PREFIX)/bin/ - -clean: - $(RM) *.o - $(RM) devpkg - $(RM) *.dSYM - $(RM) bstrlib.c bstrlib.h - -bstrlib.c: bstrlib.h - curl -sSLO $(BSTRLIB_BASE_URL)/bstrlib.c - -bstrlib.h: - curl -sSLO $(BSTRLIB_BASE_URL)/bstrlib.h diff --git a/oldstuff/lcthw-remnants-2/devpkg/README b/oldstuff/lcthw-remnants-2/devpkg/README deleted file mode 100644 index 4e973c9..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/README +++ /dev/null @@ -1,47 +0,0 @@ -# `devpkg` - -This is a thingy that downloads, builds, and installs stuff! - -## usage - -Before you can do the fun part, you need to initialize the bits: - -``` bash -devpkg -S -``` - -Install something via URL: - -``` bash -devpkg -I http://example.org/foo.tar.bz2 -``` - -Install something via URL with custom arguments for configure, make, and -install: - -``` bash -devpkg -I http://example.org/foo.tar.bz2 -c '--no-flair' -m 'CFLAGS+=-Wall' -i '-n' -``` - -Perform a fetch *only* without building or installing: - -``` bash -devpkg -F http://example.org/foo.tar.bz2 -``` - -Perform a build *only* without installing: - -``` bash -devpkg -B http://example.org/foo.tar.bz2 -``` - -List the stuff that's been installed: - -``` bash -devpkg -L -``` - - - diff --git a/oldstuff/lcthw-remnants-2/devpkg/commands.c b/oldstuff/lcthw-remnants-2/devpkg/commands.c deleted file mode 100644 index 5c82735..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/commands.c +++ /dev/null @@ -1,174 +0,0 @@ -#include -#include -#include - -#include "commands.h" -#include "dbg.h" -#include "bstrlib.h" -#include "db.h" -#include "shell.h" - - -int Command_depends(apr_pool_t *p, const char *path) -{ - FILE *in = NULL; - bstring line = NULL; - - in = fopen(path, "r"); - check(in != NULL, "Failed to open downloaded depends: %s", path); - - for(line = bgets((bNgetc)fgetc, in, '\n'); line != NULL; - line = bgets((bNgetc)fgetc, in, '\n')) - { - btrimws(line); - log_info("Processing depends: %s", bdata(line)); - int rc = Command_install(p, bdata(line), NULL, NULL, NULL); - check(rc == 0, "Failed to install: %s", bdata(line)); - bdestroy(line); - } - - fclose(in); - return 0; - -error: - if(line) bdestroy(line); - if(in) fclose(in); - return -1; -} - -int Command_fetch(apr_pool_t *p, const char *url, int fetch_only) -{ - apr_uri_t info = {.port = 0}; - int rc = 0; - const char *depends_file = NULL; - apr_status_t rv = apr_uri_parse(p, url, &info); - - check(rv == APR_SUCCESS, "Failed to parse URL: %s", url); - - if(apr_fnmatch(GIT_PAT, info.path, 0) == APR_SUCCESS) { - rc = Shell_exec(GIT_SH, "URL", url, NULL); - check(rc == 0, "git failed."); - } else if(apr_fnmatch(DEPEND_PAT, info.path, 0) == APR_SUCCESS) { - check(!fetch_only, "No point in fetching a DEPENDS file."); - - if(info.scheme) { - depends_file = DEPENDS_PATH; - rc = Shell_exec(CURL_SH, "URL", url, "TARGET", depends_file, NULL); - check(rc == 0, "Curl failed."); - } else { - depends_file = info.path; - } - - // recursively process the devpkg list - log_info("Building according to DEPENDS: %s", url); - rv = Command_depends(p, depends_file); - check(rv == 0, "Failed to process the DEPENDS: %s", url); - - // this indicates that nothing needs to be done - return 0; - - } else if(apr_fnmatch(TAR_GZ_PAT, info.path, 0) == APR_SUCCESS) { - if(info.scheme) { - rc = Shell_exec(CURL_SH, - "URL", url, - "TARGET", TAR_GZ_SRC, NULL); - check(rc == 0, "Failed to curl source: %s", url); - } - - rv = apr_dir_make_recursive(BUILD_DIR, - APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); - check(rv == APR_SUCCESS, "Failed to make directory %s", BUILD_DIR); - - rc = Shell_exec(TAR_SH, "FILE", TAR_GZ_SRC, NULL); - check(rc == 0, "Failed to untar %s", TAR_GZ_SRC); - } else if(apr_fnmatch(TAR_BZ2_PAT, info.path, 0) == APR_SUCCESS) { - if(info.scheme) { - rc = Shell_exec(CURL_SH, "URL", url, "TARGET", TAR_BZ2_SRC, NULL); - check(rc == 0, "Curl failed."); - } - - apr_status_t rc = apr_dir_make_recursive(BUILD_DIR, - APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); - - check(rc == 0, "Failed to make directory %s", BUILD_DIR); - rc = Shell_exec(TAR_SH, "FILE", TAR_BZ2_SRC, NULL); - check(rc == 0, "Failed to untar %s", TAR_BZ2_SRC); - } else { - sentinel("Don't know how to handle %s", url); - } - - // indicates that an install needs to actually run - return 1; -error: - return -1; -} - -int Command_build(apr_pool_t *p, const char *url, const char *configure_opts, - const char *make_opts, const char *install_opts) -{ - int rc = 0; - - check(access(BUILD_DIR, X_OK | R_OK | W_OK) == 0, - "Build directory doesn't exist: %s", BUILD_DIR); - - // actually do an install - if(access(CONFIG_SCRIPT, X_OK) == 0) { - log_info("Has a configure script, running it."); - rc = Shell_exec(CONFIGURE_SH, "OPTS", configure_opts, NULL); - check(rc == 0, "Failed to configure"); - } - - rc = Shell_exec(MAKE_SH, "OPTS", make_opts, NULL); - check(rc == 0, "Failed to build."); - - rc = Shell_exec(INSTALL_SH, - "TARGET", install_opts ? install_opts : "install", - NULL); - check(rc == 0, "Failed to install."); - - rc = Shell_exec(CLEANUP_SH, NULL); - check(rc == 0, "Failed to cleanup after build."); - - rc = DB_update(url); - check(rc == 0, "Failed to add this package to the database."); - - return 0; - -error: - return -1; -} - -int Command_install(apr_pool_t *p, const char *url, const char *configure_opts, - const char *make_opts, const char *install_opts) -{ - int rc = 0; - check(Shell_exec(CLEANUP_SH, NULL) == 0, "Failed to cleanup before building."); - - rc = DB_find(url); - check(rc != -1, "Error checking the install database."); - - if(rc == 1) { - log_info("Package %s already installed.", url); - return 0; - } - - rc = Command_fetch(p, url, 0); - - if(rc == 1) { - rc = Command_build(p, url, configure_opts, make_opts, install_opts); - check(rc == 0, "Failed to build: %s", url); - } else if(rc == 0) { - // no install needed - log_info("Depends successfully installed: %s", url); - } else { - // had an error - sentinel("Install failed: %s", url); - } - - Shell_exec(CLEANUP_SH, NULL); - return 0; - -error: - Shell_exec(CLEANUP_SH, NULL); - return -1; -} diff --git a/oldstuff/lcthw-remnants-2/devpkg/commands.h b/oldstuff/lcthw-remnants-2/devpkg/commands.h deleted file mode 100644 index aabe6a4..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/commands.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _commands_h -#define _commands_h - -#include - -#define DEPENDS_PATH "/tmp/DEPENDS" -#define TAR_GZ_SRC "/tmp/pkg-src.tar.gz" -#define TAR_BZ2_SRC "/tmp/pkg-src.tar.bz2" -#define BUILD_DIR "/tmp/pkg-build" -#define GIT_PAT "*.git" -#define DEPEND_PAT "*DEPENDS" -#define TAR_GZ_PAT "*.tar.gz" -#define TAR_BZ2_PAT "*.tar.bz2" -#define CONFIG_SCRIPT "/tmp/pkg-build/configure" - -enum CommandType { - COMMAND_NONE, COMMAND_INSTALL, COMMAND_LIST, COMMAND_FETCH, - COMMAND_INIT, COMMAND_BUILD -}; - -int Command_fetch(apr_pool_t *p, const char *url, int fetch_only); - -int Command_install(apr_pool_t *p, const char *url, const char *configure_opts, - const char *make_opts, const char *install_opts); - -int Command_depends(apr_pool_t *p, const char *path); - -int Command_build(apr_pool_t *p, const char *url, const char *configure_opts, - const char *make_opts, const char *install_opts); - -#endif diff --git a/oldstuff/lcthw-remnants-2/devpkg/db.c b/oldstuff/lcthw-remnants-2/devpkg/db.c deleted file mode 100644 index 879e55d..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/db.c +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include -#include - -#include "db.h" -#include "bstrlib.h" -#include "dbg.h" - -static FILE *DB_open(const char *path, const char *mode) -{ - return fopen(path, mode); -} - - -static void DB_close(FILE *db) -{ - fclose(db); -} - - -static bstring DB_load() -{ - FILE *db = NULL; - bstring data = NULL; - - db = DB_open(DB_FILE, "r"); - check(db, "Failed to open database: %s", DB_FILE); - - data = bread((bNread)fread, db); - check(data, "Failed to read from db file: %s", DB_FILE); - - DB_close(db); - return data; - -error: - if(db) DB_close(db); - if(data) bdestroy(data); - return NULL; -} - - -int DB_update(const char *url) -{ - if(DB_find(url)) { - log_info("Already recorded as installed: %s", url); - } - - FILE *db = DB_open(DB_FILE, "a+"); - check(db, "Failed to open DB file: %s", DB_FILE); - - bstring line = bfromcstr(url); - bconchar(line, '\n'); - int rc = fwrite(line->data, blength(line), 1, db); - check(rc == 1, "Failed to append to the db."); - - return 0; -error: - if(db) DB_close(db); - return -1; -} - - -int DB_find(const char *url) -{ - bstring data = NULL; - bstring line = bfromcstr(url); - int res = -1; - - data = DB_load(); - check(data, "Failed to load: %s", DB_FILE); - - if(binstr(data, 0, line) == BSTR_ERR) { - res = 0; - } else { - res = 1; - } - -error: // fallthrough - if(data) bdestroy(data); - if(line) bdestroy(line); - - return res; -} - - -int DB_init() -{ - apr_pool_t *p = NULL; - apr_pool_initialize(); - apr_pool_create(&p, NULL); - - if(access(DB_DIR, W_OK | X_OK) == -1) { - apr_status_t rc = apr_dir_make_recursive(DB_DIR, - APR_UREAD | APR_UWRITE | APR_UEXECUTE | - APR_GREAD | APR_GWRITE | APR_GEXECUTE, p); - check(rc == APR_SUCCESS, "Failed to make database dir: %s", DB_DIR); - } - - if(access(DB_FILE, W_OK) == -1) { - FILE *db = DB_open(DB_FILE, "w"); - check(db, "Cannot open database: %s", DB_FILE); - DB_close(db); - } - - apr_pool_destroy(p); - return 0; - -error: - apr_pool_destroy(p); - return -1; -} - - -int DB_list() -{ - bstring data = DB_load(); - check(data, "Failed to read load: %s", DB_FILE); - - printf("%s", bdata(data)); - bdestroy(data); - return 0; - -error: - return -1; -} diff --git a/oldstuff/lcthw-remnants-2/devpkg/db.h b/oldstuff/lcthw-remnants-2/devpkg/db.h deleted file mode 100644 index 9f54f0f..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/db.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _db_h -#define _db_h - -#define DB_FILE "/usr/local/.devpkg/db" -#define DB_DIR "/usr/local/.devpkg" - -int DB_init(); -int DB_list(); -int DB_update(const char *url); -int DB_find(const char *url); - -#endif diff --git a/oldstuff/lcthw-remnants-2/devpkg/dbg.h b/oldstuff/lcthw-remnants-2/devpkg/dbg.h deleted file mode 100644 index a7aaa6a..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/dbg.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __dbg_h__ -#define __dbg_h__ - -#include -#include -#include - -#ifdef NDEBUG -#define debug(M, ...) -#else -#define debug(M, ...) fprintf(stderr, "DEBUG %s:%d:%s: " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) -#endif - -#define clean_errno() (errno == 0 ? "None" : strerror(errno)) - -#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d:%s) " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) - -#define check(A, M, ...) if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define sentinel(M, ...) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define check_mem(A) check((A), "Out of memory.") - -#define check_debug(A, M, ...) if(!(A)) { debug(M, ##__VA_ARGS__); errno=0; goto error; } - -#endif diff --git a/oldstuff/lcthw-remnants-2/devpkg/devpkg.c b/oldstuff/lcthw-remnants-2/devpkg/devpkg.c deleted file mode 100644 index ff76c2b..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/devpkg.c +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include -#include -#include -#include - -#include "dbg.h" -#include "db.h" -#include "commands.h" - -int main(int argc, const char const *argv[]) -{ - apr_pool_t *p = NULL; - apr_pool_initialize(); - apr_pool_create(&p, NULL); - - apr_getopt_t *opt; - apr_status_t rv; - - char ch = '\0'; - const char *optarg = NULL; - const char *config_opts = NULL; - const char *install_opts = NULL; - const char *make_opts = NULL; - const char *url = NULL; - enum CommandType request = COMMAND_NONE; - - - rv = apr_getopt_init(&opt, p, argc, argv); - - while(apr_getopt(opt, "I:Lc:m:i:d:SF:B:", &ch, &optarg) == APR_SUCCESS) { - switch(ch) { - case 'I': - request = COMMAND_INSTALL; - url = optarg; - break; - - case 'L': - request = COMMAND_LIST; - break; - - case 'c': - config_opts = optarg; - break; - - case 'm': - make_opts = optarg; - break; - - case 'i': - install_opts = optarg; - break; - - case 'S': - request = COMMAND_INIT; - break; - - case 'F': - request = COMMAND_FETCH; - url = optarg; - break; - - case 'B': - request = COMMAND_BUILD; - url = optarg; - break; - } - } - - switch(request) { - case COMMAND_INSTALL: - check(url, "You must at least give a URL."); - Command_install(p, url, config_opts, make_opts, install_opts); - break; - - case COMMAND_LIST: - DB_list(); - break; - - case COMMAND_FETCH: - check(url != NULL, "You must give a URL."); - Command_fetch(p, url, 1); - log_info("Downloaded to %s and in /tmp/", BUILD_DIR); - break; - - case COMMAND_BUILD: - check(url, "You must at least give a URL."); - Command_build(p, url, config_opts, make_opts, install_opts); - break; - - case COMMAND_INIT: - rv = DB_init(); - check(rv == 0, "Failed to make the database."); - break; - - default: - sentinel("Invalid command given."); - } - - return 0; - -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants-2/devpkg/shell.c b/oldstuff/lcthw-remnants-2/devpkg/shell.c deleted file mode 100644 index 5da733b..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/shell.c +++ /dev/null @@ -1,120 +0,0 @@ -#include "shell.h" -#include "dbg.h" -#include - -int Shell_exec(Shell template, ...) -{ - apr_pool_t *p = NULL; - int rc = -1; - apr_status_t rv = APR_SUCCESS; - va_list argp; - const char *key = NULL; - const char *arg = NULL; - int i = 0; - - rv = apr_pool_create(&p, NULL); - check(rv == APR_SUCCESS, "Failed to create pool."); - - va_start(argp, template); - - for(key = va_arg(argp, const char *); - key != NULL; - key = va_arg(argp, const char *)) - { - arg = va_arg(argp, const char *); - - for(i = 0; template.args[i] != NULL; i++) { - if(strcmp(template.args[i], key) == 0) { - template.args[i] = arg; - break; // found it - } - } - } - - rc = Shell_run(p, &template); - apr_pool_destroy(p); - va_end(argp); - return rc; - -error: - if(p) { - apr_pool_destroy(p); - } - return rc; -} - -int Shell_run(apr_pool_t *p, Shell *cmd) -{ - apr_procattr_t *attr; - apr_status_t rv; - apr_proc_t newproc; - - rv = apr_procattr_create(&attr, p); - check(rv == APR_SUCCESS, "Failed to create proc attr."); - - rv = apr_procattr_io_set(attr, APR_NO_PIPE, APR_NO_PIPE, APR_NO_PIPE); - check(rv == APR_SUCCESS, "Failed to set IO of command."); - - rv = apr_procattr_dir_set(attr, cmd->dir); - check(rv == APR_SUCCESS, "Failed to set root to %s", cmd->dir); - - rv = apr_procattr_cmdtype_set(attr, APR_PROGRAM_PATH); - check(rv == APR_SUCCESS, "Failed to set cmd type."); - - rv = apr_proc_create(&newproc, cmd->exe, cmd->args, NULL, attr, p); - check(rv == APR_SUCCESS, "Failed to run command."); - - rv = apr_proc_wait(&newproc, &cmd->exit_code, &cmd->exit_why, APR_WAIT); - check(rv == APR_CHILD_DONE, "Failed to wait."); - - check(cmd->exit_code == 0, "%s exited badly.", cmd->exe); - check(cmd->exit_why == APR_PROC_EXIT, "%s was killed or crashed", cmd->exe); - - return 0; - -error: - return -1; -} - -Shell CLEANUP_SH = { - .exe = "rm", - .dir = "/tmp", - .args = {"rm", "-rf", "/tmp/pkg-build", "/tmp/pkg-src.tar.gz", - "/tmp/pkg-src.tar.bz2", "/tmp/DEPENDS", NULL} -}; - -Shell GIT_SH = { - .dir = "/tmp", - .exe = "git", - .args = {"git", "clone", "URL", "pkg-build", NULL} -}; - -Shell TAR_SH = { - .dir = "/tmp/pkg-build", - .exe = "tar", - .args = {"tar", "-xzf", "FILE", "--strip-components", "1", NULL} -}; - -Shell CURL_SH = { - .dir = "/tmp", - .exe = "curl", - .args = {"curl", "-L", "-o", "TARGET", "URL", NULL} -}; - -Shell CONFIGURE_SH = { - .exe = "./configure", - .dir = "/tmp/pkg-build", - .args = {"configure", "OPTS", NULL}, -}; - -Shell MAKE_SH = { - .exe = "make", - .dir = "/tmp/pkg-build", - .args = {"make", "OPTS", NULL} -}; - -Shell INSTALL_SH = { - .exe = "sudo", - .dir = "/tmp/pkg-build", - .args = {"sudo", "make", "TARGET", NULL} -}; diff --git a/oldstuff/lcthw-remnants-2/devpkg/shell.h b/oldstuff/lcthw-remnants-2/devpkg/shell.h deleted file mode 100644 index e966454..0000000 --- a/oldstuff/lcthw-remnants-2/devpkg/shell.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _shell_h -#define _shell_h - -#define MAX_COMMAND_ARGS 100 - -#include - -typedef struct Shell { - const char *dir; - const char *exe; - - apr_procattr_t *attr; - apr_proc_t proc; - apr_exit_why_e exit_why; - int exit_code; - - const char *args[MAX_COMMAND_ARGS]; -} Shell; - -int Shell_run(apr_pool_t *p, Shell *cmd); -int Shell_exec(Shell cmd, ...); - -extern Shell CLEANUP_SH; -extern Shell GIT_SH; -extern Shell TAR_SH; -extern Shell CURL_SH; -extern Shell CONFIGURE_SH; -extern Shell MAKE_SH; -extern Shell INSTALL_SH; - -#endif diff --git a/oldstuff/lcthw-remnants-2/ex1.c b/oldstuff/lcthw-remnants-2/ex1.c deleted file mode 100644 index d38c074..0000000 --- a/oldstuff/lcthw-remnants-2/ex1.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - puts("Hello world."); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex10.c b/oldstuff/lcthw-remnants-2/ex10.c deleted file mode 100644 index 72e08b6..0000000 --- a/oldstuff/lcthw-remnants-2/ex10.c +++ /dev/null @@ -1,25 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int i = 0; - - // go through each string in argv - // why am I skipping argv[0]; - for(i = 1; i < argc; i++) { - printf("arg %d: %s\n", i, argv[i]); - } - - // let's make our own array of strings - char *states[] = { - "California", "Oregon", - "Washington", "Texas" - }; - int num_states = 4; - - for(i = 0; i < num_states; i++) { - printf("state %d: %s\n", i, states[i]); - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex11.c b/oldstuff/lcthw-remnants-2/ex11.c deleted file mode 100644 index 6430125..0000000 --- a/oldstuff/lcthw-remnants-2/ex11.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - // go through each string in argv - - int i = 0; - while(i < argc) { - printf("arg %d: %s\n", i, argv[i]); - i++; - } - - // let's make our own array of strings - char *states[] = { - "California", "Oregon", - "Washington", "Texas" - }; - - int num_states = 4; - i = 0; // watch for this - while(i < num_states) { - printf("state %d: %s\n", i, states[i]); - i++; - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex12.c b/oldstuff/lcthw-remnants-2/ex12.c deleted file mode 100644 index 3c647e2..0000000 --- a/oldstuff/lcthw-remnants-2/ex12.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int i = 0; - - if(argc == 1) { - printf("You only have one argument. You suck.\n"); - } else if(argc > 1 && argc < 4) { - printf("Here's your arguments:\n"); - - for(i = 0; i < argc; i++) { - printf("%s ", argv[i]); - } - printf("\n"); - } else { - printf("You have too many arguments. You suck.\n"); - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex13.c b/oldstuff/lcthw-remnants-2/ex13.c deleted file mode 100644 index e5df45d..0000000 --- a/oldstuff/lcthw-remnants-2/ex13.c +++ /dev/null @@ -1,55 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - if(argc != 2) { - printf("ERROR: You need one argument.\n"); - // this is how you abort a program - return 1; - } - - int i = 0; - for(i = 0; argv[1][i] != '\0'; i++) { - char letter = argv[1][i]; - - switch(letter) { - case 'a': - case 'A': - printf("%d: 'A'\n", i); - break; - - case 'e': - case 'E': - printf("%d: 'E'\n", i); - break; - - case 'i': - case 'I': - printf("%d: 'I'\n", i); - break; - - case 'o': - case 'O': - printf("%d: 'O'\n", i); - break; - - case 'u': - case 'U': - printf("%d: 'U'\n", i); - break; - - case 'y': - case 'Y': - if(i > 2) { - // it's only sometimes y - printf("%d: 'Y'\n", i); - } - break; - - default: - printf("%d: %c is not a vowel\n", i, letter); - } - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex14.c b/oldstuff/lcthw-remnants-2/ex14.c deleted file mode 100644 index 9b4194a..0000000 --- a/oldstuff/lcthw-remnants-2/ex14.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -// forward declarations -int can_print_it(char ch); -void print_letters(char arg[]); - -void print_arguments(int argc, char *argv[]) -{ - int i = 0; - - for(i = 0; i < argc; i++) { - print_letters(argv[i]); - } -} - -void print_letters(char arg[]) -{ - int i = 0; - - for(i = 0; arg[i] != '\0'; i++) { - char ch = arg[i]; - - if(can_print_it(ch)) { - printf("'%c' == %d ", ch, ch); - } - } - - printf("\n"); -} - -int can_print_it(char ch) -{ - return isalpha(ch) || isblank(ch); -} - -int main(int argc, char *argv[]) -{ - print_arguments(argc, argv); - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex15.c b/oldstuff/lcthw-remnants-2/ex15.c deleted file mode 100644 index 39f7554..0000000 --- a/oldstuff/lcthw-remnants-2/ex15.c +++ /dev/null @@ -1,54 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - // create two arrays we care about - int ages[] = {23, 43, 12, 89, 2}; - char *names[] = { - "Alan", "Frank", - "Mary", "John", "Lisa" - }; - - // safely get the size of ages - int count = sizeof(ages) / sizeof(int); - int i = 0; - - // first way using indexing - for(i = 0; i < count; i++) { - printf("%s has %d years alive.\n", - names[i], ages[i]); - } - - printf("---\n"); - - // setup the pointers to the start of the arrays - int *cur_age = ages; - char **cur_name = names; - - // second way using pointers - for(i = 0; i < count; i++) { - printf("%s is %d years old.\n", - *(cur_name+i), *(cur_age+i)); - } - - printf("---\n"); - - // third way, pointers are just arrays - for(i = 0; i < count; i++) { - printf("%s is %d years old again.\n", - cur_name[i], cur_age[i]); - } - - printf("---\n"); - - // fourth way with pointers in a stupid complex way - for(cur_name = names, cur_age = ages; - (cur_age - ages) < count; - cur_name++, cur_age++) - { - printf("%s lived %d years so far.\n", - *cur_name, *cur_age); - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex16.c b/oldstuff/lcthw-remnants-2/ex16.c deleted file mode 100644 index 775c683..0000000 --- a/oldstuff/lcthw-remnants-2/ex16.c +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include - -struct Person { - char *name; - int age; - int height; - int weight; -}; - -struct Person *Person_create(char *name, int age, int height, int weight) -{ - struct Person *who = malloc(sizeof(struct Person)); - assert(who != NULL); - - who->name = strdup(name); - who->age = age; - who->height = height; - who->weight = weight; - - return who; -} - -void Person_destroy(struct Person *who) -{ - assert(who != NULL); - - free(who->name); - free(who); -} - -void Person_print(struct Person *who) -{ - printf("Name: %s\n", who->name); - printf("\tAge: %d\n", who->age); - printf("\tHeight: %d\n", who->height); - printf("\tWeight: %d\n", who->weight); -} - -int main(int argc, char *argv[]) -{ - // make two people structures - struct Person *joe = Person_create( - "Joe Alex", 32, 64, 140); - - struct Person *frank = Person_create( - "Frank Blank", 20, 72, 180); - - // print them out and where they are in memory - printf("Joe is at memory location %p:\n", joe); - Person_print(joe); - - printf("Frank is at memory location %p:\n", frank); - Person_print(frank); - - // make everyone age 20 years and print them again - joe->age += 20; - joe->height -= 2; - joe->weight += 40; - Person_print(joe); - - frank->age += 20; - frank->weight += 20; - Person_print(frank); - - // destroy them both so we clean up - Person_destroy(joe); - Person_destroy(frank); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex17-ec.c b/oldstuff/lcthw-remnants-2/ex17-ec.c deleted file mode 100644 index c11d8ee..0000000 --- a/oldstuff/lcthw-remnants-2/ex17-ec.c +++ /dev/null @@ -1,234 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#define MAX_DATA 512 -#define MAX_ROWS 100 - -struct Address { - int id; - int set; - char name[MAX_DATA]; - char email[MAX_DATA]; - char street[MAX_DATA]; -}; - -struct Database { - struct Address rows[MAX_ROWS]; -}; - -struct Connection { - FILE *file; - struct Database *db; -}; - -void Database_close(struct Connection *conn); - -void die(const char *message, struct Connection *conn) -{ - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - Database_close(conn); - - exit(1); -} - -void Address_print(struct Address *addr) -{ - printf("%d %s %s \"%s\"\n", - addr->id, addr->name, addr->email, addr->street); -} - -void Database_load(struct Connection *conn) -{ - int rc = fread(conn->db, sizeof(struct Database), 1, conn->file); - if(rc != 1) die("Failed to load database.", conn); -} - -struct Connection *Database_open(const char *filename, char mode) -{ - struct Connection *conn = malloc(sizeof(struct Connection)); - if(!conn) die("Memory error", conn); - - conn->db = malloc(sizeof(struct Database)); - if(!conn->db) die("Memory error", conn); - - if(mode == 'c') { - conn->file = fopen(filename, "w"); - } else { - conn->file = fopen(filename, "r+"); - - if(conn->file) { - Database_load(conn); - } - } - - if(!conn->file) die("Failed to open the file", conn); - - return conn; -} - -void Database_close(struct Connection *conn) -{ - if(conn) { - if(conn->file) fclose(conn->file); - if(conn->db) free(conn->db); - free(conn); - } -} - -void Database_write(struct Connection *conn) -{ - rewind(conn->file); - - int rc = fwrite(conn->db, sizeof(struct Database), 1, conn->file); - if(rc != 1) die("Failed to write database.", conn); - - rc = fflush(conn->file); - if(rc == -1) die("Connot flush database.", conn); -} - -void Database_create(struct Connection *conn) -{ - int i = 0; - - for(i = 0; i < MAX_ROWS; i++) { - // make a prototype to initialize it - struct Address addr = {.id = i, .set = 0}; - // then just assign it - conn->db->rows[i] = addr; - } -} - -void Database_set(struct Connection *conn, int id, const char *name, - const char *email, const char *street) -{ - struct Address *addr = &conn->db->rows[id]; - if(addr->set) die("Already set, delete it first", conn); - - addr->set = 1; - // WARNING: bug, read the "How To Break It" and fix this - char *res = strncpy(addr->name, name, MAX_DATA); - // demonstrate the strncpy bug - if(!res) die("Name copy failed", conn); - - res = strncpy(addr->email, email, MAX_DATA); - if(!res) die("Email copy failed", conn); - - res = strncpy(addr->street, street, MAX_DATA); - if(!res) die("Street copy failed", conn); -} - -void Database_get(struct Connection *conn, int id) -{ - struct Address *addr = &conn->db->rows[id]; - - if(addr->set) { - Address_print(addr); - } else { - die("ID is not set", conn); - } -} - -void Database_delete(struct Connection *conn, int id) -{ - struct Address addr = {.id = id, .set = 0}; - conn->db->rows[id] = addr; -} - -void Database_list(struct Connection *conn) -{ - int i = 0; - struct Database *db = conn->db; - - for(i = 0; i < MAX_ROWS; i++) { - struct Address *cur = &db->rows[i]; - - if(cur->set) { - Address_print(cur); - } - } -} - -void Database_find(struct Connection *conn, char *search) -{ - int i = 0; - struct Database *db = conn->db; - - for(i = 0; i < MAX_ROWS; i++) { - struct Address *cur = &db->rows[i]; - - if(cur->set) { - if(strstr(cur->email, search) != NULL || - strstr(cur->name, search) != NULL || - strstr(cur->street, search) != NULL) { - Address_print(cur); - } - } - } -} - -int main(int argc, char *argv[]) -{ - char usage[64]; - sprintf(usage, "USAGE: %s [action params]", basename(argv[0])); - - if(argc < 3) die(usage, NULL); - - char *filename = argv[1]; - char action = argv[2][0]; - struct Connection *conn = Database_open(filename, action); - int id = 0; - - if(argc > 3) id = atoi(argv[3]); - if(id >= MAX_ROWS) die("There's not that many records.", conn); - - switch(action) { - case 'c': - Database_create(conn); - Database_write(conn); - break; - - case 'g': - if(argc != 4) die("Need an id to get", conn); - - Database_get(conn, id); - break; - - case 's': - if(argc != 7) die("Need id, name, email, and street to set", conn); - - Database_set(conn, id, argv[4], argv[5], argv[6]); - Database_write(conn); - break; - - case 'd': - if(argc != 4) die("Need id to delete", conn); - - Database_delete(conn, id); - Database_write(conn); - break; - - case 'f': - if(argc != 4) die("Need something to find", conn); - Database_find(conn, argv[3]); - break; - - case 'l': - Database_list(conn); - break; - default: - die("Invalid action, only: c=create, g=get, s=set, d=del, l=list, f=find", conn); - } - - Database_close(conn); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex17-ec2.c b/oldstuff/lcthw-remnants-2/ex17-ec2.c deleted file mode 100644 index 58a7f02..0000000 --- a/oldstuff/lcthw-remnants-2/ex17-ec2.c +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include - -#define MAX_STACK 1024 -#define STACK_SENTINEL -1 - -struct Stack { - int l[MAX_STACK]; -}; - -struct Stack *Stack_create() -{ - struct Stack *s = malloc(sizeof(struct Stack)); - if(!s) { return NULL; } - - int i = 0; - - for(i = 0; i < MAX_STACK; i++) { - s->l[i] = STACK_SENTINEL; - } - - return s; -} - -int Stack_push(struct Stack *s, int v) -{ - if(v <= STACK_SENTINEL) { - return STACK_SENTINEL; - } - - int i = 0; - for(i = 0; i < MAX_STACK; i++) { - if(s->l[i] == STACK_SENTINEL) { - s->l[i] = v; - return i; - } - } - - return STACK_SENTINEL; -} - -int Stack_pop(struct Stack *s) -{ - int i = 0; - int v = 0; - for(i = 0; i < MAX_STACK; i++) { - if(s->l[i] == STACK_SENTINEL) { - v = s->l[i-1]; - s->l[i-1] = STACK_SENTINEL; - return v; - } - } - - return STACK_SENTINEL; -} - -int Stack_size(struct Stack *s) -{ - int i = 0; - for(i = 0; i < MAX_STACK; i++) { - if(s->l[i] == STACK_SENTINEL) { - return i; - } - } - - return STACK_SENTINEL; -} - -int main(int argc, char *argv[]) -{ - struct Stack *s = Stack_create(); - - printf("size: %d\n", Stack_size(s)); - Stack_push(s, 10); - Stack_push(s, 20); - Stack_push(s, 40); - - printf("size: %d\n", Stack_size(s)); - printf("pop: %d\n", Stack_pop(s)); - printf("pop: %d\n", Stack_pop(s)); - printf("size: %d\n", Stack_size(s)); - printf("pop: %d\n", Stack_pop(s)); - printf("pop: %d\n", Stack_pop(s)); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex17.c b/oldstuff/lcthw-remnants-2/ex17.c deleted file mode 100644 index 4ca9667..0000000 --- a/oldstuff/lcthw-remnants-2/ex17.c +++ /dev/null @@ -1,198 +0,0 @@ -#include -#include -#include -#include -#include - -#define MAX_DATA 512 -#define MAX_ROWS 100 - -struct Address { - int id; - int set; - char name[MAX_DATA]; - char email[MAX_DATA]; -}; - -struct Database { - struct Address rows[MAX_ROWS]; -}; - -struct Connection { - FILE *file; - struct Database *db; -}; - -void die(const char *message) -{ - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -void Address_print(struct Address *addr) -{ - printf("%d %s %s\n", - addr->id, addr->name, addr->email); -} - -void Database_load(struct Connection *conn) -{ - int rc = fread(conn->db, sizeof(struct Database), 1, conn->file); - if(rc != 1) die("Failed to load database."); -} - -struct Connection *Database_open(const char *filename, char mode) -{ - struct Connection *conn = malloc(sizeof(struct Connection)); - if(!conn) die("Memory error"); - - conn->db = malloc(sizeof(struct Database)); - if(!conn->db) die("Memory error"); - - if(mode == 'c') { - conn->file = fopen(filename, "w"); - } else { - conn->file = fopen(filename, "r+"); - - if(conn->file) { - Database_load(conn); - } - } - - if(!conn->file) die("Failed to open the file"); - - return conn; -} - -void Database_close(struct Connection *conn) -{ - if(conn) { - if(conn->file) fclose(conn->file); - if(conn->db) free(conn->db); - free(conn); - } -} - -void Database_write(struct Connection *conn) -{ - rewind(conn->file); - - int rc = fwrite(conn->db, sizeof(struct Database), 1, conn->file); - if(rc != 1) die("Failed to write database."); - - rc = fflush(conn->file); - if(rc == -1) die("Connot flush database."); -} - -void Database_create(struct Connection *conn) -{ - int i = 0; - - for(i = 0; i < MAX_ROWS; i++) { - // make a prototype to initialize it - struct Address addr = {.id = i, .set = 0}; - // then just assign it - conn->db->rows[i] = addr; - } -} - -void Database_set(struct Connection *conn, int id, const char *name, const char *email) -{ - struct Address *addr = &conn->db->rows[id]; - if(addr->set) die("Already set, delete it first"); - - addr->set = 1; - // WARNING: bug, read the "How To Break It" and fix this - char *res = strncpy(addr->name, name, MAX_DATA); - // demonstrate the strncpy bug - if(!res) die("Name copy failed"); - - res = strncpy(addr->email, email, MAX_DATA); - if(!res) die("Email copy failed"); -} - -void Database_get(struct Connection *conn, int id) -{ - struct Address *addr = &conn->db->rows[id]; - - if(addr->set) { - Address_print(addr); - } else { - die("ID is not set"); - } -} - -void Database_delete(struct Connection *conn, int id) -{ - struct Address addr = {.id = id, .set = 0}; - conn->db->rows[id] = addr; -} - -void Database_list(struct Connection *conn) -{ - int i = 0; - struct Database *db = conn->db; - - for(i = 0; i < MAX_ROWS; i++) { - struct Address *cur = &db->rows[i]; - - if(cur->set) { - Address_print(cur); - } - } -} - -int main(int argc, char *argv[]) -{ - if(argc < 3) die("USAGE: ex17 [action params]"); - - char *filename = argv[1]; - char action = argv[2][0]; - struct Connection *conn = Database_open(filename, action); - int id = 0; - - if(argc > 3) id = atoi(argv[3]); - if(id >= MAX_ROWS) die("There's not that many records."); - - switch(action) { - case 'c': - Database_create(conn); - Database_write(conn); - break; - - case 'g': - if(argc != 4) die("Need an id to get"); - - Database_get(conn, id); - break; - - case 's': - if(argc != 6) die("Need id, name, email to set"); - - Database_set(conn, id, argv[4], argv[5]); - Database_write(conn); - break; - - case 'd': - if(argc != 4) die("Need id to delete"); - - Database_delete(conn, id); - Database_write(conn); - break; - - case 'l': - Database_list(conn); - break; - default: - die("Invalid action, only: c=create, g=get, s=set, d=del, l=list"); - } - - Database_close(conn); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex18-ec.c b/oldstuff/lcthw-remnants-2/ex18-ec.c deleted file mode 100644 index 75e8f6f..0000000 --- a/oldstuff/lcthw-remnants-2/ex18-ec.c +++ /dev/null @@ -1,119 +0,0 @@ -#include -#include -#include -#include - -/** Our old friend die from ex17. */ -void die(const char *message) -{ - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -// a typedef creates a fake type, in this -// case for a function pointer -typedef int (*compare_cb)(int a, int b); - -/** - * A classic bubble sort function that uses the - * compare_cb to do the sorting. - */ -int *bubble_sort(int *numbers, int count, compare_cb cmp) -{ - int temp = 0; - int i = 0; - int j = 0; - int *target = malloc(count * sizeof(int)); - - if(!target) die("Memory error."); - - memcpy(target, numbers, count * sizeof(int)); - - for(i = 0; i < count; i++) { - for(j = 0; j < count - 1; j++) { - if(cmp(target[j], target[j+1]) > 0) { - temp = target[j+1]; - target[j+1] = target[j]; - target[j] = temp; - } - } - } - - return target; -} - -int sorted_order(int a, int b) -{ - return a - b; -} - -int reverse_order(int a, int b) -{ - return b - a; -} - -int strange_order(int a, int b) -{ - if(a == 0 || b == 0) { - return 0; - } else { - return a % b; - } -} - -/** - * Used to test that we are sorting things correctly - * by doing the sort and printing it out. - */ -void test_sorting(int *numbers, int count, compare_cb cmp) -{ - int i = 0; - int *sorted = bubble_sort(numbers, count, cmp); - - if(!sorted) die("Failed to sort as requested."); - - for(i = 0; i < count; i++) { - printf("%d ", sorted[i]); - } - printf("\n"); - - free(sorted); - - unsigned char *data = (unsigned char *)cmp; - - for(i = 0; i < 25; i++) { - printf("%02x:", data[i]); - } - - printf("\n"); -} - -int main(int argc, char *argv[]) -{ - if(argc < 2) die("USAGE: ex18 4 3 1 5 6"); - - int count = argc - 1; - int i = 0; - char **inputs = argv + 1; - - int *numbers = malloc(count * sizeof(int)); - if(!numbers) die("Memory error."); - - for(i = 0; i < count; i++) { - numbers[i] = atoi(inputs[i]); - } - - test_sorting(numbers, count, sorted_order); - test_sorting(numbers, count, reverse_order); - test_sorting(numbers, count, strange_order); - - free(numbers); - - return 0; -} - diff --git a/oldstuff/lcthw-remnants-2/ex18.c b/oldstuff/lcthw-remnants-2/ex18.c deleted file mode 100644 index 4de105a..0000000 --- a/oldstuff/lcthw-remnants-2/ex18.c +++ /dev/null @@ -1,111 +0,0 @@ -#include -#include -#include -#include - -/** Our old friend die from ex17. */ -void die(const char *message) -{ - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -// a typedef creates a fake type, in this -// case for a function pointer -typedef int (*compare_cb)(int a, int b); - -/** - * A classic bubble sort function that uses the - * compare_cb to do the sorting. - */ -int *bubble_sort(int *numbers, int count, compare_cb cmp) -{ - int temp = 0; - int i = 0; - int j = 0; - int *target = malloc(count * sizeof(int)); - - if(!target) die("Memory error."); - - memcpy(target, numbers, count * sizeof(int)); - - for(i = 0; i < count; i++) { - for(j = 0; j < count - 1; j++) { - if(cmp(target[j], target[j+1]) > 0) { - temp = target[j+1]; - target[j+1] = target[j]; - target[j] = temp; - } - } - } - - return target; -} - -int sorted_order(int a, int b) -{ - return a - b; -} - -int reverse_order(int a, int b) -{ - return b - a; -} - -int strange_order(int a, int b) -{ - if(a == 0 || b == 0) { - return 0; - } else { - return a % b; - } -} - -/** - * Used to test that we are sorting things correctly - * by doing the sort and printing it out. - */ -void test_sorting(int *numbers, int count, compare_cb cmp) -{ - int i = 0; - int *sorted = bubble_sort(numbers, count, cmp); - - if(!sorted) die("Failed to sort as requested."); - - for(i = 0; i < count; i++) { - printf("%d ", sorted[i]); - } - printf("\n"); - - free(sorted); -} - -int main(int argc, char *argv[]) -{ - if(argc < 2) die("USAGE: ex18 4 3 1 5 6"); - - int count = argc - 1; - int i = 0; - char **inputs = argv + 1; - - int *numbers = malloc(count * sizeof(int)); - if(!numbers) die("Memory error."); - - for(i = 0; i < count; i++) { - numbers[i] = atoi(inputs[i]); - } - - test_sorting(numbers, count, sorted_order); - test_sorting(numbers, count, reverse_order); - test_sorting(numbers, count, strange_order); - - free(numbers); - - return 0; -} - diff --git a/oldstuff/lcthw-remnants-2/ex19.c b/oldstuff/lcthw-remnants-2/ex19.c deleted file mode 100644 index 814d734..0000000 --- a/oldstuff/lcthw-remnants-2/ex19.c +++ /dev/null @@ -1,225 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "ex19.h" - - -int Monster_attack(void *self, int damage) -{ - assert(self != NULL); - Monster *monster = self; - - printf("You attack %s!\n", monster->_(description)); - - monster->hit_points -= damage; - - if(monster->hit_points > 0) { - printf("It is still alive.\n"); - return 0; - } else { - printf("It is dead!\n"); - return 1; - } -} - -int Monster_init(void *self) -{ - assert(self != NULL); - Monster *monster = self; - monster->hit_points = 10; - return 1; -} - -Object MonsterProto = { - .init = Monster_init, - .attack = Monster_attack -}; - - -void *Room_move(void *self, Direction direction) -{ - assert(self != NULL); - Room *room = self; - Room *next = NULL; - - if(direction == NORTH && room->north) { - printf("You go north, into:\n"); - next = room->north; - } else if(direction == SOUTH && room->south) { - printf("You go south, into:\n"); - next = room->south; - } else if(direction == EAST && room->east) { - printf("You go east, into:\n"); - next = room->east; - } else if(direction == WEST && room->west) { - printf("You go west, into:\n"); - next = room->west; - } else { - printf("You can't go that direction."); - next = NULL; - } - - if(next) { - next->_(describe)(next); - } - - return next; -} - - -int Room_attack(void *self, int damage) -{ - assert(self != NULL); - Room *room = self; - Monster *monster = room->bad_guy; - - if(monster) { - monster->_(attack)(monster, damage); - return 1; - } else { - printf("You flail in the air at nothing. Idiot.\n"); - return 0; - } -} - - -Object RoomProto = { - .move = Room_move, - .attack = Room_attack -}; - - -void *Map_move(void *self, Direction direction) -{ - assert(self != NULL); - Map *map = self; - Room *location = map->location; - Room *next = NULL; - - next = location->_(move)(location, direction); - - if(next) { - map->location = next; - } - - return next; -} - -int Map_attack(void *self, int damage) -{ - assert(self != NULL); - Map *map = self; - Room *location = map->location; - - return location->_(attack)(location, damage); -} - - -int Map_init(void *self) -{ - assert(self != NULL); - Map *map = self; - - // make some rooms for a small map - Room *hall = NEW(Room, "The great Hall"); - Room *throne = NEW(Room, "The throne room"); - Room *arena = NEW(Room, "The arena, with the minotaur"); - Room *kitchen = NEW(Room, "Kitchen, you have the knife now"); - - // put the bad guy in the arena - arena->bad_guy = NEW(Monster, "The evil minotaur"); - - // setup the map rooms - hall->north = throne; - - throne->west = arena; - throne->east = kitchen; - throne->south = hall; - - arena->east = throne; - kitchen->west = throne; - - // start the map and the characters off in the hall - map->start = hall; - map->location = hall; - - return 1; -} - -Object MapProto = { - .init = Map_init, - .move = Map_move, - .attack = Map_attack -}; - -int process_input(Map *game) -{ - assert(game != NULL); - printf("\n> "); - - char ch = getchar(); - getchar(); // eat ENTER - - int damage = rand() % 4; - - switch(ch) { - case -1: - printf("Giving up? You suck.\n"); - return 0; - break; - - case 'n': - game->_(move)(game, NORTH); - break; - - case 's': - game->_(move)(game, SOUTH); - break; - - case 'e': - game->_(move)(game, EAST); - break; - - case 'w': - game->_(move)(game, WEST); - break; - - case 'a': - game->_(attack)(game, damage); - break; - - case 'l': - printf("You can go:\n"); - if(game->location->north) printf("NORTH\n"); - if(game->location->south) printf("SOUTH\n"); - if(game->location->east) printf("EAST\n"); - if(game->location->west) printf("WEST\n"); - break; - - default: - printf("What?: %d\n", ch); - } - - return 1; -} - -int main(int argc, char *argv[]) -{ - // simple way to setup the randomness - srand(time(NULL)); - - // make our map to work with - Map *game = NEW(Map, "The Hall of the Minotaur."); - assert(game != NULL); - - printf("You enter the "); - game->location->_(describe)(game->location); - - while(process_input(game)) { - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex20.c b/oldstuff/lcthw-remnants-2/ex20.c deleted file mode 100644 index 853da90..0000000 --- a/oldstuff/lcthw-remnants-2/ex20.c +++ /dev/null @@ -1,118 +0,0 @@ -#include "dbg.h" -#include -#include - - -void test_debug() -{ - // notice you don't need the \n - debug("I have Brown Hair."); - - // passing in arguments like printf - debug("I am %d years old.", 37); -} - -void test_log_err() -{ - log_err("I believe everything is broken."); - log_err("There are %d problems in %s.", 0, "space"); -} - -void test_log_warn() -{ - log_warn("You can safely ignore this."); - log_warn("Maybe consider looking at: %s.", "/etc/passwd"); -} - -void test_log_info() -{ - log_info("Well I did something mundane."); - log_info("It happened %f times today.", 1.3f); -} - -int test_check(char *file_name) -{ - FILE *input = NULL; - char *block = NULL; - - block = malloc(100); - check_mem(block); // should work - - input = fopen(file_name, "r"); - check(input, "Failed to open %s.", file_name); - - free(block); - fclose(input); - return 0; - -error: - if(block) free(block); - if(input) fclose(input); - return -1; -} - -int test_sentinel(int code) -{ - char *temp = malloc(100); - check_mem(temp); - - switch(code) { - case 1: - log_info("It worked."); - break; - default: - sentinel("I shouldn't run."); - } - - free(temp); - return 0; - -error: - if(temp) free(temp); - return -1; -} - -int test_check_mem() -{ - char *test = NULL; - check_mem(test); - - free(test); - return 1; - -error: - return -1; -} - -int test_check_debug() -{ - int i = 0; - check_debug(i != 0, "Oops, I was 0."); - - return 0; -error: - return -1; -} - -int main(int argc, char *argv[]) -{ - check(argc == 2, "Need an argument."); - - test_debug(); - test_log_err(); - test_log_warn(); - test_log_info(); - - check(test_check("ex20.c") == 0, "failed with ex20.c"); - check(test_check(argv[1]) == -1, "failed with argv"); - check(test_sentinel(1) == 0, "test_sentinel failed."); - check(test_sentinel(100) == -1, "test_sentinel failed."); - check(test_check_mem() == -1, "test_check_mem failed."); - check(test_check_debug() == -1, "test_check_debug failed."); - - return 0; - -error: - return 1; -} - diff --git a/oldstuff/lcthw-remnants-2/ex22.c b/oldstuff/lcthw-remnants-2/ex22.c deleted file mode 100644 index ec090a8..0000000 --- a/oldstuff/lcthw-remnants-2/ex22.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include "ex22.h" -#include "dbg.h" - -int THE_SIZE = 1000; - -static int THE_AGE = 37; - -int get_age() -{ - return THE_AGE; -} - -void set_age(int age) -{ - THE_AGE = age; -} - - -double update_ratio(double new_ratio) -{ - static double ratio = 1.0; - - double old_ratio = ratio; - ratio = new_ratio; - - return old_ratio; -} - -void print_size() -{ - log_info("I think size is: %d", THE_SIZE); -} diff --git a/oldstuff/lcthw-remnants-2/ex22_main.c b/oldstuff/lcthw-remnants-2/ex22_main.c deleted file mode 100644 index d9780a8..0000000 --- a/oldstuff/lcthw-remnants-2/ex22_main.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "ex22.h" -#include "dbg.h" - -const char *MY_NAME = "Zed A. Shaw"; - -void scope_demo(int count) -{ - log_info("count is: %d", count); - - if(count > 10) { - int count = 100; // BAD! BUGS! - - log_info("count in this scope is %d", count); - } - - log_info("count is at exit: %d", count); - - count = 3000; - - log_info("count after assign: %d", count); -} - -int main(int argc, char *argv[]) -{ - // test out THE_AGE accessors - log_info("My name: %s, age: %d", MY_NAME, get_age()); - - set_age(100); - - log_info("My age is now: %d", get_age()); - - // test out THE_SIZE extern - log_info("THE_SIZE is: %d", THE_SIZE); - print_size(); - - THE_SIZE = 9; - - log_info("THE_SIZE is now: %d", THE_SIZE); - print_size(); - - // test the ration function static - log_info("Ratio at first: %f", update_ratio(2.0)); - log_info("Ratio again: %f", update_ratio(10.0)); - log_info("Ratio once more: %f", update_ratio(300.0)); - - // test the scope demo - int count = 4; - scope_demo(count); - scope_demo(count * 20); - - log_info("count after calling scope_demo: %d", count); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex23.c b/oldstuff/lcthw-remnants-2/ex23.c deleted file mode 100644 index d0acc5d..0000000 --- a/oldstuff/lcthw-remnants-2/ex23.c +++ /dev/null @@ -1,109 +0,0 @@ -#include -#include -#include "dbg.h" - -int normal_copy(char *from, char *to, int count) -{ - int i = 0; - - for(i = 0; i < count; i++) { - to[i] = from[i]; - } - - return i; -} - -int duffs_device(char *from, char *to, int count) -{ - { - int n = (count + 7) / 8; - debug("n=%d, (count %% 8)=%d", n, count % 8); - - switch(count % 8) { - case 0: do { *to++ = *from++; - case 7: *to++ = *from++; - case 6: *to++ = *from++; - case 5: *to++ = *from++; - case 4: *to++ = *from++; - case 3: *to++ = *from++; - case 2: *to++ = *from++; - case 1: *to++ = *from++; - } while(--n > 0); - } - } - - return count; -} - -int zeds_device(char *from, char *to, int count) -{ - { - int n = (count + 7) / 8; - - switch(count % 8) { - case 0: -again: *to++ = *from++; - case 7: *to++ = *from++; - case 6: *to++ = *from++; - case 5: *to++ = *from++; - case 4: *to++ = *from++; - case 3: *to++ = *from++; - case 2: *to++ = *from++; - case 1: *to++ = *from++; - if(--n > 0) goto again; - } - } - - return count; -} - -int valid_copy(char *data, int count, char expects) -{ - int i = 0; - for(i = 0; i < count; i++) { - if(data[i] != expects) { - log_err("[%d] %c != %c", i, data[i], expects); - return 0; - } - } - - return 1; -} - -int main(int argc, char *argv[]) -{ - char from[1000] = {'a'}; - char to[1000] = {'c'}; - int rc = 0; - - // setup the from to have some stuff - memset(from, 'x', 1000); - // set it to a failure mode - memset(to, 'y', 1000); - check(valid_copy(to, 1000, 'y'), "Not initialized right."); - - // use normal copy to - rc = normal_copy(from, to, 1000); - check(rc == 1000, "Normal copy failed: %d", rc); - check(valid_copy(to, 1000, 'x'), "Normal copy failed."); - - // reset - memset(to, 'y', 1000); - - // duffs version - rc = duffs_device(from, to, 1000); - check(rc == 1000, "Duff's deice failed: %d", rc); - check(valid_copy(to, 1000, 'x'), "Duff's deice failed copy."); - - // reset - memset(to, 'y', 1000); - - // my version - rc = zeds_device(from, to, 1000); - check(rc == 1000, "Zed's device failed: %d", rc); - check(valid_copy(to, 1000, 'x'), "Zed's device failed copy."); - - return 0; -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants-2/ex24.c b/oldstuff/lcthw-remnants-2/ex24.c deleted file mode 100644 index e5da167..0000000 --- a/oldstuff/lcthw-remnants-2/ex24.c +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include "dbg.h" - -#define MAX_DATA 100 - -typedef enum EyeColor { - BLUE_EYES, GREEN_EYES, BROWN_EYES, - BLACK_EYES, OTHER_EYES -} EyeColor; - -const char *EYE_COLOR_NAMES[] = { - "Blue", "Green", "Brown", "Black", "Other" -}; - -typedef struct Person { - int age; - char first_name[MAX_DATA]; - char last_name[MAX_DATA]; - EyeColor eyes; - float income; -} Person; - -int main(int argc, char *argv[]) -{ - Person you = {.age = 0}; - int i = 0; - int rc = -1; - char *in = NULL; - - printf("What's your First Name? "); - in = fgets(you.first_name, MAX_DATA-1, stdin); - check(in != NULL, "Failed to read first name."); - - rc = sscanf(you.first_name, "%s", you.first_name); - check(rc > 0, "Failed to strip first name."); - - printf("What's your Last Name? "); - in = fgets(you.last_name, MAX_DATA-1, stdin); - check(in != NULL, "Failed to read last name."); - - rc = sscanf(you.last_name, "%s", you.last_name); - check(rc > 0, "Failed to strip last name."); - - printf("How old are you? "); - rc = fscanf(stdin, "%d", &you.age); - check(rc > 0, "You have to enter a number."); - - printf("What color are your eyes:\n"); - for(i = 0; i <= OTHER_EYES; i++) { - printf("%d) %s\n", i+1, EYE_COLOR_NAMES[i]); - } - printf("> "); - - int eyes = -1; - rc = fscanf(stdin, "%d", &eyes); - check(rc > 0, "You have to enter a number."); - - you.eyes = eyes - 1; - check(you.eyes <= OTHER_EYES && you.eyes >= 0, "Do it right, that's not an option."); - - printf("How much do you make an hour? "); - rc = fscanf(stdin, "%f", &you.income); - check(rc > 0, "Enter a floating point number."); - - printf("----- RESULTS -----\n"); - - printf("First Name: %s\n", you.first_name); - printf("Last Name: %s\n", you.last_name); - printf("Age: %d\n", you.age); - printf("Eyes: %s\n", EYE_COLOR_NAMES[you.eyes]); - printf("Income: %f\n", you.income); - - return 0; -error: - - return -1; -} diff --git a/oldstuff/lcthw-remnants-2/ex25.c b/oldstuff/lcthw-remnants-2/ex25.c deleted file mode 100644 index 8460726..0000000 --- a/oldstuff/lcthw-remnants-2/ex25.c +++ /dev/null @@ -1,134 +0,0 @@ -/** WARNING: This code is fresh and potentially isn't correct yet. */ - -#include -#include -#include -#include "dbg.h" - -#define MAX_DATA 100 - -int read_string(char **out_string, int max_buffer) -{ - *out_string = calloc(1, max_buffer + 1); - check_mem(*out_string); - - char *result = fgets(*out_string, max_buffer, stdin); - check(result != NULL, "Input error."); - - return 0; - -error: - if(*out_string) free(*out_string); - *out_string = NULL; - return -1; -} - -int read_int(int *out_int) -{ - char *input = NULL; - int rc = read_string(&input, MAX_DATA); - check(rc == 0, "Failed to read number."); - - *out_int = atoi(input); - - free(input); - return 0; - -error: - if(input) free(input); - return -1; -} - -int read_scan(const char *fmt, ...) -{ - int i = 0; - int rc = 0; - int *out_int = NULL; - char *out_char = NULL; - char **out_string = NULL; - int max_buffer = 0; - - va_list argp; - va_start(argp, fmt); - - for(i = 0; fmt[i] != '\0'; i++) { - if(fmt[i] == '%') { - i++; - switch(fmt[i]) { - case '\0': - sentinel("Invalid format, you ended with %%."); - break; - - case 'd': - out_int = va_arg(argp, int *); - rc = read_int(out_int); - check(rc == 0, "Failed to read int."); - break; - - case 'c': - out_char = va_arg(argp, char *); - *out_char = fgetc(stdin); - break; - - case 's': - max_buffer = va_arg(argp, int); - out_string = va_arg(argp, char **); - rc = read_string(out_string, max_buffer); - check(rc == 0, "Failed to read string."); - break; - - default: - sentinel("Invalid format."); - - } - } else { - fgetc(stdin); - } - - check(!feof(stdin) && !ferror(stdin), "Input error."); - } - - va_end(argp); - return 0; - -error: - va_end(argp); - return -1; -} - - - -int main(int argc, char *argv[]) -{ - char *first_name = NULL; - char initial = ' '; - char *last_name = NULL; - int age = 0; - - printf("What's your first name? "); - int rc = read_scan("%s", MAX_DATA, &first_name); - check(rc == 0, "Failed first name."); - - printf("What's your initial? "); - rc = read_scan("%c\n", &initial); - check(rc == 0, "Failed initial."); - - printf("What's your last name? "); - rc = read_scan("%s", MAX_DATA, &last_name); - check(rc == 0, "Failed last name."); - - printf("How old are you? "); - rc = read_scan("%d", &age); - - printf("---- RESULTS ----\n"); - printf("First Name: %s", first_name); - printf("Initial: '%c'\n", initial); - printf("Last Name: %s", last_name); - printf("Age: %d\n", age); - - free(first_name); - free(last_name); - return 0; -error: - return -1; -} diff --git a/oldstuff/lcthw-remnants-2/ex27.c b/oldstuff/lcthw-remnants-2/ex27.c deleted file mode 100644 index 8d93fe7..0000000 --- a/oldstuff/lcthw-remnants-2/ex27.c +++ /dev/null @@ -1,74 +0,0 @@ -#undef NDEBUG -#include "dbg.h" -#include -#include - -/* - * naive copy that assumes all inputs are always valid - * taken from K&R C and cleaned up a bit; - */ -void copy(char to[], char from[]) -{ - int i = 0; - - // while loop will not end if from isn't '\0' terminated - while((to[i] = from[i]) != '\0') { - ++i; - } -} - -/* - * A safer version that checks for many common errors using the - * length of each string to control the loops and termination. - */ -int safercopy(int from_len, char *from, int to_len, char *to) -{ - assert(from != NULL && to != NULL && "from and to can't be NULL"); - int i = 0; - int max = from_len > to_len - 1 ? to_len - 1 : from_len; - - // to_len must have at least 1 byte - if(from_len < 0 || to_len <= 0) return -1; - - for(i = 0; i < max; i++) { - to[i] = from[i]; - } - - to[to_len - 1] = '\0'; - - return i; -} - - -int main(int argc, char *argv[]) -{ - // careful to understand why we can get these sizes - char from[] = "0123456789"; - int from_len = sizeof(from); - - // notice that it's 7 chars + \0 - char to[] = "0123456"; - int to_len = sizeof(to); - - debug("Copying '%s':%d to '%s':%d", from, from_len, to, to_len); - - int rc = safercopy(from_len, from, to_len, to); - check(rc > 0, "Failed to safercopy."); - check(to[to_len - 1] == '\0', "String not terminated."); - - debug("Result is '%s':%d", to, to_len); - - // now try to break it - rc = safercopy(from_len * -1, from, to_len, to); - check(rc == -1, "safercopy should fail #1"); - check(to[to_len - 1] == '\0', "String not terminated."); - - rc = safercopy(from_len, from, 0, to); - check(rc == -1, "safercopy should fail #2"); - check(to[to_len - 1] == '\0', "String not terminated."); - - return 0; - -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants-2/ex29/.gitignore b/oldstuff/lcthw-remnants-2/ex29/.gitignore deleted file mode 100644 index 9b6cf51..0000000 --- a/oldstuff/lcthw-remnants-2/ex29/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tests/your_library_tests diff --git a/oldstuff/lcthw-remnants-2/ex29/LICENSE b/oldstuff/lcthw-remnants-2/ex29/LICENSE deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/lcthw-remnants-2/ex29/Makefile b/oldstuff/lcthw-remnants-2/ex29/Makefile deleted file mode 100644 index 6b432a5..0000000 --- a/oldstuff/lcthw-remnants-2/ex29/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -CFLAGS = -g -O2 -Wall -Wextra -Isrc -Lbuild -rdynamic -DNDEBUG $(OPTFLAGS) -LDLIBS = -ldl $(OPTLIBS) - -PREFIX ?= /usr/local - -SOURCES = $(wildcard src/**/*.c src/*.c) -OBJECTS = $(patsubst %.c,%.o,$(SOURCES)) - -TEST_SRC = $(wildcard tests/*_tests.c) -TESTS = $(patsubst %.c,%,$(TEST_SRC)) - -LIBNAME = ex29 -TARGET = build/lib$(LIBNAME).a -SO_TARGET = $(patsubst %.a,%.so,$(TARGET)) - -# The Target Build -all: $(TARGET) $(SO_TARGET) tests - -dev: CFLAGS = -g -Wall -Isrc -Wall -Wextra $(OPTFLAGS) -dev: all - -$(TARGET): CFLAGS += -fPIC -$(TARGET): build $(OBJECTS) - $(AR) rcs $@ $(OBJECTS) - ranlib $@ - -$(SO_TARGET): $(TARGET) $(OBJECTS) - $(CC) -shared -o $@ $(OBJECTS) - -build: - @mkdir -p build - @mkdir -p bin - -# The Unit Tests -.PHONY: tests -tests: LDLIBS += -l$(LIBNAME) -tests: $(TESTS) - sh ./tests/runtests.sh - -valgrind: - VALGRIND="valgrind --log-file=/tmp/valgrind-%p.log" $(MAKE) - -# The Cleaner -clean: - rm -rf build $(OBJECTS) $(TESTS) - rm -f tests/tests.log - find . -name "*.gc*" -exec rm {} \; - rm -rf `find . -name "*.dSYM" -print` - -# The Install -install: all - install -d $(DESTDIR)/$(PREFIX)/lib/ - install $(TARGET) $(DESTDIR)/$(PREFIX)/lib/ - -# The Checker -BADFUNCS='[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)' -check: - @echo Files with potentially dangerous functions - @egrep $(BADFUNCS) $(SOURCES) || true diff --git a/oldstuff/lcthw-remnants-2/ex29/README.md b/oldstuff/lcthw-remnants-2/ex29/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/lcthw-remnants-2/ex29/src/dbg.h b/oldstuff/lcthw-remnants-2/ex29/src/dbg.h deleted file mode 100644 index a7aaa6a..0000000 --- a/oldstuff/lcthw-remnants-2/ex29/src/dbg.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __dbg_h__ -#define __dbg_h__ - -#include -#include -#include - -#ifdef NDEBUG -#define debug(M, ...) -#else -#define debug(M, ...) fprintf(stderr, "DEBUG %s:%d:%s: " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) -#endif - -#define clean_errno() (errno == 0 ? "None" : strerror(errno)) - -#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d:%s) " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) - -#define check(A, M, ...) if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define sentinel(M, ...) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define check_mem(A) check((A), "Out of memory.") - -#define check_debug(A, M, ...) if(!(A)) { debug(M, ##__VA_ARGS__); errno=0; goto error; } - -#endif diff --git a/oldstuff/lcthw-remnants-2/ex29/src/ex29.c b/oldstuff/lcthw-remnants-2/ex29/src/ex29.c deleted file mode 100644 index 5a42d91..0000000 --- a/oldstuff/lcthw-remnants-2/ex29/src/ex29.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include "dbg.h" - - -int print_a_message(const char *msg) -{ - printf("A STRING: %s\n", msg); - - return 0; -} - - -int uppercase(const char *msg, int count) -{ - int i = 0; - - for(i = 0; i < count; i++) { - printf("%c", toupper(msg[i])); - } - - printf("\n"); - - return 0; -} - -int lowercase(const char *msg, int count) -{ - int i = 0; - - for(i = 0; i < count; i++) { - printf("%c", tolower(msg[i])); - } - - printf("\n"); - - return 0; -} - -int fail_on_purpose(const char *msg) -{ - return 1; -} diff --git a/oldstuff/lcthw-remnants-2/ex29/tests/ex29_tests.c b/oldstuff/lcthw-remnants-2/ex29/tests/ex29_tests.c deleted file mode 100644 index e62033b..0000000 --- a/oldstuff/lcthw-remnants-2/ex29/tests/ex29_tests.c +++ /dev/null @@ -1,65 +0,0 @@ -#include "minunit.h" -#include - -typedef int (*lib_function)(const char *data, int count); -char *lib_file = "build/libex29.so"; -void *lib = NULL; - -int check_function(const char *func_to_run, const char *data, int expected) -{ - lib_function func = dlsym(lib, func_to_run); - check(func != NULL, "Did not find %s function in the library %s: %s", func_to_run, lib_file, dlerror()); - - int rc = func(data, (int)strlen(data)); - check(rc == expected, "Function %s return %d for data: %s", func_to_run, rc, data); - - return 1; -error: - return 0; -} - -char *test_dlopen() -{ - lib = dlopen(lib_file, RTLD_NOW); - mu_assert(lib != NULL, "Failed to open the library to test."); - - return NULL; -} - -char *test_functions() -{ - mu_assert(check_function("print_a_message", "Hello", 0), "print_a_message failed."); - mu_assert(check_function("uppercase", "Hello", 0), "uppercase failed."); - mu_assert(check_function("lowercase", "Hello", 0), "lowercase failed."); - - return NULL; -} - -char *test_failures() -{ - mu_assert(check_function("fail_on_purpose", "Hello", 1), "fail_on_purpose should fail."); - - return NULL; -} - -char *test_dlclose() -{ - int rc = dlclose(lib); - mu_assert(rc == 0, "Failed to close lib."); - - return NULL; -} - -char *all_tests() -{ - mu_suite_start(); - - mu_run_test(test_dlopen); - mu_run_test(test_functions); - mu_run_test(test_failures); - mu_run_test(test_dlclose); - - return NULL; -} - -RUN_TESTS(all_tests); diff --git a/oldstuff/lcthw-remnants-2/ex29/tests/minunit.h b/oldstuff/lcthw-remnants-2/ex29/tests/minunit.h deleted file mode 100644 index 047ab81..0000000 --- a/oldstuff/lcthw-remnants-2/ex29/tests/minunit.h +++ /dev/null @@ -1,38 +0,0 @@ -#undef DNDEBUG -#ifndef _minunit_h -#define _minunit_h - -#include -#include -#include - -#define mu_suite_start() char *message = NULL - -#define mu_assert(test, message) if (!(test)) {\ - log_err(message); return message;\ - }\ - assertions_made++; -#define mu_run_test(test) debug("\n-----%s", " " #test); \ - message = test(); tests_run++; if (message) return message; - -#define RUN_TESTS(name) int main(int argc, char *argv[]) {\ - argc = argc; \ - argv = argv; \ - debug("----- RUNNING: %s", argv[0]);\ - printf("----\nRUNNING: %s\n", argv[0]);\ - char *result = name();\ - if (result != 0) {\ - printf("FAILED: %s\n", result);\ - }\ - else {\ - printf("ALL TESTS PASSED\n");\ - }\ - printf("Tests run: %d\n", tests_run);\ - printf("Assertions made: %d\n", assertions_made);\ - exit(result != 0);\ -} - -int tests_run; -int assertions_made; - -#endif diff --git a/oldstuff/lcthw-remnants-2/ex29/tests/runtests.sh b/oldstuff/lcthw-remnants-2/ex29/tests/runtests.sh deleted file mode 100644 index 2976086..0000000 --- a/oldstuff/lcthw-remnants-2/ex29/tests/runtests.sh +++ /dev/null @@ -1,19 +0,0 @@ -echo "Running unit tests:" - -for i in tests/*_tests -do - if test -f $i - then - if $VALGRIND ./$i 2>> tests/tests.log - then - echo $i PASS - else - echo "ERROR in test $i: here's tests/tests.log" - echo "------" - tail tests/tests.log - exit 1 - fi - fi -done - -echo "" diff --git a/oldstuff/lcthw-remnants-2/ex3.c b/oldstuff/lcthw-remnants-2/ex3.c deleted file mode 100644 index f5bec32..0000000 --- a/oldstuff/lcthw-remnants-2/ex3.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() -{ - int age = 10; - int height = 72; - - printf("I am %d years old.\n", age); - printf("I am %d inches tall.\n", height); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex31.c b/oldstuff/lcthw-remnants-2/ex31.c deleted file mode 100644 index 1b62ea5..0000000 --- a/oldstuff/lcthw-remnants-2/ex31.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int i = 0; - - while(i < 100) { - usleep(3000); - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex35.c b/oldstuff/lcthw-remnants-2/ex35.c deleted file mode 100644 index ae7f95b..0000000 --- a/oldstuff/lcthw-remnants-2/ex35.c +++ /dev/null @@ -1,57 +0,0 @@ -#include - -typedef enum { - TYPE_INT, - TYPE_FLOAT, - TYPE_STRING, -} VariantType; - -struct Variant { - VariantType type; - union { - int as_integer; - float as_float; - char *as_string; - } data; -}; - -typedef struct Variant Variant; - -void Variant_print(Variant *var) -{ - switch(var->type) { - case TYPE_INT: - printf("INT: %d\n", var->data.as_integer); - break; - case TYPE_FLOAT: - printf("FLOAT: %f\n", var->data.as_float); - break; - case TYPE_STRING: - printf("STRING: %s\n", var->data.as_string); - break; - default: - printf("UNKNOWN TYPE: %d", var->type); - } -} - -int main(int argc, char *argv[]) -{ - Variant a_int = {.type = TYPE_INT, .data.as_integer = 100}; - Variant a_float = {.type = TYPE_FLOAT, .data.as_float = 100.34}; - Variant a_string = {.type = TYPE_STRING, .data.as_string = "YO DUDE!"}; - - Variant_print(&a_int); - Variant_print(&a_float); - Variant_print(&a_string); - - // here's how you access them - a_int.data.as_integer = 200; - a_float.data.as_float = 2.345; - a_string.data.as_string = "Hi there."; - - Variant_print(&a_int); - Variant_print(&a_float); - Variant_print(&a_string); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex4.c b/oldstuff/lcthw-remnants-2/ex4.c deleted file mode 100644 index f5bec32..0000000 --- a/oldstuff/lcthw-remnants-2/ex4.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() -{ - int age = 10; - int height = 72; - - printf("I am %d years old.\n", age); - printf("I am %d inches tall.\n", height); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex5.c b/oldstuff/lcthw-remnants-2/ex5.c deleted file mode 100644 index 0d3c042..0000000 --- a/oldstuff/lcthw-remnants-2/ex5.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -/* This is a comment. */ -int main(int argc, char *argv[]) -{ - int distance = 100; - - // this is also a comment - printf("You are %d miles away.\n", distance); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex6.c b/oldstuff/lcthw-remnants-2/ex6.c deleted file mode 100644 index 63bb86f..0000000 --- a/oldstuff/lcthw-remnants-2/ex6.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int distance = 100; - float power = 2.345f; - double super_power = 56789.4532; - char initial = 'A'; - char first_name[] = "Zed"; - char last_name[] = "Shaw"; - - printf("You are %d miles away.\n", distance); - printf("You have %f levels of power.\n", power); - printf("You have %f awesome super powers.\n", super_power); - printf("I have na initial %c.\n", initial); - printf("I have a first name %s.\n", first_name); - printf("I have a last name %s.\n", last_name); - printf("My whole name is %s %c. %s.\n", - first_name, initial, last_name); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex7.c b/oldstuff/lcthw-remnants-2/ex7.c deleted file mode 100644 index 1d02d2b..0000000 --- a/oldstuff/lcthw-remnants-2/ex7.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int bugs = 100; - double bug_rate = 1.2; - - printf("You have %d bugs at the imaginary rate of %f.\n", - bugs, bug_rate); - - long universe_of_defects = 1L * 1024L * 1024L * 1024L; - printf("The entire universe has %ld bugs.\n", - universe_of_defects); - - double expected_bugs = bugs * bug_rate; - printf("You are expected to have %f bugs.\n", - expected_bugs); - - double part_of_universe = expected_bugs / universe_of_defects; - printf("That is only a %e portion of the universe.\n", - part_of_universe); - - // this makes no sense, just a demo of something weird - char nul_byte = '\0'; - int care_percentage = bugs * nul_byte; - printf("Which means you should care %d%%.\n", - care_percentage); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex8.c b/oldstuff/lcthw-remnants-2/ex8.c deleted file mode 100644 index 072beac..0000000 --- a/oldstuff/lcthw-remnants-2/ex8.c +++ /dev/null @@ -1,36 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int areas[] = {10, 12, 13, 14, 20}; - char name[] = "Zed"; - char full_name[] = { - 'Z', 'e', 'd', - ' ', 'A', '.', ' ', - 'S', 'h', 'a', 'w', '\0' - }; - - // WARNING: On some systems you may have to change the - // %ld in this code to a %u since it will use unsigned ints - printf("The size of an int: %ld\n", sizeof(int)); - printf("The size of areas (int[]): %ld\n", - sizeof(areas)); - printf("The first area is %d, the 2nd %d.\n", - areas[0], areas[1]); - - printf("The size of a char: %ld\n", sizeof(char)); - printf("The size of name (char[]): %ld\n", - sizeof(name)); - printf("The number of chars: %ld\n", - sizeof(name) / sizeof(char)); - - printf("The size of full_name (char[]): %ld\n", - sizeof(full_name)); - printf("The number of chars: %ld\n", - sizeof(full_name) / sizeof(char)); - - printf("name=\"%s\" and full_name=\"%s\"\n", - name, full_name); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex9-ec.c b/oldstuff/lcthw-remnants-2/ex9-ec.c deleted file mode 100644 index 7376ba7..0000000 --- a/oldstuff/lcthw-remnants-2/ex9-ec.c +++ /dev/null @@ -1,55 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int numbers[4] = {0}; - char name[4] = {'a'}; - - // first, print them out raw - printf("numbers: %d %d %d %d\n", - numbers[0], numbers[1], - numbers[2], numbers[3]); - - printf("name each: %c %c %c %c\n", - name[0], name[1], - name[2], name[3]); - - printf("name: %s\n", name); - - // setup the numbers - numbers[0] = 1; - numbers[1] = 2; - numbers[2] = 3; - numbers[3] = 4; - - // setup the name - name[0] = 'Z'; - name[1] = 'e'; - name[2] = 'd'; - name[3] = '\0'; - - // then print them out initialized - printf("numbers: %d %d %d %d\n", - numbers[0], numbers[1], - numbers[2], numbers[3]); - - printf("name each: %c %c %c %c\n", - name[0], name[1], - name[2], name[3]); - - // print the name like a string - printf("name: %s\n", name); - - // another way to use name; - char *another = "Zed"; - - printf("another: %s\n", another); - printf("another each: %c %c %c %c\n", - another[0], another[1], - another[2], another[3]); - - printf("name length: %ld\n", sizeof(name)); - printf("name as int: %d\n", (int)(*name)); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/ex9.c b/oldstuff/lcthw-remnants-2/ex9.c deleted file mode 100644 index f6b463c..0000000 --- a/oldstuff/lcthw-remnants-2/ex9.c +++ /dev/null @@ -1,52 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int numbers[4] = {0}; - char name[4] = {'a'}; - - // first, print them out raw - printf("numbers: %d %d %d %d\n", - numbers[0], numbers[1], - numbers[2], numbers[3]); - - printf("name each: %c %c %c %c\n", - name[0], name[1], - name[2], name[3]); - - printf("name: %s\n", name); - - // setup the numbers - numbers[0] = 1; - numbers[1] = 2; - numbers[2] = 3; - numbers[3] = 4; - - // setup the name - name[0] = 'Z'; - name[1] = 'e'; - name[2] = 'd'; - name[3] = '\0'; - - // then print them out initialized - printf("numbers: %d %d %d %d\n", - numbers[0], numbers[1], - numbers[2], numbers[3]); - - printf("name each: %c %c %c %c\n", - name[0], name[1], - name[2], name[3]); - - // print the name like a string - printf("name: %s\n", name); - - // another way to use name; - char *another = "Zed"; - - printf("another: %s\n", another); - printf("another each: %c %c %c %c\n", - another[0], another[1], - another[2], another[3]); - - return 0; -} diff --git a/oldstuff/lcthw-remnants-2/install-apr b/oldstuff/lcthw-remnants-2/install-apr deleted file mode 100755 index 7461d81..0000000 --- a/oldstuff/lcthw-remnants-2/install-apr +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# go somewhere safe -cd /tmp - -# get the source to base APR 1.4.6 -curl -L -O http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz - -# extract it and go into the source -tar -xzvf apr-1.4.6.tar.gz -cd apr-1.4.6 - -# configure, make, make install -./configure -make -sudo make install - -# reset and cleanup -cd /tmp -rm -rf apr-1.4.6 apr-1.4.6.tar.gz - -# do the same with apr-util -curl -L -O http://archive.apache.org/dist/apr/apr-util-1.4.1.tar.gz - -# extract -tar -xzvf apr-util-1.4.1.tar.gz -cd apr-util-1.4.1 - -# configure, make, make install -./configure --with-apr=/usr/local/apr -# you need that extra parameter to configure because -# apr-util can't really find it because...who knows. - -make -sudo make install - -#cleanup -cd /tmp -rm -rf apr-util-1.4.1* apr-1.4.6* diff --git a/oldstuff/lcthw-remnants-2/liblcthw/.gitignore b/oldstuff/lcthw-remnants-2/liblcthw/.gitignore deleted file mode 100644 index 4009d1f..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -tests/runtests -tests/*_tests -tests/**/*_tests -bstrlib.c -bstrlib.h diff --git a/oldstuff/lcthw-remnants-2/liblcthw/LICENSE b/oldstuff/lcthw-remnants-2/liblcthw/LICENSE deleted file mode 100644 index c5b39b0..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (C) 2016 Dan Buch - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/oldstuff/lcthw-remnants-2/liblcthw/Makefile b/oldstuff/lcthw-remnants-2/liblcthw/Makefile deleted file mode 100644 index f1d3c74..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -BSTRLIB_BASE_URL ?= https://raw.githubusercontent.com/websnarf/bstrlib/208b1f2a4dfc96b806ed499bd1909e87ec15981d -CFLAGS = -g -O2 -Wall -Wextra -Isrc -Lbuild -rdynamic -DNDEBUG $(OPTFLAGS) -LDLIBS = -ldl $(OPTLIBS) - -PREFIX ?= /usr/local - -FIND ?= find -CD ?= cd -PATCH ?= patch -INSTALL ?= install -MKDIR ?= mkdir -p -CURL ?= curl -sSL -RANLIB ?= ranlib -RUNTESTS ?= ./tests/runtests - -SOURCES = $(wildcard src/**/*.c src/*.c) -OBJECTS = $(patsubst %.c,%.o,$(SOURCES)) - -TEST_SRC = $(wildcard tests/**/*_tests.c tests/*_tests.c) -TESTS = $(patsubst %.c,%,$(TEST_SRC)) - -LIBNAME = lcthw -TARGET = build/lib$(LIBNAME).a -SO_TARGET = $(patsubst %.a,%.so,$(TARGET)) - -all: $(TARGET) $(SO_TARGET) tests - -dev: CFLAGS = -g -Wall -Isrc -Wall -Wextra $(OPTFLAGS) -dev: all - -$(TARGET): CFLAGS += -fPIC -$(TARGET): build $(OBJECTS) - $(AR) rcs $@ $(OBJECTS) - $(RANLIB) $@ - -$(SO_TARGET): $(TARGET) $(OBJECTS) - $(CC) -shared -o $@ $(OBJECTS) - -build: bin src/lcthw/bstrlib.c src/lcthw/bstrlib.h - @$(MKDIR) $@ - -bin: - @$(MKDIR) $@ - -src/lcthw/bstrlib.c: src/lcthw/bstrlib.h - $(CURL) -o $@ $(BSTRLIB_BASE_URL)/bstrlib.c - $(CD) src/lcthw && $(PATCH) -p1 < bstrlib.patch - -src/lcthw/bstrlib.h: - $(CURL) -o $@ $(BSTRLIB_BASE_URL)/bstrlib.h - -.PHONY: tests -tests: LDLIBS += -static -l$(LIBNAME) -lbsd -tests: $(RUNTESTS) $(TESTS) - $(RUNTESTS) ./tests/lcthw - -valgrind: - VALGRIND="valgrind --log-file=/tmp/valgrind-%p.log" $(MAKE) - -clean: - $(RM) -r build $(OBJECTS) $(TESTS) - $(RM) tests/tests.log tests/runtests - $(FIND) . -name "*.gc*" -exec rm {} \; - $(RM) -r `find . -name "*.dSYM" -print` - -distclean: clean - $(RM) src/lcthw/bstrlib.c src/lcthw/bstrlib.h - -install: all - $(INSTALL) -d $(DESTDIR)/$(PREFIX)/lib/ - $(INSTALL) $(TARGET) $(DESTDIR)/$(PREFIX)/lib/ - -BADFUNCS='[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)' -check: - @echo Files with potentially dangerous functions - @egrep $(BADFUNCS) $(SOURCES) || true diff --git a/oldstuff/lcthw-remnants-2/liblcthw/README.md b/oldstuff/lcthw-remnants-2/liblcthw/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/bstrlib.patch b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/bstrlib.patch deleted file mode 100644 index a63c153..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/bstrlib.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/bstrlib.c 2016-04-21 12:26:50.000000000 -0400 -+++ b/bstrlib.c 2016-04-21 12:27:59.000000000 -0400 -@@ -22,7 +22,8 @@ - #include - #include - #include --#include "bstrlib.h" -+// PATCH to include adjacent bstrlib.h -+#include - - /* Optionally include a mechanism for debugging memory */ - diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray.c b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray.c deleted file mode 100644 index 26998a3..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray.c +++ /dev/null @@ -1,116 +0,0 @@ -#include -#include - - -DArray *DArray_create(size_t element_size, size_t initial_max) -{ - DArray *array = malloc(sizeof(DArray)); - check_mem(array); - array->max = initial_max; - check(array->max > 0, "You must set an initial_max > 0."); - - array->contents = calloc(initial_max, sizeof(void *)); - check_mem(array->contents); - - array->end = 0; - array->element_size = element_size; - array->expand_rate = DEFAULT_EXPAND_RATE; - - return array; - -error: - if(array) free(array); - return NULL; -} - -void DArray_clear(DArray *array) -{ - int i = 0; - if(array->element_size > 0) { - for(i = 0; i < array->max; i++) { - if(array->contents[i] != NULL) { - free(array->contents[i]); - } - } - } -} - -static inline int DArray_resize(DArray *array, size_t newsize) -{ - array->max = newsize; - check(array->max > 0, "The newsize must be > 0."); - - void *contents = realloc(array->contents, array->max * sizeof(void *)); - - check_mem(contents); - - array->contents = contents; - - return 0; -error: - return -1; -} - -int DArray_expand(DArray *array) -{ - size_t old_max = array->max; - check(DArray_resize(array, array->max + array->expand_rate) == 0, - "Failed to expand array to new size: %d", - array->max + (int)array->expand_rate); - - memset(array->contents + old_max, 0, array->expand_rate + 1); - return 0; - -error: - return -1; -} - -int DArray_contract(DArray *array) -{ - int new_size = array->end < (int)array->expand_rate ? (int)array->expand_rate : array->end; - - return DArray_resize(array, new_size + 1); -} - - -void DArray_destroy(DArray *array) -{ - if(array) { - if(array->contents) free(array->contents); - free(array); - } -} - -void DArray_clear_destroy(DArray *array) -{ - DArray_clear(array); - DArray_destroy(array); -} - -int DArray_push(DArray *array, void *el) -{ - array->contents[array->end] = el; - array->end++; - - if(DArray_end(array) >= DArray_max(array)) { - return DArray_expand(array); - } else { - return 0; - } -} - -void *DArray_pop(DArray *array) -{ - check(array->end - 1 >= 0, "Attempt to pop from empty array."); - - void *el = DArray_remove(array, array->end - 1); - array->end--; - - if(DArray_end(array) > (int)array->expand_rate && DArray_end(array) % array->expand_rate) { - DArray_contract(array); - } - - return el; -error: - return NULL; -} diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray.h b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray.h deleted file mode 100644 index 60c7947..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef lcthw_DArray_h -#define lcthw_DArray_h -#include -#include -#include - -typedef struct DArray { - int end; - int max; - size_t element_size; - size_t expand_rate; - void **contents; -} DArray; - -DArray *DArray_create(size_t element_size, size_t initial_max); - -void DArray_destroy(DArray *array); - -void DArray_clear(DArray *array); - -int DArray_expand(DArray *array); - -int DArray_contract(DArray *array); - -int DArray_push(DArray *array, void *el); - -void *DArray_pop(DArray *array); - -void DArray_clear_destroy(DArray *array); - -#define DArray_last(A) ((A)->contents[(A)->end - 1]) -#define DArray_first(A) ((A)->contents[0]) -#define DArray_end(A) ((A)->end) -#define DArray_count(A) DArray_end(A) -#define DArray_max(A) ((A)->max) - -#define DEFAULT_EXPAND_RATE 300 - - -static inline void DArray_set(DArray *array, int i, void *el) -{ - check(i < array->max, "darray attempt to set past max"); - if(i > array->end) array->end = i; - array->contents[i] = el; -error: - return; -} - -static inline void *DArray_get(DArray *array, int i) -{ - check(i < array->max, "darray attempt to get past max"); - return array->contents[i]; -error: - return NULL; -} - -static inline void *DArray_remove(DArray *array, int i) -{ - void *el = array->contents[i]; - - array->contents[i] = NULL; - - return el; -} - -static inline void *DArray_new(DArray *array) -{ - check(array->element_size > 0, "Can't use DArray_new on 0 size darrays."); - - return calloc(1, array->element_size); - -error: - return NULL; -} - -#define DArray_free(E) free((E)) - -#endif diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray_algos.c b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray_algos.c deleted file mode 100644 index 99ab122..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray_algos.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include - -int DArray_qsort(DArray *array, DArray_compare cmp) -{ - qsort(array->contents, DArray_count(array), sizeof(void *), cmp); - return 0; -} - -int DArray_heapsort(DArray *array, DArray_compare cmp) -{ - return heapsort(array->contents, DArray_count(array), sizeof(void *), cmp); -} - -int DArray_mergesort(DArray *array, DArray_compare cmp) -{ - return mergesort(array->contents, DArray_count(array), sizeof(void *), cmp); -} diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray_algos.h b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray_algos.h deleted file mode 100644 index f9c0c10..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/darray_algos.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef lcthw_DArray_algos_h -#define lcthw_DArray_algos_h - -#include - -typedef int (*DArray_compare)(const void *a, const void *b); - -int DArray_qsort(DArray *array, DArray_compare cmp); - -int DArray_heapsort(DArray *array, DArray_compare cmp); - -int DArray_mergesort(DArray *array, DArray_compare cmp); - -#endif diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/dbg.h b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/dbg.h deleted file mode 100644 index a7aaa6a..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/dbg.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __dbg_h__ -#define __dbg_h__ - -#include -#include -#include - -#ifdef NDEBUG -#define debug(M, ...) -#else -#define debug(M, ...) fprintf(stderr, "DEBUG %s:%d:%s: " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) -#endif - -#define clean_errno() (errno == 0 ? "None" : strerror(errno)) - -#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d:%s: errno: %s) " M "\n", __FILE__, __LINE__, __func__, clean_errno(), ##__VA_ARGS__) - -#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d:%s) " M "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__) - -#define check(A, M, ...) if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define sentinel(M, ...) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define check_mem(A) check((A), "Out of memory.") - -#define check_debug(A, M, ...) if(!(A)) { debug(M, ##__VA_ARGS__); errno=0; goto error; } - -#endif diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list.c b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list.c deleted file mode 100644 index 571bf0f..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list.c +++ /dev/null @@ -1,244 +0,0 @@ -#include -#include - -List *List_create() -{ - return calloc(1, sizeof(List)); -} - -void List_destroy(List *list) -{ - List_validate(list); - - LIST_FOREACH(list, first, next, cur) { - if(cur->prev) { - free(cur->prev); - } - } - - free(list->last); - free(list); -} - - -void List_clear(List *list) -{ - List_validate(list); - - LIST_FOREACH(list, first, next, cur) { - free(cur->value); - } -} - - -void List_clear_destroy(List *list) -{ - List_validate(list); - - LIST_FOREACH(list, first, next, cur) { - free(cur->value); - if(cur->prev) { - free(cur->prev); - } - } - - free(list->last); - free(list); -} - - -void List_push(List *list, void *value) -{ - List_validate(list); - - ListNode *node = calloc(1, sizeof(ListNode)); - check_mem(node); - - node->value = value; - - if(list->last == NULL) { - list->first = node; - list->last = node; - } else { - list->last->next = node; - node->prev = list->last; - list->last = node; - } - - list->count++; - -error: - return; -} - -void *List_pop(List *list) -{ - List_validate(list); - - ListNode *node = list->last; - return node != NULL ? List_remove(list, node) : NULL; -} - -void List_unshift(List *list, void *value) -{ - List_validate(list); - - ListNode *node = calloc(1, sizeof(ListNode)); - check_mem(node); - - node->value = value; - - if(list->first == NULL) { - list->first = node; - list->last = node; - } else { - node->next = list->first; - list->first->prev = node; - list->first = node; - } - - list->count++; - -error: - return; -} - -void *List_shift(List *list) -{ - List_validate(list); - - ListNode *node = list->first; - return node != NULL ? List_remove(list, node) : NULL; -} - -void *List_remove(List *list, ListNode *node) -{ - List_validate(list); - - void *result = NULL; - - check(list->first && list->last, "List is empty."); - check(node, "node can't be NULL"); - - if(node == list->first && node == list->last) { - list->first = NULL; - list->last = NULL; - } else if(node == list->first) { - list->first = node->next; - check(list->first != NULL, "Invalid list, somehow got a first that is NULL."); - list->first->prev = NULL; - } else if(node == list->last) { - list->last = node->prev; - check(list->last != NULL, "Invalid list, somehow got a next that is NULL."); - list->last->next = NULL; - } else { - ListNode *after = node->next; - ListNode *before = node->prev; - after->prev = before; - before->next = after; - } - - list->count--; - result = node->value; - free(node); - -error: - return result; -} - - -List *List_copy(List *list) -{ - List_validate(list); - - List *out = List_create(); - LIST_FOREACH(list, first, next, cur) { - List_push(out, cur->value); - } - - return out; -} - - -int List_split(List *list, void *split, List *a, List *b) -{ - List_validate(list); - - check(list->first && list->last, "List is empty."); - check(split, "split can't be NULL"); - - if(split == list->last->value || (split == list->first->value && split == list->last->value)) { - (*a) = *List_copy(list); - return 0; - } else if(split == list->first->value) { - (*b) = *List_copy(list); - List_push(a, List_shift(b)); - return 0; - } else { - int past_split = 0; - LIST_FOREACH(list, first, next, cur) { - if(past_split) { - List_push(b, cur->value); - continue; - } - - if(cur->value == split) { - past_split = 1; - } - - List_push(a, cur->value); - } - } - - return 0; - -error: - return -1; -} - - -void List_join(List *list, List *b) -{ - List_validate(list); - List_validate(b); - - List *tail = List_copy(b); - - list->last->next = tail->first; - list->count += tail->count; - free(tail); - - return; -} - - -void List_swap(ListNode *a, ListNode *b) -{ - ListNode *tmp = a->next; - a->next = b->next; - b->next = tmp; - tmp = a->prev; - a->prev = b->prev; - b->prev = tmp; -} - - -void List_dump(List *list) -{ - List_validate(list); - - int i = 0; - int j = 0; - - LIST_FOREACH(list, first, next, cur) { - if(i > 0) { - for(j = 0; j < (i*4); j++) { - printf(" "); - } - printf("`"); - } - printf("-> [%d] ListNode .value = %p (%s)\n", i, cur->value, (char *)cur->value); - - i++; - } -} diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list.h b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list.h deleted file mode 100644 index 65b5b01..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef lcthw_List_h -#define lcthw_List_h - -#include -#include - -struct ListNode; - -typedef struct ListNode { - struct ListNode *next; - struct ListNode *prev; - void *value; -} ListNode; - -typedef struct List { - int count; - ListNode *first; - ListNode *last; -} List; - -List *List_create(); -void List_destroy(List *list); -void List_clear(List *list); -void List_clear_destroy(List *list); - -#define List_count(A) ((A)->count) -#define List_first(A) ((A)->first != NULL ? (A)->first->value : NULL) -#define List_last(A) ((A)->last != NULL ? (A)->last->value : NULL) - -void List_push(List *list, void *value); -void *List_pop(List *list); - -void List_unshift(List *list, void *value); -void *List_shift(List *list); - -void *List_remove(List *list, ListNode *node); - -List *List_copy(List *list); -int List_split(List *list, void *split, List *a, List *b); -void List_join(List *list, List *b); -void List_swap(ListNode *a, ListNode *b); -void List_dump(List *list); - -#define List_validate(A) (assert(A != NULL && List_count(A) > -1 &&\ - (List_count(A) > 0 && List_first(A) != NULL) && "invalid *List")) - -#define LIST_FOREACH(L, F, N, C) ListNode *_node = NULL;\ - ListNode *C = NULL;\ - for(C = _node = L->F; _node != NULL; C = _node = _node->N) - -#endif diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list_algos.c b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list_algos.c deleted file mode 100644 index c367b08..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list_algos.c +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include - -int List_bubble_sort(List *list, List_compare cmp) -{ - List_validate(list); - - if(List_count(list) <= 1) { - return 0; - } - - int swapped = 1; - - while(swapped == 1) { - swapped = 0; - - LIST_FOREACH(list, first, next, cur) { - if(cur->next == NULL) { - continue; - } - - if(cmp(cur->value, cur->next->value) > 0) { - List_swap(cur, cur->next); - swapped = 1; - } - } - } - - return 0; -} - -List *List_merge(List *left, List *right, List_compare cmp) -{ - List *result = List_create(); - - while(List_count(left) > 0 && List_count(right) > 0) { - if(cmp(List_first(left), List_first(right)) <= 0) { - List_push(result, List_shift(left)); - continue; - } - - List_push(result, List_shift(right)); - } - - while(List_count(left) > 0) { - List_push(result, List_shift(left)); - } - - while(List_count(right) > 0) { - List_push(result, List_shift(right)); - } - - return result; -} - -List *List_merge_sort(List *list, List_compare cmp) -{ - if(List_count(list) <= 1) { - return list;; - } - - int i = 0; - List *left = List_create(); - List *right = List_create(); - - LIST_FOREACH(list, first, next, cur) { - if(i % 2 == 0) { - List_push(right, cur->value); - } else { - List_push(left, cur->value); - } - i++; - } - - List *sort_left = List_merge_sort(left, cmp); - List *sort_right = List_merge_sort(right, cmp); - - if(sort_left != left) { - List_destroy(left); - } - - if(sort_right != right) { - List_destroy(right); - } - - return List_merge(sort_left, sort_right, cmp); -} diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list_algos.h b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list_algos.h deleted file mode 100644 index 0784336..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/list_algos.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef lcthw_List_algos_h -#define lcthw_List_algos_h - -#include - -typedef int (*List_compare)(const void *a, const void *b); - -int List_bubble_sort(List *list, List_compare cmp); - -List *List_merge_sort(List *list, List_compare cmp); - -#endif diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/radixmap.c b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/radixmap.c deleted file mode 100644 index 776e5bb..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/radixmap.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Based on code by Andre Reinald then heavily modified by Zed A. Shaw - */ - -#include -#include -#include -#include -#include -#include - -RadixMap *RadixMap_create(size_t max) -{ - RadixMap *map = calloc(sizeof(RadixMap), 1); - check_mem(map); - - map->contents = calloc(sizeof(RMElement), max + 1); - check_mem(map->contents); - - map->temp = calloc(sizeof(RMElement), max + 1); - check_mem(map->temp); - - map->max = max; - map->end = 0; - - return map; -error: - return NULL; -} - -void RadixMap_destroy(RadixMap *map) -{ - if(map) { - free(map->contents); - free(map->temp); - free(map); - } -} - - -#define ByteOf(x,y) (((uint8_t *)x)[y]) - -static inline void radix_sort(short offset, uint64_t max, uint64_t *source, uint64_t *dest) -{ - uint64_t count[256] = {0}; - uint64_t *cp = NULL; - uint64_t *sp = NULL; - uint64_t *end = NULL; - uint64_t s = 0; - uint64_t c = 0; - - // count occurences of every byte value - for(sp = source, end = source + max; sp < end; sp++) { - count[ByteOf(sp, offset)]++; - } - - // transform count into index by summing elements and storing into same array - for(s = 0, cp = count, end = count + 256; cp < end; cp++) { - c = *cp; - *cp = s; - s += c; - } - - // fill dest with the right values in the right place - for(sp = source, end = source + max; sp < end; sp++) { - cp = count + ByteOf(sp, offset); - dest[*cp] = *sp; - ++(*cp); - } -} - -void RadixMap_sort(RadixMap *map) -{ - uint64_t *source = &map->contents[0].raw; - uint64_t *temp = &map->temp[0].raw; - - radix_sort(0, map->end, source, temp); - radix_sort(1, map->end, temp, source); - radix_sort(2, map->end, source, temp); - radix_sort(3, map->end, temp, source); -} - -RMElement *RadixMap_find(RadixMap *map, uint32_t to_find) -{ - int low = 0; - int high = map->end - 1; - RMElement *data = map->contents; - - while(low <= high) { - int middle = low + (high - low)/2; - uint32_t key = data[middle].data.key; - - if(to_find < key) { - high = middle - 1; - } else if(to_find > key) { - low = middle + 1; - } else { - return &data[middle]; - } - } - - return NULL; -} - -int RadixMap_add(RadixMap *map, uint32_t key, uint32_t value) -{ - check(key < UINT32_MAX, "Key can't be equal to UINT32_MAX."); - - RMElement element = {.data = {.key = key, .value = value}}; - check(map->end + 1 < map->max, "RadixMap is full."); - - map->contents[map->end++] = element; - - RadixMap_sort(map); - - return 0; - -error: - return -1; -} - - -int RadixMap_delete(RadixMap *map, RMElement *el) -{ - check(map->end > 0, "There is nothing to delete."); - check(el != NULL, "Can't delete a NULL element."); - - el->data.key = UINT32_MAX; - - if(map->end > 1) { - // don't bother resorting a map of 1 length - RadixMap_sort(map); - } - - map->end--; - - return 0; -error: - return -1; -} diff --git a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/radixmap.h b/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/radixmap.h deleted file mode 100644 index 95ae52d..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/src/lcthw/radixmap.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef lcthw_radixmap_h -#define lcthw_radixmap_h - -#include - -typedef union RMElement { - uint64_t raw; - struct { - uint32_t key; - uint32_t value; - } data; -} RMElement; - -typedef struct RadixMap { - size_t max; - size_t end; - uint32_t counter; - RMElement *contents; - RMElement *temp; -} RadixMap; - - -RadixMap *RadixMap_create(size_t max); - -void RadixMap_destroy(RadixMap *map); - -void RadixMap_sort(RadixMap *map); - -RMElement *RadixMap_find(RadixMap *map, uint32_t key); - -int RadixMap_add(RadixMap *map, uint32_t key, uint32_t value); - -int RadixMap_delete(RadixMap *map, RMElement *el); - -#endif diff --git a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/bstrlib_tests.c b/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/bstrlib_tests.c deleted file mode 100644 index f8c8e8d..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/bstrlib_tests.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "../minunit.h" -#include - -char *test_bfromcstr() -{ - bstring b = bfromcstr("oh hai"); - mu_assert(b != NULL, "bstring is NULL."); - - return NULL; -} - -char *test_blk2bstr() -{ - bstring b = blk2bstr("hats", 5); - mu_assert(b != NULL, "bstring is NULL."); - - b = blk2bstr(NULL, 42); - mu_assert(b == NULL, "bstring is not NULL."); - - b = blk2bstr("bats", -17); - mu_assert(b == NULL, "bstring is not NULL."); - - return NULL; -} - -char *test_bstrcpy() -{ - bstring b = bfromcstr("mats"); - mu_assert(bstrcpy(b) != NULL, "bstring is NULL."); - - mu_assert(bstrcpy(NULL) == NULL, "bstring is not NULL."); - - int orig_len = b->slen; - b->slen = -1; - mu_assert(bstrcpy(b) == NULL, "bstring is not NULL."); - b->slen = orig_len; - - b->data = NULL; - mu_assert(bstrcpy(b) == NULL, "bstring is not NULL."); - - return NULL; -} - -char *all_tests() -{ - mu_suite_start(); - - mu_run_test(test_bfromcstr); - mu_run_test(test_blk2bstr); - mu_run_test(test_bstrcpy); - - return NULL; -} - -RUN_TESTS(all_tests); diff --git a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/darray_algos_tests.c b/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/darray_algos_tests.c deleted file mode 100644 index 5a00e86..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/darray_algos_tests.c +++ /dev/null @@ -1,78 +0,0 @@ -#include "../minunit.h" -#include - -int testcmp(char **a, char **b) -{ - return strcmp(*a, *b); -} - -DArray *create_words() -{ - DArray *result = DArray_create(0, 5); - char *words[] = {"asdfasfd", "werwar", "13234", "asdfasfd", "oioj"}; - int i = 0; - - for(i = 0; i < 5; i++) { - DArray_push(result, words[i]); - } - - return result; -} - -int is_sorted(DArray *array) -{ - int i = 0; - - for(i = 0; i < DArray_count(array) - 1; i++) { - if(strcmp(DArray_get(array, i), DArray_get(array, i+1)) > 0) { - return 0; - } - } - - return 1; -} - -char *run_sort_test(int (*func)(DArray *, DArray_compare), const char *name) -{ - DArray *words = create_words(); - mu_assert(!is_sorted(words), "Words should start not sorted."); - - name = name; - debug("--- Testing %s sorting algorithm", name); - int rc = func(words, (DArray_compare)testcmp); - mu_assert(rc == 0, "sort failed"); - mu_assert(is_sorted(words), "didn't sort it"); - - DArray_destroy(words); - - return NULL; -} - -char *test_qsort() -{ - return run_sort_test(DArray_qsort, "qsort"); -} - -char *test_heapsort() -{ - return run_sort_test(DArray_heapsort, "heapsort"); -} - -char *test_mergesort() -{ - return run_sort_test(DArray_mergesort, "mergesort"); -} - - -char *all_tests() -{ - mu_suite_start(); - - mu_run_test(test_qsort); - mu_run_test(test_heapsort); - mu_run_test(test_mergesort); - - return NULL; -} - -RUN_TESTS(all_tests); diff --git a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/darray_tests.c b/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/darray_tests.c deleted file mode 100644 index 1383d51..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/darray_tests.c +++ /dev/null @@ -1,124 +0,0 @@ -#include "../minunit.h" -#include - -static DArray *array = NULL; -static int *val1 = NULL; -static int *val2 = NULL; - -char *test_create() -{ - array = DArray_create(sizeof(int), 100); - mu_assert(array != NULL, "DArray_create failed."); - mu_assert(array->contents != NULL, "contents are wrong in darray"); - mu_assert(array->end == 0, "end isn't at the right spot"); - mu_assert(array->element_size == sizeof(int), "element size is wrong."); - mu_assert(array->max == 100, "wrong max length on initial size"); - - return NULL; -} - -char *test_destroy() -{ - DArray_destroy(array); - - return NULL; -} - -char *test_new() -{ - val1 = DArray_new(array); - mu_assert(val1 != NULL, "failed to make a new element"); - - val2 = DArray_new(array); - mu_assert(val2 != NULL, "failed to make a new element"); - - return NULL; -} - -char *test_set() -{ - DArray_set(array, 0, val1); - DArray_set(array, 1, val2); - - return NULL; -} - -char *test_get() -{ - mu_assert(DArray_get(array, 0) == val1, "Wrong first value."); - mu_assert(DArray_get(array, 1) == val2, "Wrong second value."); - - return NULL; -} - -char *test_remove() -{ - int *val_check = DArray_remove(array, 0); - mu_assert(val_check != NULL, "Should not get NULL."); - mu_assert(*val_check == *val1, "Should get the first value."); - mu_assert(DArray_get(array, 0) == NULL, "Should be gone."); - DArray_free(val_check); - - val_check = DArray_remove(array, 1); - mu_assert(val_check != NULL, "Should not get NULL."); - mu_assert(*val_check == *val2, "Should get the second value."); - mu_assert(DArray_get(array, 1) == NULL, "Should be gone."); - DArray_free(val_check); - - return NULL; -} - -char *test_expand_contract() -{ - int old_max = array->max; - DArray_expand(array); - mu_assert((unsigned int)array->max == old_max + array->expand_rate, "Wrong size after expand."); - - DArray_contract(array); - mu_assert((unsigned int)array->max == array->expand_rate + 1, "Should stay at the expand_rate at least."); - - DArray_contract(array); - mu_assert((unsigned int)array->max == array->expand_rate + 1, "Should stay at the expand_rate at least."); - - return NULL; -} - -char *test_push_pop() -{ - int i = 0; - for(i = 0; i < 1000; i++) { - int *val = DArray_new(array); - *val = i * 333; - DArray_push(array, val);; - } - - mu_assert(array->max == 1201, "Wrong max size."); - - for(i = 999; i >= 0; i--) { - int *val = DArray_pop(array); - mu_assert(val != NULL, "Shouldn't get a NULL."); - mu_assert(*val == i * 333, "Wrong value."); - DArray_free(val); - } - - return NULL; -} - - -char *all_tests() -{ - mu_suite_start(); - - mu_run_test(test_create); - mu_run_test(test_new); - mu_run_test(test_set); - mu_run_test(test_get); - mu_run_test(test_remove); - mu_run_test(test_expand_contract); - mu_run_test(test_push_pop); - mu_run_test(test_destroy); - - return NULL; -} - -RUN_TESTS(all_tests); diff --git a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/list_algos_tests.c b/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/list_algos_tests.c deleted file mode 100644 index cc0c0cc..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/list_algos_tests.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "../minunit.h" -#include -#include -#include - -char *values[] = {"XXXX", "1234", "abcd", "xjvef", "NDSS"}; -#define NUM_VALUES 5 - -List *create_words() -{ - int i = 0; - List *words = List_create(); - - for(i = 0; i < NUM_VALUES; i++) { - List_push(words, values[i]); - } - - return words; -} - -int is_sorted(List *words) -{ - LIST_FOREACH(words, first, next, cur) { - if(cur->next && strcmp(cur->value, cur->next->value) > 0) { - debug("%s %s", (char *)cur->value, (char *)cur->next->value); - return 0; - } - } - - return 1; -} - -char *test_bubble_sort() -{ - List *words = create_words(); - - // should work on a list that needs sorting - int rc = List_bubble_sort(words, (List_compare)strcmp); - mu_assert(rc == 0, "Bubble sort failed."); - mu_assert(is_sorted(words), "Words are not sorted after bubble sort."); - - // should work on an already sorted list - rc = List_bubble_sort(words, (List_compare)strcmp); - mu_assert(rc == 0, "Bubble sort of already sorted failed."); - mu_assert(is_sorted(words), "Words should be sorted if already bubble sorted."); - - List_destroy(words); - - // should work on an empty list - words = List_create(); - rc = List_bubble_sort(words, (List_compare)strcmp); - mu_assert(rc == 0, "Bubble sort failed on empty list."); - mu_assert(is_sorted(words), "Words should be sorted if empty."); - - List_destroy(words); - - return NULL; -} - -char *test_merge_sort() -{ - List *words = create_words(); - - // should work on a list that needs sorting - List *res = List_merge_sort(words, (List_compare)strcmp); - mu_assert(List_count(res) == List_count(words), "Sorted list has different count."); - mu_assert(is_sorted(res), "Words are not sorted after merge sort."); - - List *res2 = List_merge_sort(res, (List_compare)strcmp); - mu_assert(List_count(res2) == List_count(res), "Sorted list has different count."); - mu_assert(is_sorted(res), "Should still be sorted after merge sort."); - - List_destroy(res2); - List_destroy(res); - - List_destroy(words); - return NULL; -} - - -char *all_tests() -{ - mu_suite_start(); - - mu_run_test(test_bubble_sort); - mu_run_test(test_merge_sort); - - return NULL; -} - -RUN_TESTS(all_tests); diff --git a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/list_tests.c b/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/list_tests.c deleted file mode 100644 index 29e9337..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/list_tests.c +++ /dev/null @@ -1,205 +0,0 @@ -#include "../minunit.h" -#include -#include - -static List *list = NULL; -char *test1 = "test1 data"; -char *test2 = "test2 data"; -char *test3 = "test3 data"; -char *test4 = "test4 data"; - - -char *test_create() -{ - list = List_create(); - mu_assert(list != NULL, "Failed to create list."); - - return NULL; -} - - -char *test_destroy() -{ - List_clear_destroy(list); - - return NULL; -} - - -char *test_push_pop() -{ - List_push(list, test1); - mu_assert(List_last(list) == test1, "Wrong last value."); - - List_push(list, test2); - mu_assert(List_last(list) == test2, "Wrong last value"); - - List_push(list, test3); - mu_assert(List_last(list) == test3, "Wrong last value"); - mu_assert(List_count(list) == 3, "Wrong count on push."); - - char *val = List_pop(list); - mu_assert(val == test3, "Wrong value on pop."); - - val = List_pop(list); - mu_assert(val == test2, "Wrong value on pop."); - - val = List_pop(list); - mu_assert(val == test1, "Wrong value on pop."); - mu_assert(List_count(list) == 0, "Wrong count after pop."); - - return NULL; -} - -char *test_unshift() -{ - List_unshift(list, test1); - mu_assert(List_first(list) == test1, "Wrong first value."); - - List_unshift(list, test2); - mu_assert(List_first(list) == test2, "Wrong first value."); - - List_unshift(list, test3); - mu_assert(List_first(list) == test3, "Wrong first value."); - mu_assert(List_count(list) == 3, "Wrong count on unshift."); - - return NULL; -} - -char *test_remove() -{ - // we only need to test the middle remove case since push/shift - // already tests the other cases - - char *val = List_remove(list, list->first->next); - mu_assert(val == test2, "Wrong removed element."); - mu_assert(List_count(list) == 2, "Wrong count after remove."); - mu_assert(List_first(list) == test3, "Wrong first after remove."); - mu_assert(List_last(list) == test1, "Wrong last after remove."); - - return NULL; -} - - -char *test_shift() -{ - mu_assert(List_count(list) != 0, "Wrong count before shift."); - - char *val = List_shift(list); - mu_assert(val == test3, "Wrong value on shift."); - - val = List_shift(list); - mu_assert(val == test1, "Wrong value on shift."); - mu_assert(List_count(list) == 0, "Wrong count after shift."); - - return NULL; -} - - -char *test_copy() -{ - list = List_create(); - - mu_assert(List_count(list) == 0, "Wrong count before copy."); - List_push(list, test1); - List_push(list, test2); - List_push(list, test3); - List_push(list, test4); - - mu_assert(List_count(list) == 4, "Wrong count after push."); - - List *copy = List_copy(list); - mu_assert(copy != list, "Copy and list have same address."); - mu_assert(List_count(copy) == 4, "Copy has wrong count."); - - return NULL; -} - - -char *test_split() -{ - mu_assert(List_count(list) == 4, "Wrong count before split."); - - List *a = List_create(); - List *b = List_create(); - List *tmp = List_copy(list); - - int rc = -1; - rc = List_split(tmp, test2, a, b); - mu_assert(rc == 0, "Failed to split."); - mu_assert(List_count(a) == 2, "List 'a' has wrong count."); - mu_assert(List_count(b) == 2, "List 'b' has wrong count."); - - List_destroy(a); - List_destroy(b); - - a = List_create(); - b = List_create(); - tmp = List_copy(list); - - rc = List_split(tmp, test1, a, b); - mu_assert(rc == 0, "Failed to split."); - mu_assert(List_count(a) == 1, "List 'a' has wrong count."); - mu_assert(List_count(b) == 3, "List 'b' has wrong count."); - - List_destroy(a); - List_destroy(b); - - a = List_create(); - b = List_create(); - tmp = List_copy(list); - - rc = List_split(tmp, test3, a, b); - mu_assert(rc == 0, "Failed to split."); - mu_assert(List_count(a) == 3, "List 'a' has wrong count."); - mu_assert(List_count(b) == 1, "List 'b' has wrong count."); - - List_destroy(a); - List_destroy(b); - - a = List_create(); - b = List_create(); - tmp = List_copy(list); - - rc = List_split(tmp, test4, a, b); - mu_assert(rc == 0, "Failed to split."); - mu_assert(List_count(a) == 4, "List 'a' has wrong count."); - mu_assert(List_count(b) == 0, "List 'b' has wrong count."); - - return NULL; -} - - -char *test_join() -{ - mu_assert(List_count(list) == 4, "Wrong count before join."); - - List *b = List_create(); - List_push(b, test4); - mu_assert(List_count(b) == 1, "List 'b' has wrong count."); - - List_join(list, b); - mu_assert(List_count(list) == 5, "Wrong count after join."); - - return NULL; -} - - - -char *all_tests() { - mu_suite_start(); - - mu_run_test(test_create); - mu_run_test(test_push_pop); - mu_run_test(test_unshift); - mu_run_test(test_remove); - mu_run_test(test_shift); - mu_run_test(test_destroy); - mu_run_test(test_copy); - mu_run_test(test_split); - mu_run_test(test_join); - - return NULL; -} - -RUN_TESTS(all_tests); diff --git a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/radixmap_tests.c b/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/radixmap_tests.c deleted file mode 100644 index 9e3e6e1..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/tests/lcthw/radixmap_tests.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "../minunit.h" -#include -#include -#include -#include - -static int make_random(RadixMap *map) -{ - size_t i = 0; - - for(i = 0; i < map->max - 1; i++) { - uint32_t key = (uint32_t)(rand() | (rand() << 16)); - check(RadixMap_add(map, key, i) == 0, "Failed to add key %u", key); - } - - return i; - -error: - return 0; -} - -static int check_order(RadixMap *map) -{ - RMElement d1, d2; - unsigned int i = 0; - - // only signal errors if any (should not be) - for(i = 0; map->end > 0 && i < map->end-1; i++) { - d1 = map->contents[i]; - d2 = map->contents[i+1]; - - if(d1.data.key > d2.data.key) { - debug("FAIL:i=%u, key: %u, value: %u, equals max? %d\n", i, d1.data.key, d1.data.value, - d2.data.key == UINT32_MAX); - return 0; - } - } - - return 1; -} - -static int test_search(RadixMap *map) -{ - unsigned int i = 0; - RMElement *d = NULL; - RMElement *found = NULL; - - for(i = map->end / 2; i < map->end; i++) { - d = &map->contents[i]; - found = RadixMap_find(map, d->data.key); - check(found != NULL, "Didn't find %u at %u.", d->data.key, i); - check(found->data.key == d->data.key, "Got the wrong result: %p:%u looking for %u at %u", - found, found->data.key, d->data.key, i); - } - - return 1; -error: - return 0; -} - -// test for big number of elements -static char *test_operations() -{ - size_t N = 200; - - RadixMap *map = RadixMap_create(N); - mu_assert(map != NULL, "Failed to make the map."); - mu_assert(make_random(map), "Didn't make a random fake radix map."); - - RadixMap_sort(map); - mu_assert(check_order(map), "Failed to properly sort the RadixMap."); - - mu_assert(test_search(map), "Failed the search test."); - mu_assert(check_order(map), "RadixMap didn't stay sorted after search."); - - while(map->end > 0) { - RMElement *el = RadixMap_find(map, map->contents[map->end / 2].data.key); - mu_assert(el != NULL, "Should get a result."); - - size_t old_end = map->end; - - mu_assert(RadixMap_delete(map, el) == 0, "Didn't delete it."); - mu_assert(old_end - 1 == map->end, "Wrong size after delete."); - - // test that the end is now the old value, but uint32 max so it trails off - mu_assert(check_order(map), "RadixMap didn't stay sorted after delete."); - } - - RadixMap_destroy(map); - - return NULL; -} - - -char *all_tests() -{ - mu_suite_start(); - srand(time(NULL)); - - mu_run_test(test_operations); - - return NULL; -} - -RUN_TESTS(all_tests); diff --git a/oldstuff/lcthw-remnants-2/liblcthw/tests/minunit.h b/oldstuff/lcthw-remnants-2/liblcthw/tests/minunit.h deleted file mode 100644 index 7ecaa3d..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/tests/minunit.h +++ /dev/null @@ -1,38 +0,0 @@ -#undef DNDEBUG -#ifndef _minunit_h -#define _minunit_h - -#include -#include -#include - -#define mu_suite_start() char *message = NULL - -#define mu_assert(test, message) if (!(test)) {\ - log_err(message); return message;\ - }\ - assertions_made++; -#define mu_run_test(test) debug("\n-----%s", " " #test); \ - message = test(); tests_run++; if (message) return message; - -#define RUN_TESTS(name) int main(int argc, char *argv[]) {\ - argc = argc; \ - argv = argv; \ - debug("----- RUNNING: %s", argv[0]);\ - printf("----\nRUNNING: %s\n", argv[0]);\ - char *result = name();\ - if (result != 0) {\ - printf("FAILED: %s\n", result);\ - }\ - else {\ - printf("ALL TESTS PASSED\n");\ - }\ - printf("Tests run: %d\n", tests_run);\ - printf("Assertions made: %d\n", assertions_made);\ - exit(result != 0);\ -} - -int tests_run; -int assertions_made; - -#endif diff --git a/oldstuff/lcthw-remnants-2/liblcthw/tests/runtests.c b/oldstuff/lcthw-remnants-2/liblcthw/tests/runtests.c deleted file mode 100644 index 40585fb..0000000 --- a/oldstuff/lcthw-remnants-2/liblcthw/tests/runtests.c +++ /dev/null @@ -1,107 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int test_selector(const struct dirent *ep) -{ - return fnmatch("*_tests", ep->d_name, 0) == 0; -} - -int run_tests_file(char *filename) -{ - if(access(filename, R_OK | X_OK) == 0) { - return system(filename); - } - - return -1; -} - -int main(int argc, char *argv[]) -{ - int entcount = 0; - int rc = 0; - int i = 0; - int ntests = 0; - char *testsdir = NULL; - char *valgrind = getenv("VALGRIND"); - struct dirent **namelist = NULL; - struct dirent *ep = NULL; - - if(argc > 1) { - testsdir = argv[1]; - } - - if(!testsdir) { - testsdir = getenv("TESTS"); - } - - if(!testsdir) { - testsdir = "./tests"; - } - - entcount = scandir((const char *)testsdir, &namelist, test_selector, alphasort); - check(entcount > -1, "Failed to scan tests dir"); - - for(i = 0; i < entcount; i++) { - ep = namelist[i]; - check(ep, "Dirent is missing."); - - char filename[256]; - rc = sprintf(filename, "%s/%s", testsdir, ep->d_name); - check(rc > -1, "Failed to build filename."); - debug("Found filename '%s'", filename); - - free(ep); - - if(valgrind) { - char command[1024]; - rc = sprintf(command, "%s %s", valgrind, filename); - check(rc > -1, "Failed to build command with valgrind."); - rc = run_tests_file(command); - } else { - rc = run_tests_file(filename); - } - - if(rc > 0) { - debug("Skipping '%s'", filename); - continue; - } - - ntests++; - - if(rc == 0) { - printf("%s PASS\n", filename); - continue; - } - - printf("ERROR in test %s", filename); - if(access("tests/tests.log", R_OK) == 0) { - printf(": here's tests/tests.log\n"); - printf("------\n"); - rc = system("tail tests/tests.log"); - } else { - printf("\n"); - } - goto error; - } - - printf("------\n"); - printf("Total of %d test file%s run.\n", ntests, ntests > 1 ? "s" : ""); - - if(namelist) { - free(namelist); - } - - return 0; - -error: - if(namelist) { - free(namelist); - } - - return rc != 0 ? rc : 1; -} diff --git a/oldstuff/lcthw-remnants-2/list-exercises b/oldstuff/lcthw-remnants-2/list-exercises deleted file mode 100755 index 230d80b..0000000 --- a/oldstuff/lcthw-remnants-2/list-exercises +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -grep -lE '^int main' *.c | sed 's/\.c//' diff --git a/oldstuff/lcthw-remnants-2/object.c b/oldstuff/lcthw-remnants-2/object.c deleted file mode 100644 index 6e9d18e..0000000 --- a/oldstuff/lcthw-remnants-2/object.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include "object.h" -#include - -void Object_destroy(void *self) -{ - Object *obj = self; - - if(obj) { - if(obj->description) free(obj->description); - free(obj); - } -} - -void Object_describe(void *self) -{ - assert(self != NULL); - Object *obj = self; - printf("%s.\n", obj->description); -} - -int Object_init(void *self) -{ - // do nothing really - return 1; -} - -void *Object_move(void *self, Direction direction) -{ - printf("You can't go that direction.\n"); - return NULL; -} - -int Object_attack(void *self, int damage) -{ - printf("You can't attack that.\n"); - return 0; -} - -void *Object_new(size_t size, Object proto, char *description) -{ - assert(description != NULL); - - // setup the default functions in case they aren't set - if(!proto.init) proto.init = Object_init; - if(!proto.describe) proto.describe = Object_describe; - if(!proto.destroy) proto.destroy = Object_destroy; - if(!proto.attack) proto.attack = Object_attack; - if(!proto.move) proto.move = Object_move; - - // this seems weird, but we can make a struct of one size, - // then point a different pointer at it to "cast" it - Object *el = calloc(1, size); - assert(el != NULL); - *el = proto; - - // copy the description over - el->description = strdup(description); - - // initialize it with whatever init we were given - if(!el->init(el)) { - // looks like it didn't initialize properly - el->destroy(el); - return NULL; - } else { - // all done, we made an object of any type - return el; - } -} diff --git a/oldstuff/lcthw-remnants-2/object.h b/oldstuff/lcthw-remnants-2/object.h deleted file mode 100644 index 8862d2c..0000000 --- a/oldstuff/lcthw-remnants-2/object.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _object_h -#define _object_h - -typedef enum { - NORTH, SOUTH, EAST, WEST -} Direction; - -typedef struct { - char *description; - int (*init)(void *self); - void (*describe)(void *self); - void (*destroy)(void *self); - void *(*move)(void *self, Direction direction); - int (*attack)(void *self, int damage); -} Object; - -int Object_init(void *self); -void Object_destroy(void *self); -void Object_describe(void *self); -void *Object_move(void *self, Direction direction); -int Object_attack(void *self, int damage); -void *Object_new(size_t size, Object proto, char *description); - -#define NEW(T, N) Object_new(sizeof(T), T##Proto, N) -#define _(N) proto.N - -#endif diff --git a/oldstuff/lcthw-remnants-2/runtests b/oldstuff/lcthw-remnants-2/runtests deleted file mode 100755 index 8f7496e..0000000 --- a/oldstuff/lcthw-remnants-2/runtests +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -set -e - -[[ $DEBUG ]] && set -x - -test_ex17-ec() { - local testdb=$(mktemp /var/tmp/XXXXXXX.dat) - trap "rm ${testdb}" EXIT INT TERM - ./ex17-ec "${testdb}" c - ./ex17-ec "${testdb}" l &>/dev/null - ./ex17-ec "${testdb}" s 1 nancy pwnr@dungeon.info "Dark corner" - ./ex17-ec "${testdb}" s 2 fran eagleeye16@hotmail.com "Falcon's nest" - ./ex17-ec "${testdb}" l &>/dev/null - ./ex17-ec "${testdb}" d 1 - ./ex17-ec "${testdb}" s 1 portia wanda@aeromar.mx "Fancy town" - ./ex17-ec "${testdb}" f nest &>/dev/null -} - -test_ex18() { - local output=$(./ex18 4 1 7 3 2 0 8) - [[ "${output}" =~ '0 1 2 3 4 7 8' ]] - [[ "${output}" =~ '8 7 4 3 2 1 0' ]] - [[ "${output}" =~ '3 4 2 7 1 0 8' ]] -} - -test_ex19() { - printf "l\nn\nl\ne\nw\nw\nl\na\na\na\na\na\na\na\na\na\na\n" \ - | ./ex19 &>/dev/null - printf "l\nl\nl\nl\na\na\nx\nq\nz\nn\n" | ./ex19 &>/dev/null - for i in {0..20} ; do - echo "${RANDOM}" | md5sum | ./ex19 &>/dev/null - done -} - -main() { - for ex in $(./list-exercises) ; do - func_name="test_${ex}" - if type "${func_name}" &>/dev/null ; then - echo -en "---> ${ex}: " - "${func_name}" - echo "OK" - fi - done -} - -main "$@" diff --git a/oldstuff/lcthw-remnants/.gitignore b/oldstuff/lcthw-remnants/.gitignore deleted file mode 100644 index 8ed1cb2..0000000 --- a/oldstuff/lcthw-remnants/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -*.dat -ex1 -ex10 -ex11 -ex12 -ex13 -ex14 -ex15 -ex16 -ex17 -ex17-* -!ex17-*.c -ex18 -ex19 -ex20 -ex21 -ex22_ec1 -ex22_main -ex23 -ex24 -ex24_iofunctions01 -ex24_iofunctions02 -ex24_iofunctions03 -ex24_iofunctions04 -ex24_iofunctions05 -ex24_iofunctions06 -ex25 -ex3 -ex4 -ex5 -ex6 -ex7 -ex8 -ex9 -.exrc -.rvmrc -valgrind-* diff --git a/oldstuff/lcthw-remnants/Makefile b/oldstuff/lcthw-remnants/Makefile deleted file mode 100644 index 4b9e702..0000000 --- a/oldstuff/lcthw-remnants/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -CFLAGS += -Wall -Wextra -pedantic -std=gnu99 -g -DNDEBUG - -EXERCISES = $(patsubst %.c,%,$(shell ls ex*.c | egrep -v "ex(19|22)")) - - -all: $(EXERCISES) - $(MAKE) -f ex19.mk - $(MAKE) -f ex22.mk - - -test: all - $(MAKE) -f ex19.mk test - ./test_ex24_iofunctions.sh - - -clean: - rm -f $(EXERCISES) - $(MAKE) -f ex19.mk clean - $(MAKE) -f ex22.mk clean - - -.PHONY: all test clean diff --git a/oldstuff/lcthw-remnants/README.md b/oldstuff/lcthw-remnants/README.md deleted file mode 100644 index c394c3b..0000000 --- a/oldstuff/lcthw-remnants/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Zed asked for folks to work through -Learn C The Hard Way and provide feedback, so that's what I'm doing. diff --git a/oldstuff/lcthw-remnants/apr-install-script.sh b/oldstuff/lcthw-remnants/apr-install-script.sh deleted file mode 100755 index 870d3ba..0000000 --- a/oldstuff/lcthw-remnants/apr-install-script.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -set -e - -# go somewhere safe -cd /tmp - -# get the source to base APR 1.4.5 -curl -L -O http://download.nextag.com/apache/apr/apr-1.4.5.tar.gz - -# extract it and go into the source -tar -xzvf apr-1.4.5.tar.gz -cd apr-1.4.5 - -# configure, make, make install -./configure -make -sudo make install - -# reset -cd /tmp - -# do the same with apr-util -curl -L -O http://download.nextag.com/apache/apr/apr-util-1.3.12.tar.gz - -# extract -tar -xzvf apr-util-1.3.12.tar.gz -cd apr-util-1.3.12 - -# configure, make, make install -./configure --with-apr=/usr/local/apr -# you need that extra parameter to configure because -# apr-util can't really find it because... who knows. - -make -sudo make install - -# cleanup -cd /tmp -#rm -rvf apr-util-1.3.12* apr-1.4.5* diff --git a/oldstuff/lcthw-remnants/break-ex10.py b/oldstuff/lcthw-remnants/break-ex10.py deleted file mode 100644 index 2f2b2ea..0000000 --- a/oldstuff/lcthw-remnants/break-ex10.py +++ /dev/null @@ -1,10 +0,0 @@ -from __future__ import print_function - -import os -import sys - -argc = int(sys.argv[1]) if sys.argv[1:] else 23694 -command = "valgrind ./ex10 " + " ".join(map(str, range(argc))) -print("command = {0}".format(command)) - -os.system(command) diff --git a/oldstuff/lcthw-remnants/break-ex25.rb b/oldstuff/lcthw-remnants/break-ex25.rb deleted file mode 100644 index 2d729e0..0000000 --- a/oldstuff/lcthw-remnants/break-ex25.rb +++ /dev/null @@ -1,11 +0,0 @@ -def main - ex25 = IO.popen("./ex25", "w+") - ex25.write("z" * 10000) - ex25.flush - puts ex25.readlines.join("\n") -end - - -if $0 == __FILE__ - main -end diff --git a/oldstuff/lcthw-remnants/check-for-iofunctions.sh b/oldstuff/lcthw-remnants/check-for-iofunctions.sh deleted file mode 100755 index 59d5f3e..0000000 --- a/oldstuff/lcthw-remnants/check-for-iofunctions.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -for func in $(cat iofunctions.txt) -do - echo "$func: $(grep "$func" *.c | wc -l)" -done diff --git a/oldstuff/lcthw-remnants/dbg.h b/oldstuff/lcthw-remnants/dbg.h deleted file mode 100644 index e6edb38..0000000 --- a/oldstuff/lcthw-remnants/dbg.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __dbg_h__ -#define __dbg_h__ - -#include -#include -#include - -#ifdef NDEBUG -#define debug(M, ...) -#else -#define debug(M, ...) \ - fprintf(stderr, "DEBUG %s:%d:[%s]: " M "\n", \ - __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) -#endif - -#define clean_errno() (errno == 0 ? "None" : strerror(errno)) - -#define log_err(M, ...) \ - fprintf(stderr, "[ERROR] (%s:%d:[%s]: errno: %s) " M "\n", \ - __FILE__, __LINE__, __FUNCTION__, clean_errno(), ##__VA_ARGS__) - -#define log_warn(M, ...) \ - fprintf(stderr, "[WARN] (%s:%d:[%s]: errno: %s) " M "\n", \ - __FILE__, __LINE__, __FUNCTION__, clean_errno(), ##__VA_ARGS__) - -#define log_info(M, ...) \ - fprintf(stderr, "[INFO] (%s:%d:[%s]: errno: %s) " M "\n", \ - __FILE__, __LINE__, __FUNCTION__, clean_errno(), ##__VA_ARGS__) - -#define check(A, M, ...) \ - if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define sentinel(M, ...) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } - -#define check_mem(A) check((A), "Out of memory.") - -#define check_debug(A, M, ...) \ - if(!(A)) { debug(M, ##__VA_ARGS__); errno=0; goto error; } - -#endif diff --git a/oldstuff/lcthw-remnants/devpkg/.gitignore b/oldstuff/lcthw-remnants/devpkg/.gitignore deleted file mode 100644 index 4642b33..0000000 --- a/oldstuff/lcthw-remnants/devpkg/.gitignore +++ /dev/null @@ -1 +0,0 @@ -devpkg diff --git a/oldstuff/lcthw-remnants/devpkg/Makefile b/oldstuff/lcthw-remnants/devpkg/Makefile deleted file mode 100644 index 190f9a4..0000000 --- a/oldstuff/lcthw-remnants/devpkg/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -PREFIX?=/usr/local -CFLAGS=-g -Wall -I${PREFIX}/apr/include/apr-1 -D_LARGEFILE64_SOURCE -LDFLAGS=-L${PREFIX}/apr/lib -lapr-1 -pthread -laprutil-1 - -all: devpkg - -devpkg: bstrlib.o db.o shell.o commands.o - -install: all - install -d $(DESTDIR)/$(PREFIX)/bin/ - install devpkg $(DESTDIR)/$(PREFIX)/bin/ - -clean: - rm -f *.o - rm -f devpkg - rm -rf *.dSYM diff --git a/oldstuff/lcthw-remnants/devpkg/README b/oldstuff/lcthw-remnants/devpkg/README deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/lcthw-remnants/devpkg/apr_errno_test.c b/oldstuff/lcthw-remnants/devpkg/apr_errno_test.c deleted file mode 100644 index 7a9be27..0000000 --- a/oldstuff/lcthw-remnants/devpkg/apr_errno_test.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - - -int main(int argc, char *argv[]) -{ - return 0; -} diff --git a/oldstuff/lcthw-remnants/devpkg/bstrlib.c b/oldstuff/lcthw-remnants/devpkg/bstrlib.c deleted file mode 100644 index c6294f1..0000000 --- a/oldstuff/lcthw-remnants/devpkg/bstrlib.c +++ /dev/null @@ -1,2979 +0,0 @@ -/* - * This source file is part of the bstring string library. This code was - * written by Paul Hsieh in 2002-2010, and is covered by either the 3-clause - * BSD open source license or GPL v2.0. Refer to the accompanying documentation - * for details on usage and license. - */ - -/* - * bstrlib.c - * - * This file is the core module for implementing the bstring functions. - */ - -#if defined (_MSC_VER) -/* These warnings from MSVC++ are totally pointless. */ -# define _CRT_SECURE_NO_WARNINGS -#endif - -#include -#include -#include -#include -#include -#include -#include "bstrlib.h" - -/* Optionally include a mechanism for debugging memory */ - -#if defined(MEMORY_DEBUG) || defined(BSTRLIB_MEMORY_DEBUG) -#include "memdbg.h" -#endif - -#ifndef bstr__alloc -#define bstr__alloc(x) malloc (x) -#endif - -#ifndef bstr__free -#define bstr__free(p) free (p) -#endif - -#ifndef bstr__realloc -#define bstr__realloc(p,x) realloc ((p), (x)) -#endif - -#ifndef bstr__memcpy -#define bstr__memcpy(d,s,l) memcpy ((d), (s), (l)) -#endif - -#ifndef bstr__memmove -#define bstr__memmove(d,s,l) memmove ((d), (s), (l)) -#endif - -#ifndef bstr__memset -#define bstr__memset(d,c,l) memset ((d), (c), (l)) -#endif - -#ifndef bstr__memcmp -#define bstr__memcmp(d,c,l) memcmp ((d), (c), (l)) -#endif - -#ifndef bstr__memchr -#define bstr__memchr(s,c,l) memchr ((s), (c), (l)) -#endif - -/* Just a length safe wrapper for memmove. */ - -#define bBlockCopy(D,S,L) { if ((L) > 0) bstr__memmove ((D),(S),(L)); } - -/* Compute the snapped size for a given requested size. By snapping to powers - of 2 like this, repeated reallocations are avoided. */ -static int snapUpSize (int i) { - if (i < 8) { - i = 8; - } else { - unsigned int j; - j = (unsigned int) i; - - j |= (j >> 1); - j |= (j >> 2); - j |= (j >> 4); - j |= (j >> 8); /* Ok, since int >= 16 bits */ -#if (UINT_MAX != 0xffff) - j |= (j >> 16); /* For 32 bit int systems */ -#if (UINT_MAX > 0xffffffffUL) - j |= (j >> 32); /* For 64 bit int systems */ -#endif -#endif - /* Least power of two greater than i */ - j++; - if ((int) j >= i) i = (int) j; - } - return i; -} - -/* int balloc (bstring b, int len) - * - * Increase the size of the memory backing the bstring b to at least len. - */ -int balloc (bstring b, int olen) { - int len; - if (b == NULL || b->data == NULL || b->slen < 0 || b->mlen <= 0 || - b->mlen < b->slen || olen <= 0) { - return BSTR_ERR; - } - - if (olen >= b->mlen) { - unsigned char * x; - - if ((len = snapUpSize (olen)) <= b->mlen) return BSTR_OK; - - /* Assume probability of a non-moving realloc is 0.125 */ - if (7 * b->mlen < 8 * b->slen) { - - /* If slen is close to mlen in size then use realloc to reduce - the memory defragmentation */ - - reallocStrategy:; - - x = (unsigned char *) bstr__realloc (b->data, (size_t) len); - if (x == NULL) { - - /* Since we failed, try allocating the tighest possible - allocation */ - - if (NULL == (x = (unsigned char *) bstr__realloc (b->data, (size_t) (len = olen)))) { - return BSTR_ERR; - } - } - } else { - - /* If slen is not close to mlen then avoid the penalty of copying - the extra bytes that are allocated, but not considered part of - the string */ - - if (NULL == (x = (unsigned char *) bstr__alloc ((size_t) len))) { - - /* Perhaps there is no available memory for the two - allocations to be in memory at once */ - - goto reallocStrategy; - - } else { - if (b->slen) bstr__memcpy ((char *) x, (char *) b->data, (size_t) b->slen); - bstr__free (b->data); - } - } - b->data = x; - b->mlen = len; - b->data[b->slen] = (unsigned char) '\0'; - } - - return BSTR_OK; -} - -/* int ballocmin (bstring b, int len) - * - * Set the size of the memory backing the bstring b to len or b->slen+1, - * whichever is larger. Note that repeated use of this function can degrade - * performance. - */ -int ballocmin (bstring b, int len) { - unsigned char * s; - - if (b == NULL || b->data == NULL || (b->slen+1) < 0 || b->mlen <= 0 || - b->mlen < b->slen || len <= 0) { - return BSTR_ERR; - } - - if (len < b->slen + 1) len = b->slen + 1; - - if (len != b->mlen) { - s = (unsigned char *) bstr__realloc (b->data, (size_t) len); - if (NULL == s) return BSTR_ERR; - s[b->slen] = (unsigned char) '\0'; - b->data = s; - b->mlen = len; - } - - return BSTR_OK; -} - -/* bstring bfromcstr (const char * str) - * - * Create a bstring which contains the contents of the '\0' terminated char * - * buffer str. - */ -bstring bfromcstr (const char * str) { -bstring b; -int i; -size_t j; - - if (str == NULL) return NULL; - j = (strlen) (str); - i = snapUpSize ((int) (j + (2 - (j != 0)))); - if (i <= (int) j) return NULL; - - b = (bstring) bstr__alloc (sizeof (struct tagbstring)); - if (NULL == b) return NULL; - b->slen = (int) j; - if (NULL == (b->data = (unsigned char *) bstr__alloc (b->mlen = i))) { - bstr__free (b); - return NULL; - } - - bstr__memcpy (b->data, str, j+1); - return b; -} - -/* bstring bfromcstralloc (int mlen, const char * str) - * - * Create a bstring which contains the contents of the '\0' terminated char * - * buffer str. The memory buffer backing the string is at least len - * characters in length. - */ -bstring bfromcstralloc (int mlen, const char * str) { -bstring b; -int i; -size_t j; - - if (str == NULL) return NULL; - j = (strlen) (str); - i = snapUpSize ((int) (j + (2 - (j != 0)))); - if (i <= (int) j) return NULL; - - b = (bstring) bstr__alloc (sizeof (struct tagbstring)); - if (b == NULL) return NULL; - b->slen = (int) j; - if (i < mlen) i = mlen; - - if (NULL == (b->data = (unsigned char *) bstr__alloc (b->mlen = i))) { - bstr__free (b); - return NULL; - } - - bstr__memcpy (b->data, str, j+1); - return b; -} - -/* bstring blk2bstr (const void * blk, int len) - * - * Create a bstring which contains the content of the block blk of length - * len. - */ -bstring blk2bstr (const void * blk, int len) { -bstring b; -int i; - - if (blk == NULL || len < 0) return NULL; - b = (bstring) bstr__alloc (sizeof (struct tagbstring)); - if (b == NULL) return NULL; - b->slen = len; - - i = len + (2 - (len != 0)); - i = snapUpSize (i); - - b->mlen = i; - - b->data = (unsigned char *) bstr__alloc ((size_t) b->mlen); - if (b->data == NULL) { - bstr__free (b); - return NULL; - } - - if (len > 0) bstr__memcpy (b->data, blk, (size_t) len); - b->data[len] = (unsigned char) '\0'; - - return b; -} - -/* char * bstr2cstr (const_bstring s, char z) - * - * Create a '\0' terminated char * buffer which is equal to the contents of - * the bstring s, except that any contained '\0' characters are converted - * to the character in z. This returned value should be freed with a - * bcstrfree () call, by the calling application. - */ -char * bstr2cstr (const_bstring b, char z) { -int i, l; -char * r; - - if (b == NULL || b->slen < 0 || b->data == NULL) return NULL; - l = b->slen; - r = (char *) bstr__alloc ((size_t) (l + 1)); - if (r == NULL) return r; - - for (i=0; i < l; i ++) { - r[i] = (char) ((b->data[i] == '\0') ? z : (char) (b->data[i])); - } - - r[l] = (unsigned char) '\0'; - - return r; -} - -/* int bcstrfree (char * s) - * - * Frees a C-string generated by bstr2cstr (). This is normally unnecessary - * since it just wraps a call to bstr__free (), however, if bstr__alloc () - * and bstr__free () have been redefined as a macros within the bstrlib - * module (via defining them in memdbg.h after defining - * BSTRLIB_MEMORY_DEBUG) with some difference in behaviour from the std - * library functions, then this allows a correct way of freeing the memory - * that allows higher level code to be independent from these macro - * redefinitions. - */ -int bcstrfree (char * s) { - if (s) { - bstr__free (s); - return BSTR_OK; - } - return BSTR_ERR; -} - -/* int bconcat (bstring b0, const_bstring b1) - * - * Concatenate the bstring b1 to the bstring b0. - */ -int bconcat (bstring b0, const_bstring b1) { -int len, d; -bstring aux = (bstring) b1; - - if (b0 == NULL || b1 == NULL || b0->data == NULL || b1->data == NULL) return BSTR_ERR; - - d = b0->slen; - len = b1->slen; - if ((d | (b0->mlen - d) | len | (d + len)) < 0) return BSTR_ERR; - - if (b0->mlen <= d + len + 1) { - ptrdiff_t pd = b1->data - b0->data; - if (0 <= pd && pd < b0->mlen) { - if (NULL == (aux = bstrcpy (b1))) return BSTR_ERR; - } - if (balloc (b0, d + len + 1) != BSTR_OK) { - if (aux != b1) bdestroy (aux); - return BSTR_ERR; - } - } - - bBlockCopy (&b0->data[d], &aux->data[0], (size_t) len); - b0->data[d + len] = (unsigned char) '\0'; - b0->slen = d + len; - if (aux != b1) bdestroy (aux); - return BSTR_OK; -} - -/* int bconchar (bstring b, char c) -/ * - * Concatenate the single character c to the bstring b. - */ -int bconchar (bstring b, char c) { -int d; - - if (b == NULL) return BSTR_ERR; - d = b->slen; - if ((d | (b->mlen - d)) < 0 || balloc (b, d + 2) != BSTR_OK) return BSTR_ERR; - b->data[d] = (unsigned char) c; - b->data[d + 1] = (unsigned char) '\0'; - b->slen++; - return BSTR_OK; -} - -/* int bcatcstr (bstring b, const char * s) - * - * Concatenate a char * string to a bstring. - */ -int bcatcstr (bstring b, const char * s) { -char * d; -int i, l; - - if (b == NULL || b->data == NULL || b->slen < 0 || b->mlen < b->slen - || b->mlen <= 0 || s == NULL) return BSTR_ERR; - - /* Optimistically concatenate directly */ - l = b->mlen - b->slen; - d = (char *) &b->data[b->slen]; - for (i=0; i < l; i++) { - if ((*d++ = *s++) == '\0') { - b->slen += i; - return BSTR_OK; - } - } - b->slen += i; - - /* Need to explicitely resize and concatenate tail */ - return bcatblk (b, (const void *) s, (int) strlen (s)); -} - -/* int bcatblk (bstring b, const void * s, int len) - * - * Concatenate a fixed length buffer to a bstring. - */ -int bcatblk (bstring b, const void * s, int len) { -int nl; - - if (b == NULL || b->data == NULL || b->slen < 0 || b->mlen < b->slen - || b->mlen <= 0 || s == NULL || len < 0) return BSTR_ERR; - - if (0 > (nl = b->slen + len)) return BSTR_ERR; /* Overflow? */ - if (b->mlen <= nl && 0 > balloc (b, nl + 1)) return BSTR_ERR; - - bBlockCopy (&b->data[b->slen], s, (size_t) len); - b->slen = nl; - b->data[nl] = (unsigned char) '\0'; - return BSTR_OK; -} - -/* bstring bstrcpy (const_bstring b) - * - * Create a copy of the bstring b. - */ -bstring bstrcpy (const_bstring b) { -bstring b0; -int i,j; - - /* Attempted to copy an invalid string? */ - if (b == NULL || b->slen < 0 || b->data == NULL) return NULL; - - b0 = (bstring) bstr__alloc (sizeof (struct tagbstring)); - if (b0 == NULL) { - /* Unable to allocate memory for string header */ - return NULL; - } - - i = b->slen; - j = snapUpSize (i + 1); - - b0->data = (unsigned char *) bstr__alloc (j); - if (b0->data == NULL) { - j = i + 1; - b0->data = (unsigned char *) bstr__alloc (j); - if (b0->data == NULL) { - /* Unable to allocate memory for string data */ - bstr__free (b0); - return NULL; - } - } - - b0->mlen = j; - b0->slen = i; - - if (i) bstr__memcpy ((char *) b0->data, (char *) b->data, i); - b0->data[b0->slen] = (unsigned char) '\0'; - - return b0; -} - -/* int bassign (bstring a, const_bstring b) - * - * Overwrite the string a with the contents of string b. - */ -int bassign (bstring a, const_bstring b) { - if (b == NULL || b->data == NULL || b->slen < 0) - return BSTR_ERR; - if (b->slen != 0) { - if (balloc (a, b->slen) != BSTR_OK) return BSTR_ERR; - bstr__memmove (a->data, b->data, b->slen); - } else { - if (a == NULL || a->data == NULL || a->mlen < a->slen || - a->slen < 0 || a->mlen == 0) - return BSTR_ERR; - } - a->data[b->slen] = (unsigned char) '\0'; - a->slen = b->slen; - return BSTR_OK; -} - -/* int bassignmidstr (bstring a, const_bstring b, int left, int len) - * - * Overwrite the string a with the middle of contents of string b - * starting from position left and running for a length len. left and - * len are clamped to the ends of b as with the function bmidstr. - */ -int bassignmidstr (bstring a, const_bstring b, int left, int len) { - if (b == NULL || b->data == NULL || b->slen < 0) - return BSTR_ERR; - - if (left < 0) { - len += left; - left = 0; - } - - if (len > b->slen - left) len = b->slen - left; - - if (a == NULL || a->data == NULL || a->mlen < a->slen || - a->slen < 0 || a->mlen == 0) - return BSTR_ERR; - - if (len > 0) { - if (balloc (a, len) != BSTR_OK) return BSTR_ERR; - bstr__memmove (a->data, b->data + left, len); - a->slen = len; - } else { - a->slen = 0; - } - a->data[a->slen] = (unsigned char) '\0'; - return BSTR_OK; -} - -/* int bassigncstr (bstring a, const char * str) - * - * Overwrite the string a with the contents of char * string str. Note that - * the bstring a must be a well defined and writable bstring. If an error - * occurs BSTR_ERR is returned however a may be partially overwritten. - */ -int bassigncstr (bstring a, const char * str) { -int i; -size_t len; - if (a == NULL || a->data == NULL || a->mlen < a->slen || - a->slen < 0 || a->mlen == 0 || NULL == str) - return BSTR_ERR; - - for (i=0; i < a->mlen; i++) { - if ('\0' == (a->data[i] = str[i])) { - a->slen = i; - return BSTR_OK; - } - } - - a->slen = i; - len = strlen (str + i); - if (len > INT_MAX || i + len + 1 > INT_MAX || - 0 > balloc (a, (int) (i + len + 1))) return BSTR_ERR; - bBlockCopy (a->data + i, str + i, (size_t) len + 1); - a->slen += (int) len; - return BSTR_OK; -} - -/* int bassignblk (bstring a, const void * s, int len) - * - * Overwrite the string a with the contents of the block (s, len). Note that - * the bstring a must be a well defined and writable bstring. If an error - * occurs BSTR_ERR is returned and a is not overwritten. - */ -int bassignblk (bstring a, const void * s, int len) { - if (a == NULL || a->data == NULL || a->mlen < a->slen || - a->slen < 0 || a->mlen == 0 || NULL == s || len + 1 < 1) - return BSTR_ERR; - if (len + 1 > a->mlen && 0 > balloc (a, len + 1)) return BSTR_ERR; - bBlockCopy (a->data, s, (size_t) len); - a->data[len] = (unsigned char) '\0'; - a->slen = len; - return BSTR_OK; -} - -/* int btrunc (bstring b, int n) - * - * Truncate the bstring to at most n characters. - */ -int btrunc (bstring b, int n) { - if (n < 0 || b == NULL || b->data == NULL || b->mlen < b->slen || - b->slen < 0 || b->mlen <= 0) return BSTR_ERR; - if (b->slen > n) { - b->slen = n; - b->data[n] = (unsigned char) '\0'; - } - return BSTR_OK; -} - -#define upcase(c) (toupper ((unsigned char) c)) -#define downcase(c) (tolower ((unsigned char) c)) -#define wspace(c) (isspace ((unsigned char) c)) - -/* int btoupper (bstring b) - * - * Convert contents of bstring to upper case. - */ -int btoupper (bstring b) { -int i, len; - if (b == NULL || b->data == NULL || b->mlen < b->slen || - b->slen < 0 || b->mlen <= 0) return BSTR_ERR; - for (i=0, len = b->slen; i < len; i++) { - b->data[i] = (unsigned char) upcase (b->data[i]); - } - return BSTR_OK; -} - -/* int btolower (bstring b) - * - * Convert contents of bstring to lower case. - */ -int btolower (bstring b) { -int i, len; - if (b == NULL || b->data == NULL || b->mlen < b->slen || - b->slen < 0 || b->mlen <= 0) return BSTR_ERR; - for (i=0, len = b->slen; i < len; i++) { - b->data[i] = (unsigned char) downcase (b->data[i]); - } - return BSTR_OK; -} - -/* int bstricmp (const_bstring b0, const_bstring b1) - * - * Compare two strings without differentiating between case. The return - * value is the difference of the values of the characters where the two - * strings first differ after lower case transformation, otherwise 0 is - * returned indicating that the strings are equal. If the lengths are - * different, then a difference from 0 is given, but if the first extra - * character is '\0', then it is taken to be the value UCHAR_MAX+1. - */ -int bstricmp (const_bstring b0, const_bstring b1) { -int i, v, n; - - if (bdata (b0) == NULL || b0->slen < 0 || - bdata (b1) == NULL || b1->slen < 0) return SHRT_MIN; - if ((n = b0->slen) > b1->slen) n = b1->slen; - else if (b0->slen == b1->slen && b0->data == b1->data) return BSTR_OK; - - for (i = 0; i < n; i ++) { - v = (char) downcase (b0->data[i]) - - (char) downcase (b1->data[i]); - if (0 != v) return v; - } - - if (b0->slen > n) { - v = (char) downcase (b0->data[n]); - if (v) return v; - return UCHAR_MAX + 1; - } - if (b1->slen > n) { - v = - (char) downcase (b1->data[n]); - if (v) return v; - return - (int) (UCHAR_MAX + 1); - } - return BSTR_OK; -} - -/* int bstrnicmp (const_bstring b0, const_bstring b1, int n) - * - * Compare two strings without differentiating between case for at most n - * characters. If the position where the two strings first differ is - * before the nth position, the return value is the difference of the values - * of the characters, otherwise 0 is returned. If the lengths are different - * and less than n characters, then a difference from 0 is given, but if the - * first extra character is '\0', then it is taken to be the value - * UCHAR_MAX+1. - */ -int bstrnicmp (const_bstring b0, const_bstring b1, int n) { -int i, v, m; - - if (bdata (b0) == NULL || b0->slen < 0 || - bdata (b1) == NULL || b1->slen < 0 || n < 0) return SHRT_MIN; - m = n; - if (m > b0->slen) m = b0->slen; - if (m > b1->slen) m = b1->slen; - - if (b0->data != b1->data) { - for (i = 0; i < m; i ++) { - v = (char) downcase (b0->data[i]); - v -= (char) downcase (b1->data[i]); - if (v != 0) return b0->data[i] - b1->data[i]; - } - } - - if (n == m || b0->slen == b1->slen) return BSTR_OK; - - if (b0->slen > m) { - v = (char) downcase (b0->data[m]); - if (v) return v; - return UCHAR_MAX + 1; - } - - v = - (char) downcase (b1->data[m]); - if (v) return v; - return - (int) (UCHAR_MAX + 1); -} - -/* int biseqcaseless (const_bstring b0, const_bstring b1) - * - * Compare two strings for equality without differentiating between case. - * If the strings differ other than in case, 0 is returned, if the strings - * are the same, 1 is returned, if there is an error, -1 is returned. If - * the length of the strings are different, this function is O(1). '\0' - * termination characters are not treated in any special way. - */ -int biseqcaseless (const_bstring b0, const_bstring b1) { -int i, n; - - if (bdata (b0) == NULL || b0->slen < 0 || - bdata (b1) == NULL || b1->slen < 0) return BSTR_ERR; - if (b0->slen != b1->slen) return BSTR_OK; - if (b0->data == b1->data || b0->slen == 0) return 1; - for (i=0, n=b0->slen; i < n; i++) { - if (b0->data[i] != b1->data[i]) { - unsigned char c = (unsigned char) downcase (b0->data[i]); - if (c != (unsigned char) downcase (b1->data[i])) return 0; - } - } - return 1; -} - -/* int bisstemeqcaselessblk (const_bstring b0, const void * blk, int len) - * - * Compare beginning of string b0 with a block of memory of length len - * without differentiating between case for equality. If the beginning of b0 - * differs from the memory block other than in case (or if b0 is too short), - * 0 is returned, if the strings are the same, 1 is returned, if there is an - * error, -1 is returned. '\0' characters are not treated in any special - * way. - */ -int bisstemeqcaselessblk (const_bstring b0, const void * blk, int len) { -int i; - - if (bdata (b0) == NULL || b0->slen < 0 || NULL == blk || len < 0) - return BSTR_ERR; - if (b0->slen < len) return BSTR_OK; - if (b0->data == (const unsigned char *) blk || len == 0) return 1; - - for (i = 0; i < len; i ++) { - if (b0->data[i] != ((const unsigned char *) blk)[i]) { - if (downcase (b0->data[i]) != - downcase (((const unsigned char *) blk)[i])) return 0; - } - } - return 1; -} - -/* - * int bltrimws (bstring b) - * - * Delete whitespace contiguous from the left end of the string. - */ -int bltrimws (bstring b) { -int i, len; - - if (b == NULL || b->data == NULL || b->mlen < b->slen || - b->slen < 0 || b->mlen <= 0) return BSTR_ERR; - - for (len = b->slen, i = 0; i < len; i++) { - if (!wspace (b->data[i])) { - return bdelete (b, 0, i); - } - } - - b->data[0] = (unsigned char) '\0'; - b->slen = 0; - return BSTR_OK; -} - -/* - * int brtrimws (bstring b) - * - * Delete whitespace contiguous from the right end of the string. - */ -int brtrimws (bstring b) { -int i; - - if (b == NULL || b->data == NULL || b->mlen < b->slen || - b->slen < 0 || b->mlen <= 0) return BSTR_ERR; - - for (i = b->slen - 1; i >= 0; i--) { - if (!wspace (b->data[i])) { - if (b->mlen > i) b->data[i+1] = (unsigned char) '\0'; - b->slen = i + 1; - return BSTR_OK; - } - } - - b->data[0] = (unsigned char) '\0'; - b->slen = 0; - return BSTR_OK; -} - -/* - * int btrimws (bstring b) - * - * Delete whitespace contiguous from both ends of the string. - */ -int btrimws (bstring b) { -int i, j; - - if (b == NULL || b->data == NULL || b->mlen < b->slen || - b->slen < 0 || b->mlen <= 0) return BSTR_ERR; - - for (i = b->slen - 1; i >= 0; i--) { - if (!wspace (b->data[i])) { - if (b->mlen > i) b->data[i+1] = (unsigned char) '\0'; - b->slen = i + 1; - for (j = 0; wspace (b->data[j]); j++) {} - return bdelete (b, 0, j); - } - } - - b->data[0] = (unsigned char) '\0'; - b->slen = 0; - return BSTR_OK; -} - -/* int biseq (const_bstring b0, const_bstring b1) - * - * Compare the string b0 and b1. If the strings differ, 0 is returned, if - * the strings are the same, 1 is returned, if there is an error, -1 is - * returned. If the length of the strings are different, this function is - * O(1). '\0' termination characters are not treated in any special way. - */ -int biseq (const_bstring b0, const_bstring b1) { - if (b0 == NULL || b1 == NULL || b0->data == NULL || b1->data == NULL || - b0->slen < 0 || b1->slen < 0) return BSTR_ERR; - if (b0->slen != b1->slen) return BSTR_OK; - if (b0->data == b1->data || b0->slen == 0) return 1; - return !bstr__memcmp (b0->data, b1->data, b0->slen); -} - -/* int bisstemeqblk (const_bstring b0, const void * blk, int len) - * - * Compare beginning of string b0 with a block of memory of length len for - * equality. If the beginning of b0 differs from the memory block (or if b0 - * is too short), 0 is returned, if the strings are the same, 1 is returned, - * if there is an error, -1 is returned. '\0' characters are not treated in - * any special way. - */ -int bisstemeqblk (const_bstring b0, const void * blk, int len) { -int i; - - if (bdata (b0) == NULL || b0->slen < 0 || NULL == blk || len < 0) - return BSTR_ERR; - if (b0->slen < len) return BSTR_OK; - if (b0->data == (const unsigned char *) blk || len == 0) return 1; - - for (i = 0; i < len; i ++) { - if (b0->data[i] != ((const unsigned char *) blk)[i]) return BSTR_OK; - } - return 1; -} - -/* int biseqcstr (const_bstring b, const char *s) - * - * Compare the bstring b and char * string s. The C string s must be '\0' - * terminated at exactly the length of the bstring b, and the contents - * between the two must be identical with the bstring b with no '\0' - * characters for the two contents to be considered equal. This is - * equivalent to the condition that their current contents will be always be - * equal when comparing them in the same format after converting one or the - * other. If the strings are equal 1 is returned, if they are unequal 0 is - * returned and if there is a detectable error BSTR_ERR is returned. - */ -int biseqcstr (const_bstring b, const char * s) { -int i; - if (b == NULL || s == NULL || b->data == NULL || b->slen < 0) return BSTR_ERR; - for (i=0; i < b->slen; i++) { - if (s[i] == '\0' || b->data[i] != (unsigned char) s[i]) return BSTR_OK; - } - return s[i] == '\0'; -} - -/* int biseqcstrcaseless (const_bstring b, const char *s) - * - * Compare the bstring b and char * string s. The C string s must be '\0' - * terminated at exactly the length of the bstring b, and the contents - * between the two must be identical except for case with the bstring b with - * no '\0' characters for the two contents to be considered equal. This is - * equivalent to the condition that their current contents will be always be - * equal ignoring case when comparing them in the same format after - * converting one or the other. If the strings are equal, except for case, - * 1 is returned, if they are unequal regardless of case 0 is returned and - * if there is a detectable error BSTR_ERR is returned. - */ -int biseqcstrcaseless (const_bstring b, const char * s) { -int i; - if (b == NULL || s == NULL || b->data == NULL || b->slen < 0) return BSTR_ERR; - for (i=0; i < b->slen; i++) { - if (s[i] == '\0' || - (b->data[i] != (unsigned char) s[i] && - downcase (b->data[i]) != (unsigned char) downcase (s[i]))) - return BSTR_OK; - } - return s[i] == '\0'; -} - -/* int bstrcmp (const_bstring b0, const_bstring b1) - * - * Compare the string b0 and b1. If there is an error, SHRT_MIN is returned, - * otherwise a value less than or greater than zero, indicating that the - * string pointed to by b0 is lexicographically less than or greater than - * the string pointed to by b1 is returned. If the the string lengths are - * unequal but the characters up until the length of the shorter are equal - * then a value less than, or greater than zero, indicating that the string - * pointed to by b0 is shorter or longer than the string pointed to by b1 is - * returned. 0 is returned if and only if the two strings are the same. If - * the length of the strings are different, this function is O(n). Like its - * standard C library counter part strcmp, the comparison does not proceed - * past any '\0' termination characters encountered. - */ -int bstrcmp (const_bstring b0, const_bstring b1) { -int i, v, n; - - if (b0 == NULL || b1 == NULL || b0->data == NULL || b1->data == NULL || - b0->slen < 0 || b1->slen < 0) return SHRT_MIN; - n = b0->slen; if (n > b1->slen) n = b1->slen; - if (b0->slen == b1->slen && (b0->data == b1->data || b0->slen == 0)) - return BSTR_OK; - - for (i = 0; i < n; i ++) { - v = ((char) b0->data[i]) - ((char) b1->data[i]); - if (v != 0) return v; - if (b0->data[i] == (unsigned char) '\0') return BSTR_OK; - } - - if (b0->slen > n) return 1; - if (b1->slen > n) return -1; - return BSTR_OK; -} - -/* int bstrncmp (const_bstring b0, const_bstring b1, int n) - * - * Compare the string b0 and b1 for at most n characters. If there is an - * error, SHRT_MIN is returned, otherwise a value is returned as if b0 and - * b1 were first truncated to at most n characters then bstrcmp was called - * with these new strings are paremeters. If the length of the strings are - * different, this function is O(n). Like its standard C library counter - * part strcmp, the comparison does not proceed past any '\0' termination - * characters encountered. - */ -int bstrncmp (const_bstring b0, const_bstring b1, int n) { -int i, v, m; - - if (b0 == NULL || b1 == NULL || b0->data == NULL || b1->data == NULL || - b0->slen < 0 || b1->slen < 0) return SHRT_MIN; - m = n; - if (m > b0->slen) m = b0->slen; - if (m > b1->slen) m = b1->slen; - - if (b0->data != b1->data) { - for (i = 0; i < m; i ++) { - v = ((char) b0->data[i]) - ((char) b1->data[i]); - if (v != 0) return v; - if (b0->data[i] == (unsigned char) '\0') return BSTR_OK; - } - } - - if (n == m || b0->slen == b1->slen) return BSTR_OK; - - if (b0->slen > m) return 1; - return -1; -} - -/* bstring bmidstr (const_bstring b, int left, int len) - * - * Create a bstring which is the substring of b starting from position left - * and running for a length len (clamped by the end of the bstring b.) If - * b is detectably invalid, then NULL is returned. The section described - * by (left, len) is clamped to the boundaries of b. - */ -bstring bmidstr (const_bstring b, int left, int len) { - - if (b == NULL || b->slen < 0 || b->data == NULL) return NULL; - - if (left < 0) { - len += left; - left = 0; - } - - if (len > b->slen - left) len = b->slen - left; - - if (len <= 0) return bfromcstr (""); - return blk2bstr (b->data + left, len); -} - -/* int bdelete (bstring b, int pos, int len) - * - * Removes characters from pos to pos+len-1 inclusive and shifts the tail of - * the bstring starting from pos+len to pos. len must be positive for this - * call to have any effect. The section of the string described by (pos, - * len) is clamped to boundaries of the bstring b. - */ -int bdelete (bstring b, int pos, int len) { - /* Clamp to left side of bstring */ - if (pos < 0) { - len += pos; - pos = 0; - } - - if (len < 0 || b == NULL || b->data == NULL || b->slen < 0 || - b->mlen < b->slen || b->mlen <= 0) - return BSTR_ERR; - if (len > 0 && pos < b->slen) { - if (pos + len >= b->slen) { - b->slen = pos; - } else { - bBlockCopy ((char *) (b->data + pos), - (char *) (b->data + pos + len), - b->slen - (pos+len)); - b->slen -= len; - } - b->data[b->slen] = (unsigned char) '\0'; - } - return BSTR_OK; -} - -/* int bdestroy (bstring b) - * - * Free up the bstring. Note that if b is detectably invalid or not writable - * then no action is performed and BSTR_ERR is returned. Like a freed memory - * allocation, dereferences, writes or any other action on b after it has - * been bdestroyed is undefined. - */ -int bdestroy (bstring b) { - if (b == NULL || b->slen < 0 || b->mlen <= 0 || b->mlen < b->slen || - b->data == NULL) - return BSTR_ERR; - - bstr__free (b->data); - - /* In case there is any stale usage, there is one more chance to - notice this error. */ - - b->slen = -1; - b->mlen = -__LINE__; - b->data = NULL; - - bstr__free (b); - return BSTR_OK; -} - -/* int binstr (const_bstring b1, int pos, const_bstring b2) - * - * Search for the bstring b2 in b1 starting from position pos, and searching - * forward. If it is found then return with the first position where it is - * found, otherwise return BSTR_ERR. Note that this is just a brute force - * string searcher that does not attempt clever things like the Boyer-Moore - * search algorithm. Because of this there are many degenerate cases where - * this can take much longer than it needs to. - */ -int binstr (const_bstring b1, int pos, const_bstring b2) { -int j, ii, ll, lf; -unsigned char * d0; -unsigned char c0; -register unsigned char * d1; -register unsigned char c1; -register int i; - - if (b1 == NULL || b1->data == NULL || b1->slen < 0 || - b2 == NULL || b2->data == NULL || b2->slen < 0) return BSTR_ERR; - if (b1->slen == pos) return (b2->slen == 0)?pos:BSTR_ERR; - if (b1->slen < pos || pos < 0) return BSTR_ERR; - if (b2->slen == 0) return pos; - - /* No space to find such a string? */ - if ((lf = b1->slen - b2->slen + 1) <= pos) return BSTR_ERR; - - /* An obvious alias case */ - if (b1->data == b2->data && pos == 0) return 0; - - i = pos; - - d0 = b2->data; - d1 = b1->data; - ll = b2->slen; - - /* Peel off the b2->slen == 1 case */ - c0 = d0[0]; - if (1 == ll) { - for (;i < lf; i++) if (c0 == d1[i]) return i; - return BSTR_ERR; - } - - c1 = c0; - j = 0; - lf = b1->slen - 1; - - ii = -1; - if (i < lf) do { - /* Unrolled current character test */ - if (c1 != d1[i]) { - if (c1 != d1[1+i]) { - i += 2; - continue; - } - i++; - } - - /* Take note if this is the start of a potential match */ - if (0 == j) ii = i; - - /* Shift the test character down by one */ - j++; - i++; - - /* If this isn't past the last character continue */ - if (j < ll) { - c1 = d0[j]; - continue; - } - - N0:; - - /* If no characters mismatched, then we matched */ - if (i == ii+j) return ii; - - /* Shift back to the beginning */ - i -= j; - j = 0; - c1 = c0; - } while (i < lf); - - /* Deal with last case if unrolling caused a misalignment */ - if (i == lf && ll == j+1 && c1 == d1[i]) goto N0; - - return BSTR_ERR; -} - -/* int binstrr (const_bstring b1, int pos, const_bstring b2) - * - * Search for the bstring b2 in b1 starting from position pos, and searching - * backward. If it is found then return with the first position where it is - * found, otherwise return BSTR_ERR. Note that this is just a brute force - * string searcher that does not attempt clever things like the Boyer-Moore - * search algorithm. Because of this there are many degenerate cases where - * this can take much longer than it needs to. - */ -int binstrr (const_bstring b1, int pos, const_bstring b2) { -int j, i, l; -unsigned char * d0, * d1; - - if (b1 == NULL || b1->data == NULL || b1->slen < 0 || - b2 == NULL || b2->data == NULL || b2->slen < 0) return BSTR_ERR; - if (b1->slen == pos && b2->slen == 0) return pos; - if (b1->slen < pos || pos < 0) return BSTR_ERR; - if (b2->slen == 0) return pos; - - /* Obvious alias case */ - if (b1->data == b2->data && pos == 0 && b2->slen <= b1->slen) return 0; - - i = pos; - if ((l = b1->slen - b2->slen) < 0) return BSTR_ERR; - - /* If no space to find such a string then snap back */ - if (l + 1 <= i) i = l; - j = 0; - - d0 = b2->data; - d1 = b1->data; - l = b2->slen; - - for (;;) { - if (d0[j] == d1[i + j]) { - j ++; - if (j >= l) return i; - } else { - i --; - if (i < 0) break; - j=0; - } - } - - return BSTR_ERR; -} - -/* int binstrcaseless (const_bstring b1, int pos, const_bstring b2) - * - * Search for the bstring b2 in b1 starting from position pos, and searching - * forward but without regard to case. If it is found then return with the - * first position where it is found, otherwise return BSTR_ERR. Note that - * this is just a brute force string searcher that does not attempt clever - * things like the Boyer-Moore search algorithm. Because of this there are - * many degenerate cases where this can take much longer than it needs to. - */ -int binstrcaseless (const_bstring b1, int pos, const_bstring b2) { -int j, i, l, ll; -unsigned char * d0, * d1; - - if (b1 == NULL || b1->data == NULL || b1->slen < 0 || - b2 == NULL || b2->data == NULL || b2->slen < 0) return BSTR_ERR; - if (b1->slen == pos) return (b2->slen == 0)?pos:BSTR_ERR; - if (b1->slen < pos || pos < 0) return BSTR_ERR; - if (b2->slen == 0) return pos; - - l = b1->slen - b2->slen + 1; - - /* No space to find such a string? */ - if (l <= pos) return BSTR_ERR; - - /* An obvious alias case */ - if (b1->data == b2->data && pos == 0) return BSTR_OK; - - i = pos; - j = 0; - - d0 = b2->data; - d1 = b1->data; - ll = b2->slen; - - for (;;) { - if (d0[j] == d1[i + j] || downcase (d0[j]) == downcase (d1[i + j])) { - j ++; - if (j >= ll) return i; - } else { - i ++; - if (i >= l) break; - j=0; - } - } - - return BSTR_ERR; -} - -/* int binstrrcaseless (const_bstring b1, int pos, const_bstring b2) - * - * Search for the bstring b2 in b1 starting from position pos, and searching - * backward but without regard to case. If it is found then return with the - * first position where it is found, otherwise return BSTR_ERR. Note that - * this is just a brute force string searcher that does not attempt clever - * things like the Boyer-Moore search algorithm. Because of this there are - * many degenerate cases where this can take much longer than it needs to. - */ -int binstrrcaseless (const_bstring b1, int pos, const_bstring b2) { -int j, i, l; -unsigned char * d0, * d1; - - if (b1 == NULL || b1->data == NULL || b1->slen < 0 || - b2 == NULL || b2->data == NULL || b2->slen < 0) return BSTR_ERR; - if (b1->slen == pos && b2->slen == 0) return pos; - if (b1->slen < pos || pos < 0) return BSTR_ERR; - if (b2->slen == 0) return pos; - - /* Obvious alias case */ - if (b1->data == b2->data && pos == 0 && b2->slen <= b1->slen) return BSTR_OK; - - i = pos; - if ((l = b1->slen - b2->slen) < 0) return BSTR_ERR; - - /* If no space to find such a string then snap back */ - if (l + 1 <= i) i = l; - j = 0; - - d0 = b2->data; - d1 = b1->data; - l = b2->slen; - - for (;;) { - if (d0[j] == d1[i + j] || downcase (d0[j]) == downcase (d1[i + j])) { - j ++; - if (j >= l) return i; - } else { - i --; - if (i < 0) break; - j=0; - } - } - - return BSTR_ERR; -} - - -/* int bstrchrp (const_bstring b, int c, int pos) - * - * Search for the character c in b forwards from the position pos - * (inclusive). - */ -int bstrchrp (const_bstring b, int c, int pos) { -unsigned char * p; - - if (b == NULL || b->data == NULL || b->slen <= pos || pos < 0) return BSTR_ERR; - p = (unsigned char *) bstr__memchr ((b->data + pos), (unsigned char) c, (b->slen - pos)); - if (p) return (int) (p - b->data); - return BSTR_ERR; -} - -/* int bstrrchrp (const_bstring b, int c, int pos) - * - * Search for the character c in b backwards from the position pos in string - * (inclusive). - */ -int bstrrchrp (const_bstring b, int c, int pos) { -int i; - - if (b == NULL || b->data == NULL || b->slen <= pos || pos < 0) return BSTR_ERR; - for (i=pos; i >= 0; i--) { - if (b->data[i] == (unsigned char) c) return i; - } - return BSTR_ERR; -} - -#if !defined (BSTRLIB_AGGRESSIVE_MEMORY_FOR_SPEED_TRADEOFF) -#define LONG_LOG_BITS_QTY (3) -#define LONG_BITS_QTY (1 << LONG_LOG_BITS_QTY) -#define LONG_TYPE unsigned char - -#define CFCLEN ((1 << CHAR_BIT) / LONG_BITS_QTY) -struct charField { LONG_TYPE content[CFCLEN]; }; -#define testInCharField(cf,c) ((cf)->content[(c) >> LONG_LOG_BITS_QTY] & (((long)1) << ((c) & (LONG_BITS_QTY-1)))) -#define setInCharField(cf,idx) { \ - unsigned int c = (unsigned int) (idx); \ - (cf)->content[c >> LONG_LOG_BITS_QTY] |= (LONG_TYPE) (1ul << (c & (LONG_BITS_QTY-1))); \ -} - -#else - -#define CFCLEN (1 << CHAR_BIT) -struct charField { unsigned char content[CFCLEN]; }; -#define testInCharField(cf,c) ((cf)->content[(unsigned char) (c)]) -#define setInCharField(cf,idx) (cf)->content[(unsigned int) (idx)] = ~0 - -#endif - -/* Convert a bstring to charField */ -static int buildCharField (struct charField * cf, const_bstring b) { -int i; - if (b == NULL || b->data == NULL || b->slen <= 0) return BSTR_ERR; - memset ((void *) cf->content, 0, sizeof (struct charField)); - for (i=0; i < b->slen; i++) { - setInCharField (cf, b->data[i]); - } - return BSTR_OK; -} - -static void invertCharField (struct charField * cf) { -int i; - for (i=0; i < CFCLEN; i++) cf->content[i] = ~cf->content[i]; -} - -/* Inner engine for binchr */ -static int binchrCF (const unsigned char * data, int len, int pos, const struct charField * cf) { -int i; - for (i=pos; i < len; i++) { - unsigned char c = (unsigned char) data[i]; - if (testInCharField (cf, c)) return i; - } - return BSTR_ERR; -} - -/* int binchr (const_bstring b0, int pos, const_bstring b1); - * - * Search for the first position in b0 starting from pos or after, in which - * one of the characters in b1 is found and return it. If such a position - * does not exist in b0, then BSTR_ERR is returned. - */ -int binchr (const_bstring b0, int pos, const_bstring b1) { -struct charField chrs; - if (pos < 0 || b0 == NULL || b0->data == NULL || - b0->slen <= pos) return BSTR_ERR; - if (1 == b1->slen) return bstrchrp (b0, b1->data[0], pos); - if (0 > buildCharField (&chrs, b1)) return BSTR_ERR; - return binchrCF (b0->data, b0->slen, pos, &chrs); -} - -/* Inner engine for binchrr */ -static int binchrrCF (const unsigned char * data, int pos, const struct charField * cf) { -int i; - for (i=pos; i >= 0; i--) { - unsigned int c = (unsigned int) data[i]; - if (testInCharField (cf, c)) return i; - } - return BSTR_ERR; -} - -/* int binchrr (const_bstring b0, int pos, const_bstring b1); - * - * Search for the last position in b0 no greater than pos, in which one of - * the characters in b1 is found and return it. If such a position does not - * exist in b0, then BSTR_ERR is returned. - */ -int binchrr (const_bstring b0, int pos, const_bstring b1) { -struct charField chrs; - if (pos < 0 || b0 == NULL || b0->data == NULL || b1 == NULL || - b0->slen < pos) return BSTR_ERR; - if (pos == b0->slen) pos--; - if (1 == b1->slen) return bstrrchrp (b0, b1->data[0], pos); - if (0 > buildCharField (&chrs, b1)) return BSTR_ERR; - return binchrrCF (b0->data, pos, &chrs); -} - -/* int bninchr (const_bstring b0, int pos, const_bstring b1); - * - * Search for the first position in b0 starting from pos or after, in which - * none of the characters in b1 is found and return it. If such a position - * does not exist in b0, then BSTR_ERR is returned. - */ -int bninchr (const_bstring b0, int pos, const_bstring b1) { -struct charField chrs; - if (pos < 0 || b0 == NULL || b0->data == NULL || - b0->slen <= pos) return BSTR_ERR; - if (buildCharField (&chrs, b1) < 0) return BSTR_ERR; - invertCharField (&chrs); - return binchrCF (b0->data, b0->slen, pos, &chrs); -} - -/* int bninchrr (const_bstring b0, int pos, const_bstring b1); - * - * Search for the last position in b0 no greater than pos, in which none of - * the characters in b1 is found and return it. If such a position does not - * exist in b0, then BSTR_ERR is returned. - */ -int bninchrr (const_bstring b0, int pos, const_bstring b1) { -struct charField chrs; - if (pos < 0 || b0 == NULL || b0->data == NULL || - b0->slen < pos) return BSTR_ERR; - if (pos == b0->slen) pos--; - if (buildCharField (&chrs, b1) < 0) return BSTR_ERR; - invertCharField (&chrs); - return binchrrCF (b0->data, pos, &chrs); -} - -/* int bsetstr (bstring b0, int pos, bstring b1, unsigned char fill) - * - * Overwrite the string b0 starting at position pos with the string b1. If - * the position pos is past the end of b0, then the character "fill" is - * appended as necessary to make up the gap between the end of b0 and pos. - * If b1 is NULL, it behaves as if it were a 0-length string. - */ -int bsetstr (bstring b0, int pos, const_bstring b1, unsigned char fill) { -int d, newlen; -ptrdiff_t pd; -bstring aux = (bstring) b1; - - if (pos < 0 || b0 == NULL || b0->slen < 0 || NULL == b0->data || - b0->mlen < b0->slen || b0->mlen <= 0) return BSTR_ERR; - if (b1 != NULL && (b1->slen < 0 || b1->data == NULL)) return BSTR_ERR; - - d = pos; - - /* Aliasing case */ - if (NULL != aux) { - if ((pd = (ptrdiff_t) (b1->data - b0->data)) >= 0 && pd < (ptrdiff_t) b0->mlen) { - if (NULL == (aux = bstrcpy (b1))) return BSTR_ERR; - } - d += aux->slen; - } - - /* Increase memory size if necessary */ - if (balloc (b0, d + 1) != BSTR_OK) { - if (aux != b1) bdestroy (aux); - return BSTR_ERR; - } - - newlen = b0->slen; - - /* Fill in "fill" character as necessary */ - if (pos > newlen) { - bstr__memset (b0->data + b0->slen, (int) fill, (size_t) (pos - b0->slen)); - newlen = pos; - } - - /* Copy b1 to position pos in b0. */ - if (aux != NULL) { - bBlockCopy ((char *) (b0->data + pos), (char *) aux->data, aux->slen); - if (aux != b1) bdestroy (aux); - } - - /* Indicate the potentially increased size of b0 */ - if (d > newlen) newlen = d; - - b0->slen = newlen; - b0->data[newlen] = (unsigned char) '\0'; - - return BSTR_OK; -} - -/* int binsert (bstring b1, int pos, bstring b2, unsigned char fill) - * - * Inserts the string b2 into b1 at position pos. If the position pos is - * past the end of b1, then the character "fill" is appended as necessary to - * make up the gap between the end of b1 and pos. Unlike bsetstr, binsert - * does not allow b2 to be NULL. - */ -int binsert (bstring b1, int pos, const_bstring b2, unsigned char fill) { -int d, l; -ptrdiff_t pd; -bstring aux = (bstring) b2; - - if (pos < 0 || b1 == NULL || b2 == NULL || b1->slen < 0 || - b2->slen < 0 || b1->mlen < b1->slen || b1->mlen <= 0) return BSTR_ERR; - - /* Aliasing case */ - if ((pd = (ptrdiff_t) (b2->data - b1->data)) >= 0 && pd < (ptrdiff_t) b1->mlen) { - if (NULL == (aux = bstrcpy (b2))) return BSTR_ERR; - } - - /* Compute the two possible end pointers */ - d = b1->slen + aux->slen; - l = pos + aux->slen; - if ((d|l) < 0) return BSTR_ERR; - - if (l > d) { - /* Inserting past the end of the string */ - if (balloc (b1, l + 1) != BSTR_OK) { - if (aux != b2) bdestroy (aux); - return BSTR_ERR; - } - bstr__memset (b1->data + b1->slen, (int) fill, (size_t) (pos - b1->slen)); - b1->slen = l; - } else { - /* Inserting in the middle of the string */ - if (balloc (b1, d + 1) != BSTR_OK) { - if (aux != b2) bdestroy (aux); - return BSTR_ERR; - } - bBlockCopy (b1->data + l, b1->data + pos, d - l); - b1->slen = d; - } - bBlockCopy (b1->data + pos, aux->data, aux->slen); - b1->data[b1->slen] = (unsigned char) '\0'; - if (aux != b2) bdestroy (aux); - return BSTR_OK; -} - -/* int breplace (bstring b1, int pos, int len, bstring b2, - * unsigned char fill) - * - * Replace a section of a string from pos for a length len with the string b2. - * fill is used is pos > b1->slen. - */ -int breplace (bstring b1, int pos, int len, const_bstring b2, - unsigned char fill) { -int pl, ret; -ptrdiff_t pd; -bstring aux = (bstring) b2; - - if (pos < 0 || len < 0 || (pl = pos + len) < 0 || b1 == NULL || - b2 == NULL || b1->data == NULL || b2->data == NULL || - b1->slen < 0 || b2->slen < 0 || b1->mlen < b1->slen || - b1->mlen <= 0) return BSTR_ERR; - - /* Straddles the end? */ - if (pl >= b1->slen) { - if ((ret = bsetstr (b1, pos, b2, fill)) < 0) return ret; - if (pos + b2->slen < b1->slen) { - b1->slen = pos + b2->slen; - b1->data[b1->slen] = (unsigned char) '\0'; - } - return ret; - } - - /* Aliasing case */ - if ((pd = (ptrdiff_t) (b2->data - b1->data)) >= 0 && pd < (ptrdiff_t) b1->slen) { - if (NULL == (aux = bstrcpy (b2))) return BSTR_ERR; - } - - if (aux->slen > len) { - if (balloc (b1, b1->slen + aux->slen - len) != BSTR_OK) { - if (aux != b2) bdestroy (aux); - return BSTR_ERR; - } - } - - if (aux->slen != len) bstr__memmove (b1->data + pos + aux->slen, b1->data + pos + len, b1->slen - (pos + len)); - bstr__memcpy (b1->data + pos, aux->data, aux->slen); - b1->slen += aux->slen - len; - b1->data[b1->slen] = (unsigned char) '\0'; - if (aux != b2) bdestroy (aux); - return BSTR_OK; -} - -/* - * findreplaceengine is used to implement bfindreplace and - * bfindreplacecaseless. It works by breaking the three cases of - * expansion, reduction and replacement, and solving each of these - * in the most efficient way possible. - */ - -typedef int (*instr_fnptr) (const_bstring s1, int pos, const_bstring s2); - -#define INITIAL_STATIC_FIND_INDEX_COUNT 32 - -static int findreplaceengine (bstring b, const_bstring find, const_bstring repl, int pos, instr_fnptr instr) { -int i, ret, slen, mlen, delta, acc; -int * d; -int static_d[INITIAL_STATIC_FIND_INDEX_COUNT+1]; /* This +1 is unnecessary, but it shuts up LINT. */ -ptrdiff_t pd; -bstring auxf = (bstring) find; -bstring auxr = (bstring) repl; - - if (b == NULL || b->data == NULL || find == NULL || - find->data == NULL || repl == NULL || repl->data == NULL || - pos < 0 || find->slen <= 0 || b->mlen < 0 || b->slen > b->mlen || - b->mlen <= 0 || b->slen < 0 || repl->slen < 0) return BSTR_ERR; - if (pos > b->slen - find->slen) return BSTR_OK; - - /* Alias with find string */ - pd = (ptrdiff_t) (find->data - b->data); - if ((ptrdiff_t) (pos - find->slen) < pd && pd < (ptrdiff_t) b->slen) { - if (NULL == (auxf = bstrcpy (find))) return BSTR_ERR; - } - - /* Alias with repl string */ - pd = (ptrdiff_t) (repl->data - b->data); - if ((ptrdiff_t) (pos - repl->slen) < pd && pd < (ptrdiff_t) b->slen) { - if (NULL == (auxr = bstrcpy (repl))) { - if (auxf != find) bdestroy (auxf); - return BSTR_ERR; - } - } - - delta = auxf->slen - auxr->slen; - - /* in-place replacement since find and replace strings are of equal - length */ - if (delta == 0) { - while ((pos = instr (b, pos, auxf)) >= 0) { - bstr__memcpy (b->data + pos, auxr->data, auxr->slen); - pos += auxf->slen; - } - if (auxf != find) bdestroy (auxf); - if (auxr != repl) bdestroy (auxr); - return BSTR_OK; - } - - /* shrinking replacement since auxf->slen > auxr->slen */ - if (delta > 0) { - acc = 0; - - while ((i = instr (b, pos, auxf)) >= 0) { - if (acc && i > pos) - bstr__memmove (b->data + pos - acc, b->data + pos, i - pos); - if (auxr->slen) - bstr__memcpy (b->data + i - acc, auxr->data, auxr->slen); - acc += delta; - pos = i + auxf->slen; - } - - if (acc) { - i = b->slen; - if (i > pos) - bstr__memmove (b->data + pos - acc, b->data + pos, i - pos); - b->slen -= acc; - b->data[b->slen] = (unsigned char) '\0'; - } - - if (auxf != find) bdestroy (auxf); - if (auxr != repl) bdestroy (auxr); - return BSTR_OK; - } - - /* expanding replacement since find->slen < repl->slen. Its a lot - more complicated. This works by first finding all the matches and - storing them to a growable array, then doing at most one resize of - the destination bstring and then performing the direct memory transfers - of the string segment pieces to form the final result. The growable - array of matches uses a deferred doubling reallocing strategy. What - this means is that it starts as a reasonably fixed sized auto array in - the hopes that many if not most cases will never need to grow this - array. But it switches as soon as the bounds of the array will be - exceeded. An extra find result is always appended to this array that - corresponds to the end of the destination string, so slen is checked - against mlen - 1 rather than mlen before resizing. - */ - - mlen = INITIAL_STATIC_FIND_INDEX_COUNT; - d = (int *) static_d; /* Avoid malloc for trivial/initial cases */ - acc = slen = 0; - - while ((pos = instr (b, pos, auxf)) >= 0) { - if (slen >= mlen - 1) { - int sl, *t; - - mlen += mlen; - sl = sizeof (int *) * mlen; - if (static_d == d) d = NULL; /* static_d cannot be realloced */ - if (mlen <= 0 || sl < mlen || NULL == (t = (int *) bstr__realloc (d, sl))) { - ret = BSTR_ERR; - goto done; - } - if (NULL == d) bstr__memcpy (t, static_d, sizeof (static_d)); - d = t; - } - d[slen] = pos; - slen++; - acc -= delta; - pos += auxf->slen; - if (pos < 0 || acc < 0) { - ret = BSTR_ERR; - goto done; - } - } - - /* slen <= INITIAL_STATIC_INDEX_COUNT-1 or mlen-1 here. */ - d[slen] = b->slen; - - if (BSTR_OK == (ret = balloc (b, b->slen + acc + 1))) { - b->slen += acc; - for (i = slen-1; i >= 0; i--) { - int s, l; - s = d[i] + auxf->slen; - l = d[i+1] - s; /* d[slen] may be accessed here. */ - if (l) { - bstr__memmove (b->data + s + acc, b->data + s, l); - } - if (auxr->slen) { - bstr__memmove (b->data + s + acc - auxr->slen, - auxr->data, auxr->slen); - } - acc += delta; - } - b->data[b->slen] = (unsigned char) '\0'; - } - - done:; - if (static_d == d) d = NULL; - bstr__free (d); - if (auxf != find) bdestroy (auxf); - if (auxr != repl) bdestroy (auxr); - return ret; -} - -/* int bfindreplace (bstring b, const_bstring find, const_bstring repl, - * int pos) - * - * Replace all occurrences of a find string with a replace string after a - * given point in a bstring. - */ -int bfindreplace (bstring b, const_bstring find, const_bstring repl, int pos) { - return findreplaceengine (b, find, repl, pos, binstr); -} - -/* int bfindreplacecaseless (bstring b, const_bstring find, const_bstring repl, - * int pos) - * - * Replace all occurrences of a find string, ignoring case, with a replace - * string after a given point in a bstring. - */ -int bfindreplacecaseless (bstring b, const_bstring find, const_bstring repl, int pos) { - return findreplaceengine (b, find, repl, pos, binstrcaseless); -} - -/* int binsertch (bstring b, int pos, int len, unsigned char fill) - * - * Inserts the character fill repeatedly into b at position pos for a - * length len. If the position pos is past the end of b, then the - * character "fill" is appended as necessary to make up the gap between the - * end of b and the position pos + len. - */ -int binsertch (bstring b, int pos, int len, unsigned char fill) { -int d, l, i; - - if (pos < 0 || b == NULL || b->slen < 0 || b->mlen < b->slen || - b->mlen <= 0 || len < 0) return BSTR_ERR; - - /* Compute the two possible end pointers */ - d = b->slen + len; - l = pos + len; - if ((d|l) < 0) return BSTR_ERR; - - if (l > d) { - /* Inserting past the end of the string */ - if (balloc (b, l + 1) != BSTR_OK) return BSTR_ERR; - pos = b->slen; - b->slen = l; - } else { - /* Inserting in the middle of the string */ - if (balloc (b, d + 1) != BSTR_OK) return BSTR_ERR; - for (i = d - 1; i >= l; i--) { - b->data[i] = b->data[i - len]; - } - b->slen = d; - } - - for (i=pos; i < l; i++) b->data[i] = fill; - b->data[b->slen] = (unsigned char) '\0'; - return BSTR_OK; -} - -/* int bpattern (bstring b, int len) - * - * Replicate the bstring, b in place, end to end repeatedly until it - * surpasses len characters, then chop the result to exactly len characters. - * This function operates in-place. The function will return with BSTR_ERR - * if b is NULL or of length 0, otherwise BSTR_OK is returned. - */ -int bpattern (bstring b, int len) { -int i, d; - - d = blength (b); - if (d <= 0 || len < 0 || balloc (b, len + 1) != BSTR_OK) return BSTR_ERR; - if (len > 0) { - if (d == 1) return bsetstr (b, len, NULL, b->data[0]); - for (i = d; i < len; i++) b->data[i] = b->data[i - d]; - } - b->data[len] = (unsigned char) '\0'; - b->slen = len; - return BSTR_OK; -} - -#define BS_BUFF_SZ (1024) - -/* int breada (bstring b, bNread readPtr, void * parm) - * - * Use a finite buffer fread-like function readPtr to concatenate to the - * bstring b the entire contents of file-like source data in a roughly - * efficient way. - */ -int breada (bstring b, bNread readPtr, void * parm) { -int i, l, n; - - if (b == NULL || b->mlen <= 0 || b->slen < 0 || b->mlen < b->slen || - b->mlen <= 0 || readPtr == NULL) return BSTR_ERR; - - i = b->slen; - for (n=i+16; ; n += ((n < BS_BUFF_SZ) ? n : BS_BUFF_SZ)) { - if (BSTR_OK != balloc (b, n + 1)) return BSTR_ERR; - l = (int) readPtr ((void *) (b->data + i), 1, n - i, parm); - i += l; - b->slen = i; - if (i < n) break; - } - - b->data[i] = (unsigned char) '\0'; - return BSTR_OK; -} - -/* bstring bread (bNread readPtr, void * parm) - * - * Use a finite buffer fread-like function readPtr to create a bstring - * filled with the entire contents of file-like source data in a roughly - * efficient way. - */ -bstring bread (bNread readPtr, void * parm) { -bstring buff; - - if (0 > breada (buff = bfromcstr (""), readPtr, parm)) { - bdestroy (buff); - return NULL; - } - return buff; -} - -/* int bassigngets (bstring b, bNgetc getcPtr, void * parm, char terminator) - * - * Use an fgetc-like single character stream reading function (getcPtr) to - * obtain a sequence of characters which are concatenated to the end of the - * bstring b. The stream read is terminated by the passed in terminator - * parameter. - * - * If getcPtr returns with a negative number, or the terminator character - * (which is appended) is read, then the stream reading is halted and the - * function returns with a partial result in b. If there is an empty partial - * result, 1 is returned. If no characters are read, or there is some other - * detectable error, BSTR_ERR is returned. - */ -int bassigngets (bstring b, bNgetc getcPtr, void * parm, char terminator) { -int c, d, e; - - if (b == NULL || b->mlen <= 0 || b->slen < 0 || b->mlen < b->slen || - b->mlen <= 0 || getcPtr == NULL) return BSTR_ERR; - d = 0; - e = b->mlen - 2; - - while ((c = getcPtr (parm)) >= 0) { - if (d > e) { - b->slen = d; - if (balloc (b, d + 2) != BSTR_OK) return BSTR_ERR; - e = b->mlen - 2; - } - b->data[d] = (unsigned char) c; - d++; - if (c == terminator) break; - } - - b->data[d] = (unsigned char) '\0'; - b->slen = d; - - return d == 0 && c < 0; -} - -/* int bgetsa (bstring b, bNgetc getcPtr, void * parm, char terminator) - * - * Use an fgetc-like single character stream reading function (getcPtr) to - * obtain a sequence of characters which are concatenated to the end of the - * bstring b. The stream read is terminated by the passed in terminator - * parameter. - * - * If getcPtr returns with a negative number, or the terminator character - * (which is appended) is read, then the stream reading is halted and the - * function returns with a partial result concatentated to b. If there is - * an empty partial result, 1 is returned. If no characters are read, or - * there is some other detectable error, BSTR_ERR is returned. - */ -int bgetsa (bstring b, bNgetc getcPtr, void * parm, char terminator) { -int c, d, e; - - if (b == NULL || b->mlen <= 0 || b->slen < 0 || b->mlen < b->slen || - b->mlen <= 0 || getcPtr == NULL) return BSTR_ERR; - d = b->slen; - e = b->mlen - 2; - - while ((c = getcPtr (parm)) >= 0) { - if (d > e) { - b->slen = d; - if (balloc (b, d + 2) != BSTR_OK) return BSTR_ERR; - e = b->mlen - 2; - } - b->data[d] = (unsigned char) c; - d++; - if (c == terminator) break; - } - - b->data[d] = (unsigned char) '\0'; - b->slen = d; - - return d == 0 && c < 0; -} - -/* bstring bgets (bNgetc getcPtr, void * parm, char terminator) - * - * Use an fgetc-like single character stream reading function (getcPtr) to - * obtain a sequence of characters which are concatenated into a bstring. - * The stream read is terminated by the passed in terminator function. - * - * If getcPtr returns with a negative number, or the terminator character - * (which is appended) is read, then the stream reading is halted and the - * result obtained thus far is returned. If no characters are read, or - * there is some other detectable error, NULL is returned. - */ -bstring bgets (bNgetc getcPtr, void * parm, char terminator) { -bstring buff; - - if (0 > bgetsa (buff = bfromcstr (""), getcPtr, parm, terminator) || 0 >= buff->slen) { - bdestroy (buff); - buff = NULL; - } - return buff; -} - -struct bStream { - bstring buff; /* Buffer for over-reads */ - void * parm; /* The stream handle for core stream */ - bNread readFnPtr; /* fread compatible fnptr for core stream */ - int isEOF; /* track file's EOF state */ - int maxBuffSz; -}; - -/* struct bStream * bsopen (bNread readPtr, void * parm) - * - * Wrap a given open stream (described by a fread compatible function - * pointer and stream handle) into an open bStream suitable for the bstring - * library streaming functions. - */ -struct bStream * bsopen (bNread readPtr, void * parm) { -struct bStream * s; - - if (readPtr == NULL) return NULL; - s = (struct bStream *) bstr__alloc (sizeof (struct bStream)); - if (s == NULL) return NULL; - s->parm = parm; - s->buff = bfromcstr (""); - s->readFnPtr = readPtr; - s->maxBuffSz = BS_BUFF_SZ; - s->isEOF = 0; - return s; -} - -/* int bsbufflength (struct bStream * s, int sz) - * - * Set the length of the buffer used by the bStream. If sz is zero, the - * length is not set. This function returns with the previous length. - */ -int bsbufflength (struct bStream * s, int sz) { -int oldSz; - if (s == NULL || sz < 0) return BSTR_ERR; - oldSz = s->maxBuffSz; - if (sz > 0) s->maxBuffSz = sz; - return oldSz; -} - -int bseof (const struct bStream * s) { - if (s == NULL || s->readFnPtr == NULL) return BSTR_ERR; - return s->isEOF && (s->buff->slen == 0); -} - -/* void * bsclose (struct bStream * s) - * - * Close the bStream, and return the handle to the stream that was originally - * used to open the given stream. - */ -void * bsclose (struct bStream * s) { -void * parm; - if (s == NULL) return NULL; - s->readFnPtr = NULL; - if (s->buff) bdestroy (s->buff); - s->buff = NULL; - parm = s->parm; - s->parm = NULL; - s->isEOF = 1; - bstr__free (s); - return parm; -} - -/* int bsreadlna (bstring r, struct bStream * s, char terminator) - * - * Read a bstring terminated by the terminator character or the end of the - * stream from the bStream (s) and return it into the parameter r. This - * function may read additional characters from the core stream that are not - * returned, but will be retained for subsequent read operations. - */ -int bsreadlna (bstring r, struct bStream * s, char terminator) { -int i, l, ret, rlo; -char * b; -struct tagbstring x; - - if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 || - r->slen < 0 || r->mlen < r->slen) return BSTR_ERR; - l = s->buff->slen; - if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR; - b = (char *) s->buff->data; - x.data = (unsigned char *) b; - - /* First check if the current buffer holds the terminator */ - b[l] = terminator; /* Set sentinel */ - for (i=0; b[i] != terminator; i++) ; - if (i < l) { - x.slen = i + 1; - ret = bconcat (r, &x); - s->buff->slen = l; - if (BSTR_OK == ret) bdelete (s->buff, 0, i + 1); - return BSTR_OK; - } - - rlo = r->slen; - - /* If not then just concatenate the entire buffer to the output */ - x.slen = l; - if (BSTR_OK != bconcat (r, &x)) return BSTR_ERR; - - /* Perform direct in-place reads into the destination to allow for - the minimum of data-copies */ - for (;;) { - if (BSTR_OK != balloc (r, r->slen + s->maxBuffSz + 1)) return BSTR_ERR; - b = (char *) (r->data + r->slen); - l = (int) s->readFnPtr (b, 1, s->maxBuffSz, s->parm); - if (l <= 0) { - r->data[r->slen] = (unsigned char) '\0'; - s->buff->slen = 0; - s->isEOF = 1; - /* If nothing was read return with an error message */ - return BSTR_ERR & -(r->slen == rlo); - } - b[l] = terminator; /* Set sentinel */ - for (i=0; b[i] != terminator; i++) ; - if (i < l) break; - r->slen += l; - } - - /* Terminator found, push over-read back to buffer */ - i++; - r->slen += i; - s->buff->slen = l - i; - bstr__memcpy (s->buff->data, b + i, l - i); - r->data[r->slen] = (unsigned char) '\0'; - return BSTR_OK; -} - -/* int bsreadlnsa (bstring r, struct bStream * s, bstring term) - * - * Read a bstring terminated by any character in the term string or the end - * of the stream from the bStream (s) and return it into the parameter r. - * This function may read additional characters from the core stream that - * are not returned, but will be retained for subsequent read operations. - */ -int bsreadlnsa (bstring r, struct bStream * s, const_bstring term) { -int i, l, ret, rlo; -unsigned char * b; -struct tagbstring x; -struct charField cf; - - if (s == NULL || s->buff == NULL || r == NULL || term == NULL || - term->data == NULL || r->mlen <= 0 || r->slen < 0 || - r->mlen < r->slen) return BSTR_ERR; - if (term->slen == 1) return bsreadlna (r, s, term->data[0]); - if (term->slen < 1 || buildCharField (&cf, term)) return BSTR_ERR; - - l = s->buff->slen; - if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR; - b = (unsigned char *) s->buff->data; - x.data = b; - - /* First check if the current buffer holds the terminator */ - b[l] = term->data[0]; /* Set sentinel */ - for (i=0; !testInCharField (&cf, b[i]); i++) ; - if (i < l) { - x.slen = i + 1; - ret = bconcat (r, &x); - s->buff->slen = l; - if (BSTR_OK == ret) bdelete (s->buff, 0, i + 1); - return BSTR_OK; - } - - rlo = r->slen; - - /* If not then just concatenate the entire buffer to the output */ - x.slen = l; - if (BSTR_OK != bconcat (r, &x)) return BSTR_ERR; - - /* Perform direct in-place reads into the destination to allow for - the minimum of data-copies */ - for (;;) { - if (BSTR_OK != balloc (r, r->slen + s->maxBuffSz + 1)) return BSTR_ERR; - b = (unsigned char *) (r->data + r->slen); - l = (int) s->readFnPtr (b, 1, s->maxBuffSz, s->parm); - if (l <= 0) { - r->data[r->slen] = (unsigned char) '\0'; - s->buff->slen = 0; - s->isEOF = 1; - /* If nothing was read return with an error message */ - return BSTR_ERR & -(r->slen == rlo); - } - - b[l] = term->data[0]; /* Set sentinel */ - for (i=0; !testInCharField (&cf, b[i]); i++) ; - if (i < l) break; - r->slen += l; - } - - /* Terminator found, push over-read back to buffer */ - i++; - r->slen += i; - s->buff->slen = l - i; - bstr__memcpy (s->buff->data, b + i, l - i); - r->data[r->slen] = (unsigned char) '\0'; - return BSTR_OK; -} - -/* int bsreada (bstring r, struct bStream * s, int n) - * - * Read a bstring of length n (or, if it is fewer, as many bytes as is - * remaining) from the bStream. This function may read additional - * characters from the core stream that are not returned, but will be - * retained for subsequent read operations. This function will not read - * additional characters from the core stream beyond virtual stream pointer. - */ -int bsreada (bstring r, struct bStream * s, int n) { -int l, ret, orslen; -char * b; -struct tagbstring x; - - if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 - || r->slen < 0 || r->mlen < r->slen || n <= 0) return BSTR_ERR; - - n += r->slen; - if (n <= 0) return BSTR_ERR; - - l = s->buff->slen; - - orslen = r->slen; - - if (0 == l) { - if (s->isEOF) return BSTR_ERR; - if (r->mlen > n) { - l = (int) s->readFnPtr (r->data + r->slen, 1, n - r->slen, s->parm); - if (0 >= l || l > n - r->slen) { - s->isEOF = 1; - return BSTR_ERR; - } - r->slen += l; - r->data[r->slen] = (unsigned char) '\0'; - return 0; - } - } - - if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR; - b = (char *) s->buff->data; - x.data = (unsigned char *) b; - - do { - if (l + r->slen >= n) { - x.slen = n - r->slen; - ret = bconcat (r, &x); - s->buff->slen = l; - if (BSTR_OK == ret) bdelete (s->buff, 0, x.slen); - return BSTR_ERR & -(r->slen == orslen); - } - - x.slen = l; - if (BSTR_OK != bconcat (r, &x)) break; - - l = n - r->slen; - if (l > s->maxBuffSz) l = s->maxBuffSz; - - l = (int) s->readFnPtr (b, 1, l, s->parm); - - } while (l > 0); - if (l < 0) l = 0; - if (l == 0) s->isEOF = 1; - s->buff->slen = l; - return BSTR_ERR & -(r->slen == orslen); -} - -/* int bsreadln (bstring r, struct bStream * s, char terminator) - * - * Read a bstring terminated by the terminator character or the end of the - * stream from the bStream (s) and return it into the parameter r. This - * function may read additional characters from the core stream that are not - * returned, but will be retained for subsequent read operations. - */ -int bsreadln (bstring r, struct bStream * s, char terminator) { - if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0) - return BSTR_ERR; - if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR; - r->slen = 0; - return bsreadlna (r, s, terminator); -} - -/* int bsreadlns (bstring r, struct bStream * s, bstring term) - * - * Read a bstring terminated by any character in the term string or the end - * of the stream from the bStream (s) and return it into the parameter r. - * This function may read additional characters from the core stream that - * are not returned, but will be retained for subsequent read operations. - */ -int bsreadlns (bstring r, struct bStream * s, const_bstring term) { - if (s == NULL || s->buff == NULL || r == NULL || term == NULL - || term->data == NULL || r->mlen <= 0) return BSTR_ERR; - if (term->slen == 1) return bsreadln (r, s, term->data[0]); - if (term->slen < 1) return BSTR_ERR; - if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR; - r->slen = 0; - return bsreadlnsa (r, s, term); -} - -/* int bsread (bstring r, struct bStream * s, int n) - * - * Read a bstring of length n (or, if it is fewer, as many bytes as is - * remaining) from the bStream. This function may read additional - * characters from the core stream that are not returned, but will be - * retained for subsequent read operations. This function will not read - * additional characters from the core stream beyond virtual stream pointer. - */ -int bsread (bstring r, struct bStream * s, int n) { - if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 - || n <= 0) return BSTR_ERR; - if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR; - r->slen = 0; - return bsreada (r, s, n); -} - -/* int bsunread (struct bStream * s, const_bstring b) - * - * Insert a bstring into the bStream at the current position. These - * characters will be read prior to those that actually come from the core - * stream. - */ -int bsunread (struct bStream * s, const_bstring b) { - if (s == NULL || s->buff == NULL) return BSTR_ERR; - return binsert (s->buff, 0, b, (unsigned char) '?'); -} - -/* int bspeek (bstring r, const struct bStream * s) - * - * Return the currently buffered characters from the bStream that will be - * read prior to reads from the core stream. - */ -int bspeek (bstring r, const struct bStream * s) { - if (s == NULL || s->buff == NULL) return BSTR_ERR; - return bassign (r, s->buff); -} - -/* bstring bjoin (const struct bstrList * bl, const_bstring sep); - * - * Join the entries of a bstrList into one bstring by sequentially - * concatenating them with the sep string in between. If there is an error - * NULL is returned, otherwise a bstring with the correct result is returned. - */ -bstring bjoin (const struct bstrList * bl, const_bstring sep) { -bstring b; -int i, c, v; - - if (bl == NULL || bl->qty < 0) return NULL; - if (sep != NULL && (sep->slen < 0 || sep->data == NULL)) return NULL; - - for (i = 0, c = 1; i < bl->qty; i++) { - v = bl->entry[i]->slen; - if (v < 0) return NULL; /* Invalid input */ - c += v; - if (c < 0) return NULL; /* Wrap around ?? */ - } - - if (sep != NULL) c += (bl->qty - 1) * sep->slen; - - b = (bstring) bstr__alloc (sizeof (struct tagbstring)); - if (NULL == b) return NULL; /* Out of memory */ - b->data = (unsigned char *) bstr__alloc (c); - if (b->data == NULL) { - bstr__free (b); - return NULL; - } - - b->mlen = c; - b->slen = c-1; - - for (i = 0, c = 0; i < bl->qty; i++) { - if (i > 0 && sep != NULL) { - bstr__memcpy (b->data + c, sep->data, sep->slen); - c += sep->slen; - } - v = bl->entry[i]->slen; - bstr__memcpy (b->data + c, bl->entry[i]->data, v); - c += v; - } - b->data[c] = (unsigned char) '\0'; - return b; -} - -#define BSSSC_BUFF_LEN (256) - -/* int bssplitscb (struct bStream * s, const_bstring splitStr, - * int (* cb) (void * parm, int ofs, const_bstring entry), void * parm) - * - * Iterate the set of disjoint sequential substrings read from a stream - * divided by any of the characters in splitStr. An empty splitStr causes - * the whole stream to be iterated once. - * - * Note: At the point of calling the cb function, the bStream pointer is - * pointed exactly at the position right after having read the split - * character. The cb function can act on the stream by causing the bStream - * pointer to move, and bssplitscb will continue by starting the next split - * at the position of the pointer after the return from cb. - * - * However, if the cb causes the bStream s to be destroyed then the cb must - * return with a negative value, otherwise bssplitscb will continue in an - * undefined manner. - */ -int bssplitscb (struct bStream * s, const_bstring splitStr, - int (* cb) (void * parm, int ofs, const_bstring entry), void * parm) { -struct charField chrs; -bstring buff; -int i, p, ret; - - if (cb == NULL || s == NULL || s->readFnPtr == NULL - || splitStr == NULL || splitStr->slen < 0) return BSTR_ERR; - - if (NULL == (buff = bfromcstr (""))) return BSTR_ERR; - - if (splitStr->slen == 0) { - while (bsreada (buff, s, BSSSC_BUFF_LEN) >= 0) ; - if ((ret = cb (parm, 0, buff)) > 0) - ret = 0; - } else { - buildCharField (&chrs, splitStr); - ret = p = i = 0; - for (;;) { - if (i >= buff->slen) { - bsreada (buff, s, BSSSC_BUFF_LEN); - if (i >= buff->slen) { - if (0 < (ret = cb (parm, p, buff))) ret = 0; - break; - } - } - if (testInCharField (&chrs, buff->data[i])) { - struct tagbstring t; - unsigned char c; - - blk2tbstr (t, buff->data + i + 1, buff->slen - (i + 1)); - if ((ret = bsunread (s, &t)) < 0) break; - buff->slen = i; - c = buff->data[i]; - buff->data[i] = (unsigned char) '\0'; - if ((ret = cb (parm, p, buff)) < 0) break; - buff->data[i] = c; - buff->slen = 0; - p += i + 1; - i = -1; - } - i++; - } - } - - bdestroy (buff); - return ret; -} - -/* int bssplitstrcb (struct bStream * s, const_bstring splitStr, - * int (* cb) (void * parm, int ofs, const_bstring entry), void * parm) - * - * Iterate the set of disjoint sequential substrings read from a stream - * divided by the entire substring splitStr. An empty splitStr causes - * each character of the stream to be iterated. - * - * Note: At the point of calling the cb function, the bStream pointer is - * pointed exactly at the position right after having read the split - * character. The cb function can act on the stream by causing the bStream - * pointer to move, and bssplitscb will continue by starting the next split - * at the position of the pointer after the return from cb. - * - * However, if the cb causes the bStream s to be destroyed then the cb must - * return with a negative value, otherwise bssplitscb will continue in an - * undefined manner. - */ -int bssplitstrcb (struct bStream * s, const_bstring splitStr, - int (* cb) (void * parm, int ofs, const_bstring entry), void * parm) { -bstring buff; -int i, p, ret; - - if (cb == NULL || s == NULL || s->readFnPtr == NULL - || splitStr == NULL || splitStr->slen < 0) return BSTR_ERR; - - if (splitStr->slen == 1) return bssplitscb (s, splitStr, cb, parm); - - if (NULL == (buff = bfromcstr (""))) return BSTR_ERR; - - if (splitStr->slen == 0) { - for (i=0; bsreada (buff, s, BSSSC_BUFF_LEN) >= 0; i++) { - if ((ret = cb (parm, 0, buff)) < 0) { - bdestroy (buff); - return ret; - } - buff->slen = 0; - } - return BSTR_OK; - } else { - ret = p = i = 0; - for (i=p=0;;) { - if ((ret = binstr (buff, 0, splitStr)) >= 0) { - struct tagbstring t; - blk2tbstr (t, buff->data, ret); - i = ret + splitStr->slen; - if ((ret = cb (parm, p, &t)) < 0) break; - p += i; - bdelete (buff, 0, i); - } else { - bsreada (buff, s, BSSSC_BUFF_LEN); - if (bseof (s)) { - if ((ret = cb (parm, p, buff)) > 0) ret = 0; - break; - } - } - } - } - - bdestroy (buff); - return ret; -} - -/* int bstrListCreate (void) - * - * Create a bstrList. - */ -struct bstrList * bstrListCreate (void) { -struct bstrList * sl = (struct bstrList *) bstr__alloc (sizeof (struct bstrList)); - if (sl) { - sl->entry = (bstring *) bstr__alloc (1*sizeof (bstring)); - if (!sl->entry) { - bstr__free (sl); - sl = NULL; - } else { - sl->qty = 0; - sl->mlen = 1; - } - } - return sl; -} - -/* int bstrListDestroy (struct bstrList * sl) - * - * Destroy a bstrList that has been created by bsplit, bsplits or bstrListCreate. - */ -int bstrListDestroy (struct bstrList * sl) { -int i; - if (sl == NULL || sl->qty < 0) return BSTR_ERR; - for (i=0; i < sl->qty; i++) { - if (sl->entry[i]) { - bdestroy (sl->entry[i]); - sl->entry[i] = NULL; - } - } - sl->qty = -1; - sl->mlen = -1; - bstr__free (sl->entry); - sl->entry = NULL; - bstr__free (sl); - return BSTR_OK; -} - -/* int bstrListAlloc (struct bstrList * sl, int msz) - * - * Ensure that there is memory for at least msz number of entries for the - * list. - */ -int bstrListAlloc (struct bstrList * sl, int msz) { -bstring * l; -int smsz; -size_t nsz; - if (!sl || msz <= 0 || !sl->entry || sl->qty < 0 || sl->mlen <= 0 || sl->qty > sl->mlen) return BSTR_ERR; - if (sl->mlen >= msz) return BSTR_OK; - smsz = snapUpSize (msz); - nsz = ((size_t) smsz) * sizeof (bstring); - if (nsz < (size_t) smsz) return BSTR_ERR; - l = (bstring *) bstr__realloc (sl->entry, nsz); - if (!l) { - smsz = msz; - nsz = ((size_t) smsz) * sizeof (bstring); - l = (bstring *) bstr__realloc (sl->entry, nsz); - if (!l) return BSTR_ERR; - } - sl->mlen = smsz; - sl->entry = l; - return BSTR_OK; -} - -/* int bstrListAllocMin (struct bstrList * sl, int msz) - * - * Try to allocate the minimum amount of memory for the list to include at - * least msz entries or sl->qty whichever is greater. - */ -int bstrListAllocMin (struct bstrList * sl, int msz) { -bstring * l; -size_t nsz; - if (!sl || msz <= 0 || !sl->entry || sl->qty < 0 || sl->mlen <= 0 || sl->qty > sl->mlen) return BSTR_ERR; - if (msz < sl->qty) msz = sl->qty; - if (sl->mlen == msz) return BSTR_OK; - nsz = ((size_t) msz) * sizeof (bstring); - if (nsz < (size_t) msz) return BSTR_ERR; - l = (bstring *) bstr__realloc (sl->entry, nsz); - if (!l) return BSTR_ERR; - sl->mlen = msz; - sl->entry = l; - return BSTR_OK; -} - -/* int bsplitcb (const_bstring str, unsigned char splitChar, int pos, - * int (* cb) (void * parm, int ofs, int len), void * parm) - * - * Iterate the set of disjoint sequential substrings over str divided by the - * character in splitChar. - * - * Note: Non-destructive modification of str from within the cb function - * while performing this split is not undefined. bsplitcb behaves in - * sequential lock step with calls to cb. I.e., after returning from a cb - * that return a non-negative integer, bsplitcb continues from the position - * 1 character after the last detected split character and it will halt - * immediately if the length of str falls below this point. However, if the - * cb function destroys str, then it *must* return with a negative value, - * otherwise bsplitcb will continue in an undefined manner. - */ -int bsplitcb (const_bstring str, unsigned char splitChar, int pos, - int (* cb) (void * parm, int ofs, int len), void * parm) { -int i, p, ret; - - if (cb == NULL || str == NULL || pos < 0 || pos > str->slen) - return BSTR_ERR; - - p = pos; - do { - for (i=p; i < str->slen; i++) { - if (str->data[i] == splitChar) break; - } - if ((ret = cb (parm, p, i - p)) < 0) return ret; - p = i + 1; - } while (p <= str->slen); - return BSTR_OK; -} - -/* int bsplitscb (const_bstring str, const_bstring splitStr, int pos, - * int (* cb) (void * parm, int ofs, int len), void * parm) - * - * Iterate the set of disjoint sequential substrings over str divided by any - * of the characters in splitStr. An empty splitStr causes the whole str to - * be iterated once. - * - * Note: Non-destructive modification of str from within the cb function - * while performing this split is not undefined. bsplitscb behaves in - * sequential lock step with calls to cb. I.e., after returning from a cb - * that return a non-negative integer, bsplitscb continues from the position - * 1 character after the last detected split character and it will halt - * immediately if the length of str falls below this point. However, if the - * cb function destroys str, then it *must* return with a negative value, - * otherwise bsplitscb will continue in an undefined manner. - */ -int bsplitscb (const_bstring str, const_bstring splitStr, int pos, - int (* cb) (void * parm, int ofs, int len), void * parm) { -struct charField chrs; -int i, p, ret; - - if (cb == NULL || str == NULL || pos < 0 || pos > str->slen - || splitStr == NULL || splitStr->slen < 0) return BSTR_ERR; - if (splitStr->slen == 0) { - if ((ret = cb (parm, 0, str->slen)) > 0) ret = 0; - return ret; - } - - if (splitStr->slen == 1) - return bsplitcb (str, splitStr->data[0], pos, cb, parm); - - buildCharField (&chrs, splitStr); - - p = pos; - do { - for (i=p; i < str->slen; i++) { - if (testInCharField (&chrs, str->data[i])) break; - } - if ((ret = cb (parm, p, i - p)) < 0) return ret; - p = i + 1; - } while (p <= str->slen); - return BSTR_OK; -} - -/* int bsplitstrcb (const_bstring str, const_bstring splitStr, int pos, - * int (* cb) (void * parm, int ofs, int len), void * parm) - * - * Iterate the set of disjoint sequential substrings over str divided by the - * substring splitStr. An empty splitStr causes the whole str to be - * iterated once. - * - * Note: Non-destructive modification of str from within the cb function - * while performing this split is not undefined. bsplitstrcb behaves in - * sequential lock step with calls to cb. I.e., after returning from a cb - * that return a non-negative integer, bsplitscb continues from the position - * 1 character after the last detected split character and it will halt - * immediately if the length of str falls below this point. However, if the - * cb function destroys str, then it *must* return with a negative value, - * otherwise bsplitscb will continue in an undefined manner. - */ -int bsplitstrcb (const_bstring str, const_bstring splitStr, int pos, - int (* cb) (void * parm, int ofs, int len), void * parm) { -int i, p, ret; - - if (cb == NULL || str == NULL || pos < 0 || pos > str->slen - || splitStr == NULL || splitStr->slen < 0) return BSTR_ERR; - - if (0 == splitStr->slen) { - for (i=pos; i < str->slen; i++) { - if ((ret = cb (parm, i, 1)) < 0) return ret; - } - return BSTR_OK; - } - - if (splitStr->slen == 1) - return bsplitcb (str, splitStr->data[0], pos, cb, parm); - - for (i=p=pos; i <= str->slen - splitStr->slen; i++) { - if (0 == bstr__memcmp (splitStr->data, str->data + i, splitStr->slen)) { - if ((ret = cb (parm, p, i - p)) < 0) return ret; - i += splitStr->slen; - p = i; - } - } - if ((ret = cb (parm, p, str->slen - p)) < 0) return ret; - return BSTR_OK; -} - -struct genBstrList { - bstring b; - struct bstrList * bl; -}; - -static int bscb (void * parm, int ofs, int len) { -struct genBstrList * g = (struct genBstrList *) parm; - if (g->bl->qty >= g->bl->mlen) { - int mlen = g->bl->mlen * 2; - bstring * tbl; - - while (g->bl->qty >= mlen) { - if (mlen < g->bl->mlen) return BSTR_ERR; - mlen += mlen; - } - - tbl = (bstring *) bstr__realloc (g->bl->entry, sizeof (bstring) * mlen); - if (tbl == NULL) return BSTR_ERR; - - g->bl->entry = tbl; - g->bl->mlen = mlen; - } - - g->bl->entry[g->bl->qty] = bmidstr (g->b, ofs, len); - g->bl->qty++; - return BSTR_OK; -} - -/* struct bstrList * bsplit (const_bstring str, unsigned char splitChar) - * - * Create an array of sequential substrings from str divided by the character - * splitChar. - */ -struct bstrList * bsplit (const_bstring str, unsigned char splitChar) { -struct genBstrList g; - - if (str == NULL || str->data == NULL || str->slen < 0) return NULL; - - g.bl = (struct bstrList *) bstr__alloc (sizeof (struct bstrList)); - if (g.bl == NULL) return NULL; - g.bl->mlen = 4; - g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring)); - if (NULL == g.bl->entry) { - bstr__free (g.bl); - return NULL; - } - - g.b = (bstring) str; - g.bl->qty = 0; - if (bsplitcb (str, splitChar, 0, bscb, &g) < 0) { - bstrListDestroy (g.bl); - return NULL; - } - return g.bl; -} - -/* struct bstrList * bsplitstr (const_bstring str, const_bstring splitStr) - * - * Create an array of sequential substrings from str divided by the entire - * substring splitStr. - */ -struct bstrList * bsplitstr (const_bstring str, const_bstring splitStr) { -struct genBstrList g; - - if (str == NULL || str->data == NULL || str->slen < 0) return NULL; - - g.bl = (struct bstrList *) bstr__alloc (sizeof (struct bstrList)); - if (g.bl == NULL) return NULL; - g.bl->mlen = 4; - g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring)); - if (NULL == g.bl->entry) { - bstr__free (g.bl); - return NULL; - } - - g.b = (bstring) str; - g.bl->qty = 0; - if (bsplitstrcb (str, splitStr, 0, bscb, &g) < 0) { - bstrListDestroy (g.bl); - return NULL; - } - return g.bl; -} - -/* struct bstrList * bsplits (const_bstring str, bstring splitStr) - * - * Create an array of sequential substrings from str divided by any of the - * characters in splitStr. An empty splitStr causes a single entry bstrList - * containing a copy of str to be returned. - */ -struct bstrList * bsplits (const_bstring str, const_bstring splitStr) { -struct genBstrList g; - - if ( str == NULL || str->slen < 0 || str->data == NULL || - splitStr == NULL || splitStr->slen < 0 || splitStr->data == NULL) - return NULL; - - g.bl = (struct bstrList *) bstr__alloc (sizeof (struct bstrList)); - if (g.bl == NULL) return NULL; - g.bl->mlen = 4; - g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring)); - if (NULL == g.bl->entry) { - bstr__free (g.bl); - return NULL; - } - g.b = (bstring) str; - g.bl->qty = 0; - - if (bsplitscb (str, splitStr, 0, bscb, &g) < 0) { - bstrListDestroy (g.bl); - return NULL; - } - return g.bl; -} - -#if defined (__TURBOC__) && !defined (__BORLANDC__) -# ifndef BSTRLIB_NOVSNP -# define BSTRLIB_NOVSNP -# endif -#endif - -/* Give WATCOM C/C++, MSVC some latitude for their non-support of vsnprintf */ -#if defined(__WATCOMC__) || defined(_MSC_VER) -#define exvsnprintf(r,b,n,f,a) {r = _vsnprintf (b,n,f,a);} -#else -#ifdef BSTRLIB_NOVSNP -/* This is just a hack. If you are using a system without a vsnprintf, it is - not recommended that bformat be used at all. */ -#define exvsnprintf(r,b,n,f,a) {vsprintf (b,f,a); r = -1;} -#define START_VSNBUFF (256) -#else - -#ifdef __GNUC__ -/* Something is making gcc complain about this prototype not being here, so - I've just gone ahead and put it in. */ -extern int vsnprintf (char *buf, size_t count, const char *format, va_list arg); -#endif - -#define exvsnprintf(r,b,n,f,a) {r = vsnprintf (b,n,f,a);} -#endif -#endif - -#if !defined (BSTRLIB_NOVSNP) - -#ifndef START_VSNBUFF -#define START_VSNBUFF (16) -#endif - -/* On IRIX vsnprintf returns n-1 when the operation would overflow the target - buffer, WATCOM and MSVC both return -1, while C99 requires that the - returned value be exactly what the length would be if the buffer would be - large enough. This leads to the idea that if the return value is larger - than n, then changing n to the return value will reduce the number of - iterations required. */ - -/* int bformata (bstring b, const char * fmt, ...) - * - * After the first parameter, it takes the same parameters as printf (), but - * rather than outputting results to stdio, it appends the results to - * a bstring which contains what would have been output. Note that if there - * is an early generation of a '\0' character, the bstring will be truncated - * to this end point. - */ -int bformata (bstring b, const char * fmt, ...) { -va_list arglist; -bstring buff; -int n, r; - - if (b == NULL || fmt == NULL || b->data == NULL || b->mlen <= 0 - || b->slen < 0 || b->slen > b->mlen) return BSTR_ERR; - - /* Since the length is not determinable beforehand, a search is - performed using the truncating "vsnprintf" call (to avoid buffer - overflows) on increasing potential sizes for the output result. */ - - if ((n = (int) (2*strlen (fmt))) < START_VSNBUFF) n = START_VSNBUFF; - if (NULL == (buff = bfromcstralloc (n + 2, ""))) { - n = 1; - if (NULL == (buff = bfromcstralloc (n + 2, ""))) return BSTR_ERR; - } - - for (;;) { - va_start (arglist, fmt); - exvsnprintf (r, (char *) buff->data, n + 1, fmt, arglist); - va_end (arglist); - - buff->data[n] = (unsigned char) '\0'; - buff->slen = (int) (strlen) ((char *) buff->data); - - if (buff->slen < n) break; - - if (r > n) n = r; else n += n; - - if (BSTR_OK != balloc (buff, n + 2)) { - bdestroy (buff); - return BSTR_ERR; - } - } - - r = bconcat (b, buff); - bdestroy (buff); - return r; -} - -/* int bassignformat (bstring b, const char * fmt, ...) - * - * After the first parameter, it takes the same parameters as printf (), but - * rather than outputting results to stdio, it outputs the results to - * the bstring parameter b. Note that if there is an early generation of a - * '\0' character, the bstring will be truncated to this end point. - */ -int bassignformat (bstring b, const char * fmt, ...) { -va_list arglist; -bstring buff; -int n, r; - - if (b == NULL || fmt == NULL || b->data == NULL || b->mlen <= 0 - || b->slen < 0 || b->slen > b->mlen) return BSTR_ERR; - - /* Since the length is not determinable beforehand, a search is - performed using the truncating "vsnprintf" call (to avoid buffer - overflows) on increasing potential sizes for the output result. */ - - if ((n = (int) (2*strlen (fmt))) < START_VSNBUFF) n = START_VSNBUFF; - if (NULL == (buff = bfromcstralloc (n + 2, ""))) { - n = 1; - if (NULL == (buff = bfromcstralloc (n + 2, ""))) return BSTR_ERR; - } - - for (;;) { - va_start (arglist, fmt); - exvsnprintf (r, (char *) buff->data, n + 1, fmt, arglist); - va_end (arglist); - - buff->data[n] = (unsigned char) '\0'; - buff->slen = (int) (strlen) ((char *) buff->data); - - if (buff->slen < n) break; - - if (r > n) n = r; else n += n; - - if (BSTR_OK != balloc (buff, n + 2)) { - bdestroy (buff); - return BSTR_ERR; - } - } - - r = bassign (b, buff); - bdestroy (buff); - return r; -} - -/* bstring bformat (const char * fmt, ...) - * - * Takes the same parameters as printf (), but rather than outputting results - * to stdio, it forms a bstring which contains what would have been output. - * Note that if there is an early generation of a '\0' character, the - * bstring will be truncated to this end point. - */ -bstring bformat (const char * fmt, ...) { -va_list arglist; -bstring buff; -int n, r; - - if (fmt == NULL) return NULL; - - /* Since the length is not determinable beforehand, a search is - performed using the truncating "vsnprintf" call (to avoid buffer - overflows) on increasing potential sizes for the output result. */ - - if ((n = (int) (2*strlen (fmt))) < START_VSNBUFF) n = START_VSNBUFF; - if (NULL == (buff = bfromcstralloc (n + 2, ""))) { - n = 1; - if (NULL == (buff = bfromcstralloc (n + 2, ""))) return NULL; - } - - for (;;) { - va_start (arglist, fmt); - exvsnprintf (r, (char *) buff->data, n + 1, fmt, arglist); - va_end (arglist); - - buff->data[n] = (unsigned char) '\0'; - buff->slen = (int) (strlen) ((char *) buff->data); - - if (buff->slen < n) break; - - if (r > n) n = r; else n += n; - - if (BSTR_OK != balloc (buff, n + 2)) { - bdestroy (buff); - return NULL; - } - } - - return buff; -} - -/* int bvcformata (bstring b, int count, const char * fmt, va_list arglist) - * - * The bvcformata function formats data under control of the format control - * string fmt and attempts to append the result to b. The fmt parameter is - * the same as that of the printf function. The variable argument list is - * replaced with arglist, which has been initialized by the va_start macro. - * The size of the appended output is upper bounded by count. If the - * required output exceeds count, the string b is not augmented with any - * contents and a value below BSTR_ERR is returned. If a value below -count - * is returned then it is recommended that the negative of this value be - * used as an update to the count in a subsequent pass. On other errors, - * such as running out of memory, parameter errors or numeric wrap around - * BSTR_ERR is returned. BSTR_OK is returned when the output is successfully - * generated and appended to b. - * - * Note: There is no sanity checking of arglist, and this function is - * destructive of the contents of b from the b->slen point onward. If there - * is an early generation of a '\0' character, the bstring will be truncated - * to this end point. - */ -int bvcformata (bstring b, int count, const char * fmt, va_list arg) { -int n, r, l; - - if (b == NULL || fmt == NULL || count <= 0 || b->data == NULL - || b->mlen <= 0 || b->slen < 0 || b->slen > b->mlen) return BSTR_ERR; - - if (count > (n = b->slen + count) + 2) return BSTR_ERR; - if (BSTR_OK != balloc (b, n + 2)) return BSTR_ERR; - - exvsnprintf (r, (char *) b->data + b->slen, count + 2, fmt, arg); - - /* Did the operation complete successfully within bounds? */ - for (l = b->slen; l <= n; l++) { - if ('\0' == b->data[l]) { - b->slen = l; - return BSTR_OK; - } - } - - /* Abort, since the buffer was not large enough. The return value - tries to help set what the retry length should be. */ - - b->data[b->slen] = '\0'; - if (r > count + 1) { /* Does r specify a particular target length? */ - n = r; - } else { - n = count + count; /* If not, just double the size of count */ - if (count > n) n = INT_MAX; - } - n = -n; - - if (n > BSTR_ERR-1) n = BSTR_ERR-1; - return n; -} - -#endif diff --git a/oldstuff/lcthw-remnants/devpkg/bstrlib.h b/oldstuff/lcthw-remnants/devpkg/bstrlib.h deleted file mode 100644 index c8fa694..0000000 --- a/oldstuff/lcthw-remnants/devpkg/bstrlib.h +++ /dev/null @@ -1,304 +0,0 @@ -/* - * This source file is part of the bstring string library. This code was - * written by Paul Hsieh in 2002-2010, and is covered by either the 3-clause - * BSD open source license or GPL v2.0. Refer to the accompanying documentation - * for details on usage and license. - */ - -/* - * bstrlib.h - * - * This file is the header file for the core module for implementing the - * bstring functions. - */ - -#ifndef BSTRLIB_INCLUDE -#define BSTRLIB_INCLUDE - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -#if !defined (BSTRLIB_VSNP_OK) && !defined (BSTRLIB_NOVSNP) -# if defined (__TURBOC__) && !defined (__BORLANDC__) -# define BSTRLIB_NOVSNP -# endif -#endif - -#define BSTR_ERR (-1) -#define BSTR_OK (0) -#define BSTR_BS_BUFF_LENGTH_GET (0) - -typedef struct tagbstring * bstring; -typedef const struct tagbstring * const_bstring; - -/* Copy functions */ -#define cstr2bstr bfromcstr -extern bstring bfromcstr (const char * str); -extern bstring bfromcstralloc (int mlen, const char * str); -extern bstring blk2bstr (const void * blk, int len); -extern char * bstr2cstr (const_bstring s, char z); -extern int bcstrfree (char * s); -extern bstring bstrcpy (const_bstring b1); -extern int bassign (bstring a, const_bstring b); -extern int bassignmidstr (bstring a, const_bstring b, int left, int len); -extern int bassigncstr (bstring a, const char * str); -extern int bassignblk (bstring a, const void * s, int len); - -/* Destroy function */ -extern int bdestroy (bstring b); - -/* Space allocation hinting functions */ -extern int balloc (bstring s, int len); -extern int ballocmin (bstring b, int len); - -/* Substring extraction */ -extern bstring bmidstr (const_bstring b, int left, int len); - -/* Various standard manipulations */ -extern int bconcat (bstring b0, const_bstring b1); -extern int bconchar (bstring b0, char c); -extern int bcatcstr (bstring b, const char * s); -extern int bcatblk (bstring b, const void * s, int len); -extern int binsert (bstring s1, int pos, const_bstring s2, unsigned char fill); -extern int binsertch (bstring s1, int pos, int len, unsigned char fill); -extern int breplace (bstring b1, int pos, int len, const_bstring b2, unsigned char fill); -extern int bdelete (bstring s1, int pos, int len); -extern int bsetstr (bstring b0, int pos, const_bstring b1, unsigned char fill); -extern int btrunc (bstring b, int n); - -/* Scan/search functions */ -extern int bstricmp (const_bstring b0, const_bstring b1); -extern int bstrnicmp (const_bstring b0, const_bstring b1, int n); -extern int biseqcaseless (const_bstring b0, const_bstring b1); -extern int bisstemeqcaselessblk (const_bstring b0, const void * blk, int len); -extern int biseq (const_bstring b0, const_bstring b1); -extern int bisstemeqblk (const_bstring b0, const void * blk, int len); -extern int biseqcstr (const_bstring b, const char * s); -extern int biseqcstrcaseless (const_bstring b, const char * s); -extern int bstrcmp (const_bstring b0, const_bstring b1); -extern int bstrncmp (const_bstring b0, const_bstring b1, int n); -extern int binstr (const_bstring s1, int pos, const_bstring s2); -extern int binstrr (const_bstring s1, int pos, const_bstring s2); -extern int binstrcaseless (const_bstring s1, int pos, const_bstring s2); -extern int binstrrcaseless (const_bstring s1, int pos, const_bstring s2); -extern int bstrchrp (const_bstring b, int c, int pos); -extern int bstrrchrp (const_bstring b, int c, int pos); -#define bstrchr(b,c) bstrchrp ((b), (c), 0) -#define bstrrchr(b,c) bstrrchrp ((b), (c), blength(b)-1) -extern int binchr (const_bstring b0, int pos, const_bstring b1); -extern int binchrr (const_bstring b0, int pos, const_bstring b1); -extern int bninchr (const_bstring b0, int pos, const_bstring b1); -extern int bninchrr (const_bstring b0, int pos, const_bstring b1); -extern int bfindreplace (bstring b, const_bstring find, const_bstring repl, int pos); -extern int bfindreplacecaseless (bstring b, const_bstring find, const_bstring repl, int pos); - -/* List of string container functions */ -struct bstrList { - int qty, mlen; - bstring * entry; -}; -extern struct bstrList * bstrListCreate (void); -extern int bstrListDestroy (struct bstrList * sl); -extern int bstrListAlloc (struct bstrList * sl, int msz); -extern int bstrListAllocMin (struct bstrList * sl, int msz); - -/* String split and join functions */ -extern struct bstrList * bsplit (const_bstring str, unsigned char splitChar); -extern struct bstrList * bsplits (const_bstring str, const_bstring splitStr); -extern struct bstrList * bsplitstr (const_bstring str, const_bstring splitStr); -extern bstring bjoin (const struct bstrList * bl, const_bstring sep); -extern int bsplitcb (const_bstring str, unsigned char splitChar, int pos, - int (* cb) (void * parm, int ofs, int len), void * parm); -extern int bsplitscb (const_bstring str, const_bstring splitStr, int pos, - int (* cb) (void * parm, int ofs, int len), void * parm); -extern int bsplitstrcb (const_bstring str, const_bstring splitStr, int pos, - int (* cb) (void * parm, int ofs, int len), void * parm); - -/* Miscellaneous functions */ -extern int bpattern (bstring b, int len); -extern int btoupper (bstring b); -extern int btolower (bstring b); -extern int bltrimws (bstring b); -extern int brtrimws (bstring b); -extern int btrimws (bstring b); - -/* <*>printf format functions */ -#if !defined (BSTRLIB_NOVSNP) -extern bstring bformat (const char * fmt, ...); -extern int bformata (bstring b, const char * fmt, ...); -extern int bassignformat (bstring b, const char * fmt, ...); -extern int bvcformata (bstring b, int count, const char * fmt, va_list arglist); - -#define bvformata(ret, b, fmt, lastarg) { \ -bstring bstrtmp_b = (b); \ -const char * bstrtmp_fmt = (fmt); \ -int bstrtmp_r = BSTR_ERR, bstrtmp_sz = 16; \ - for (;;) { \ - va_list bstrtmp_arglist; \ - va_start (bstrtmp_arglist, lastarg); \ - bstrtmp_r = bvcformata (bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, bstrtmp_arglist); \ - va_end (bstrtmp_arglist); \ - if (bstrtmp_r >= 0) { /* Everything went ok */ \ - bstrtmp_r = BSTR_OK; \ - break; \ - } else if (-bstrtmp_r <= bstrtmp_sz) { /* A real error? */ \ - bstrtmp_r = BSTR_ERR; \ - break; \ - } \ - bstrtmp_sz = -bstrtmp_r; /* Doubled or target size */ \ - } \ - ret = bstrtmp_r; \ -} - -#endif - -typedef int (*bNgetc) (void *parm); -typedef size_t (* bNread) (void *buff, size_t elsize, size_t nelem, void *parm); - -/* Input functions */ -extern bstring bgets (bNgetc getcPtr, void * parm, char terminator); -extern bstring bread (bNread readPtr, void * parm); -extern int bgetsa (bstring b, bNgetc getcPtr, void * parm, char terminator); -extern int bassigngets (bstring b, bNgetc getcPtr, void * parm, char terminator); -extern int breada (bstring b, bNread readPtr, void * parm); - -/* Stream functions */ -extern struct bStream * bsopen (bNread readPtr, void * parm); -extern void * bsclose (struct bStream * s); -extern int bsbufflength (struct bStream * s, int sz); -extern int bsreadln (bstring b, struct bStream * s, char terminator); -extern int bsreadlns (bstring r, struct bStream * s, const_bstring term); -extern int bsread (bstring b, struct bStream * s, int n); -extern int bsreadlna (bstring b, struct bStream * s, char terminator); -extern int bsreadlnsa (bstring r, struct bStream * s, const_bstring term); -extern int bsreada (bstring b, struct bStream * s, int n); -extern int bsunread (struct bStream * s, const_bstring b); -extern int bspeek (bstring r, const struct bStream * s); -extern int bssplitscb (struct bStream * s, const_bstring splitStr, - int (* cb) (void * parm, int ofs, const_bstring entry), void * parm); -extern int bssplitstrcb (struct bStream * s, const_bstring splitStr, - int (* cb) (void * parm, int ofs, const_bstring entry), void * parm); -extern int bseof (const struct bStream * s); - -struct tagbstring { - int mlen; - int slen; - unsigned char * data; -}; - -/* Accessor macros */ -#define blengthe(b, e) (((b) == (void *)0 || (b)->slen < 0) ? (int)(e) : ((b)->slen)) -#define blength(b) (blengthe ((b), 0)) -#define bdataofse(b, o, e) (((b) == (void *)0 || (b)->data == (void*)0) ? (char *)(e) : ((char *)(b)->data) + (o)) -#define bdataofs(b, o) (bdataofse ((b), (o), (void *)0)) -#define bdatae(b, e) (bdataofse (b, 0, e)) -#define bdata(b) (bdataofs (b, 0)) -#define bchare(b, p, e) ((((unsigned)(p)) < (unsigned)blength(b)) ? ((b)->data[(p)]) : (e)) -#define bchar(b, p) bchare ((b), (p), '\0') - -/* Static constant string initialization macro */ -#define bsStaticMlen(q,m) {(m), (int) sizeof(q)-1, (unsigned char *) ("" q "")} -#if defined(_MSC_VER) -/* There are many versions of MSVC which emit __LINE__ as a non-constant. */ -# define bsStatic(q) bsStaticMlen(q,-32) -#endif -#ifndef bsStatic -# define bsStatic(q) bsStaticMlen(q,-__LINE__) -#endif - -/* Static constant block parameter pair */ -#define bsStaticBlkParms(q) ((void *)("" q "")), ((int) sizeof(q)-1) - -/* Reference building macros */ -#define cstr2tbstr btfromcstr -#define btfromcstr(t,s) { \ - (t).data = (unsigned char *) (s); \ - (t).slen = ((t).data) ? ((int) (strlen) ((char *)(t).data)) : 0; \ - (t).mlen = -1; \ -} -#define blk2tbstr(t,s,l) { \ - (t).data = (unsigned char *) (s); \ - (t).slen = l; \ - (t).mlen = -1; \ -} -#define btfromblk(t,s,l) blk2tbstr(t,s,l) -#define bmid2tbstr(t,b,p,l) { \ - const_bstring bstrtmp_s = (b); \ - if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) { \ - int bstrtmp_left = (p); \ - int bstrtmp_len = (l); \ - if (bstrtmp_left < 0) { \ - bstrtmp_len += bstrtmp_left; \ - bstrtmp_left = 0; \ - } \ - if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) \ - bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \ - if (bstrtmp_len <= 0) { \ - (t).data = (unsigned char *)""; \ - (t).slen = 0; \ - } else { \ - (t).data = bstrtmp_s->data + bstrtmp_left; \ - (t).slen = bstrtmp_len; \ - } \ - } else { \ - (t).data = (unsigned char *)""; \ - (t).slen = 0; \ - } \ - (t).mlen = -__LINE__; \ -} -#define btfromblkltrimws(t,s,l) { \ - int bstrtmp_idx = 0, bstrtmp_len = (l); \ - unsigned char * bstrtmp_s = (s); \ - if (bstrtmp_s && bstrtmp_len >= 0) { \ - for (; bstrtmp_idx < bstrtmp_len; bstrtmp_idx++) { \ - if (!isspace (bstrtmp_s[bstrtmp_idx])) break; \ - } \ - } \ - (t).data = bstrtmp_s + bstrtmp_idx; \ - (t).slen = bstrtmp_len - bstrtmp_idx; \ - (t).mlen = -__LINE__; \ -} -#define btfromblkrtrimws(t,s,l) { \ - int bstrtmp_len = (l) - 1; \ - unsigned char * bstrtmp_s = (s); \ - if (bstrtmp_s && bstrtmp_len >= 0) { \ - for (; bstrtmp_len >= 0; bstrtmp_len--) { \ - if (!isspace (bstrtmp_s[bstrtmp_len])) break; \ - } \ - } \ - (t).data = bstrtmp_s; \ - (t).slen = bstrtmp_len + 1; \ - (t).mlen = -__LINE__; \ -} -#define btfromblktrimws(t,s,l) { \ - int bstrtmp_idx = 0, bstrtmp_len = (l) - 1; \ - unsigned char * bstrtmp_s = (s); \ - if (bstrtmp_s && bstrtmp_len >= 0) { \ - for (; bstrtmp_idx <= bstrtmp_len; bstrtmp_idx++) { \ - if (!isspace (bstrtmp_s[bstrtmp_idx])) break; \ - } \ - for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) { \ - if (!isspace (bstrtmp_s[bstrtmp_len])) break; \ - } \ - } \ - (t).data = bstrtmp_s + bstrtmp_idx; \ - (t).slen = bstrtmp_len + 1 - bstrtmp_idx; \ - (t).mlen = -__LINE__; \ -} - -/* Write protection macros */ -#define bwriteprotect(t) { if ((t).mlen >= 0) (t).mlen = -1; } -#define bwriteallow(t) { if ((t).mlen == -1) (t).mlen = (t).slen + ((t).slen == 0); } -#define biswriteprotected(t) ((t).mlen <= 0) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/oldstuff/lcthw-remnants/devpkg/commands.c b/oldstuff/lcthw-remnants/devpkg/commands.c deleted file mode 100644 index 9b483c4..0000000 --- a/oldstuff/lcthw-remnants/devpkg/commands.c +++ /dev/null @@ -1,175 +0,0 @@ -#include -#include -#include - -#include "commands.h" -#include "dbg.h" -#include "bstrlib.h" -#include "db.h" -#include "shell.h" - - -int Command_depends(apr_pool_t *p, const char *path) -{ - FILE *in = NULL; - bstring line = NULL; - - in = fopen(path, "r"); - check(in != NULL, "Failed to open downloaded depends: %s", path); - - for(line = bgets((bNgetc)fgetc, in, '\n'); line != NULL; - line = bgets((bNgetc)fgetc, in, '\n')) - { - btrimws(line); - log_info("Processing depends: %s", bdata(line)); - int rc = Command_install(p, bdata(line), NULL, NULL, NULL); - check(rc == 0, "Failed to install: %s", bdata(line)); - bdestroy(line); - } - - fclose(in); - return 0; - -error: - if(line) bdestroy(line); - if(in) fclose(in); - return -1; -} - - -int Command_fetch(apr_pool_t *p, const char *url, int fetch_only) -{ - apr_uri_t info = {.port = 0}; - int rc = 0; - const char *depends_file = NULL; - apr_status_t rv = apr_uri_parse(p, url, &info); - - check(rv == APR_SUCCESS, "Failed to parse URL: %s", url); - - if(apr_fnmatch(GIT_PAT, info.path, 0) == APR_SUCCESS) { - rc = Shell_exec(GIT_SH, "URL", url, NULL); - check(rc == 0, "git failed."); - } else if(apr_fnmatch(DEPEND_PAT, info.path, 0) == APR_SUCCESS) { - check(!fetch_only, "No point in fetching a DEPENDS file."); - - if(info.scheme) { - depends_file = DEPENDS_PATH; - rc = Shell_exec(CURL_SH, "URL", url, "TARGET", depends_file, NULL); - check(rc == 0, "Curl failed."); - } else { - depends_file = info.path; - } - - // recursively process the devpkg list - log_info("Building according to DEPENDS: %s", url); - rv = Command_depends(p, depends_file); - check(rv == 0, "Failed to process the DEPENDS: %s", url); - - // this indicates that nothing needs to be done - return 0; - - } else if(apr_fnmatch(TAR_GZ_PAT, info.path, 0) == APR_SUCCESS) { - if(info.scheme) { - rc = Shell_exec(CURL_SH, - "URL", url, - "TARGET", TAR_GZ_SRC, NULL); - check(rc == 0, "Failed to curl source: %s", url); - } - - rv = apr_dir_make_recursive(BUILD_DIR, - APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); - check(rv == APR_SUCCESS, "Failed to make directory %s", BUILD_DIR); - - rc = Shell_exec(TAR_SH, "FILE", TAR_GZ_SRC, NULL); - check(rc == 0, "Failed to untar %s", TAR_GZ_SRC); - } else if(apr_fnmatch(TAR_BZ2_PAT, info.path, 0) == APR_SUCCESS) { - if(info.scheme) { - rc = Shell_exec(CURL_SH, "URL", url, "TARGET", TAR_BZ2_SRC, NULL); - check(rc == 0, "Curl failed."); - } - - apr_status_t rc = apr_dir_make_recursive(BUILD_DIR, - APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); - - check(rc == 0, "Failed to make directory %s", BUILD_DIR); - rc = Shell_exec(TAR_SH, "FILE", TAR_BZ2_SRC, NULL); - check(rc == 0, "Failed to untar %s", TAR_BZ2_SRC); - } else { - sentinel("Don't know how to handle %s", url); - } - - // indicates that an install needs to actually run - return 1; - -error: - return -1; -} - -int Command_build(apr_pool_t *p, const char *url, const char *configure_opts, - const char *make_opts, const char *install_opts) -{ - int rc = 0; - - check(access(BUILD_DIR, X_OK | R_OK | W_OK) == 0, - "Build directory doesn't exist: %s", BUILD_DIR); - - // actually do an install - if(access(CONFIG_SCRIPT, X_OK) == 0) { - log_info("Has a configure script, running it."); - rc = Shell_exec(CONFIGURE_SH, "OPTS", configure_opts, NULL); - check(rc == 0, "Failed to configure."); - } - - rc = Shell_exec(MAKE_SH, "OPTS", make_opts, NULL); - check(rc == 0, "Failed to build."); - - rc = Shell_exec(INSTALL_SH, - "TARGET", install_opts ? install_opts : "install", - NULL); - check(rc == 0, "Failed to install."); - - rc = Shell_exec(CLEANUP_SH, NULL); - check(rc == 0, "Failed to cleanup after build."); - - rc = DB_update(url); - check(rc == 0, "Failed to add this package to the database."); - - return 0; - -error: - return 1; -} - -int Command_install(apr_pool_t *p, const char *url, const char *configure_opts, - const char *make_opts, const char *install_opts) -{ - int rc = 0; - check(Shell_exec(CLEANUP_SH, NULL) == 0, "Failed to cleanup before building."); - - rc = DB_find(url); - check(rc != -1, "Error checking the install database."); - - if(rc == 1) { - log_info("Package %s already installed.", url); - return 0; - } - - rc = Command_fetch(p, url, 0); - if(rc == 1) { - rc = Command_build(p, url, configure_opts, make_opts, install_opts); - check(rc == 0, "Failed to build: %s", url); - } else if(rc == 0) { - // no install needed - log_info("Depends successfully installed: %s", url); - } else { - // had an error - sentinel("Install failed: %s", url); - } - - Shell_exec(CLEANUP_SH, NULL); - return 0; - -error: - Shell_exec(CLEANUP_SH, NULL); - return -1; -} diff --git a/oldstuff/lcthw-remnants/devpkg/commands.h b/oldstuff/lcthw-remnants/devpkg/commands.h deleted file mode 100644 index 443308b..0000000 --- a/oldstuff/lcthw-remnants/devpkg/commands.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _commands_h -#define _commands_h - -#include - -#define DEPENDS_PATH "/tmp/DEPENDS" -#define TAR_GZ_SRC "/tmp/pkg-src.tar.gz" -#define TAR_BZ2_SRC "/tmp/pkg-src.tar.bz2" -#define BUILD_DIR "/tmp/pkg-build" -#define GIT_PAT "*.git" -#define DEPEND_PAT "*DEPENDS" -#define TAR_GZ_PAT "*.tar.gz" -#define TAR_BZ2_PAT "*.tar.bz2" -#define CONFIG_SCRIPT "/tmp/pkg-build/configure" - -enum CommandType { - COMMAND_NONE, COMMAND_INSTALL, COMMAND_LIST, COMMAND_FETCH, - COMMAND_INIT, COMMAND_BUILD -}; - - -int Command_fetch(apr_pool_t *p, const char *url, int fetch_only); - -int Command_install(apr_pool_t *p, const char *url, const char *configure_opts, - const char *make_opts, const char *install_opts); - -int Command_depends(apr_pool_t *p, const char *path); - -int Command_build(apr_pool_t *p, const char *url, const char *configure_opts, - const char *make_opts, const char *install_opts); - -#endif diff --git a/oldstuff/lcthw-remnants/devpkg/db.c b/oldstuff/lcthw-remnants/devpkg/db.c deleted file mode 100644 index 3a5c333..0000000 --- a/oldstuff/lcthw-remnants/devpkg/db.c +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include -#include - -#include "db.h" -#include "bstrlib.h" -#include "dbg.h" - -static FILE *DB_open(const char *path, const char *mode) -{ - return fopen(path, mode); -} - - -static void DB_close(FILE *db) -{ - fclose(db); -} - - -static bstring DB_load(const char *path) -{ - FILE *db = NULL; - bstring data = NULL; - - db = DB_open(DB_FILE, "r"); - check(db, "Failed to open database: %s", DB_FILE); - - data = bread((bNread)fread, db); - check(data, "Failed to read from db file: %s", DB_FILE); - - DB_close(db); - return data; - -error: - if(db) DB_close(db); - if(data) bdestroy(data); - return NULL; -} - - -int DB_update(const char *url) -{ - if(DB_find(url)) { - log_info("Already recorded as installed: %s", url); - } - - FILE *db = DB_open(DB_FILE, "a+"); - check(db, "Failed to open DB file: %s", DB_FILE); - - bstring line = bfromcstr(url); - bconchar(line, '\n'); - int rc = fwrite(line->data, blength(line), 1, db); - check(rc == 1, "Failed to append to the db."); - - return 0; -error: - if(db) DB_close(db); - return -1; -} - - -int DB_find(const char *url) -{ - bstring data = NULL; - bstring line = bfromcstr(url); - int res = -1; - - data = DB_load(DB_FILE); - check(data, "Failed to load: %s", DB_FILE); - - if(binstr(data, 0, line) == BSTR_ERR) { - res = 0; - } else { - res = 1; - } - -error: //fallthrough - if(data) bdestroy(data); - if(line) bdestroy(line); - return res; -} - - -int DB_init() -{ - apr_pool_t *p = NULL; - apr_pool_initialize(); - apr_pool_create(&p, NULL); - - if(access(DB_DIR, W_OK | X_OK) == -1) { - apr_status_t rc = apr_dir_make_recursive(DB_DIR, - APR_UREAD | APR_UWRITE | APR_UEXECUTE | - APR_GREAD | APR_GWRITE | APR_GEXECUTE, p); - check(rc == APR_SUCCESS, "Failed to make database dir: %s", DB_DIR); - } - - if(access(DB_FILE, W_OK) == -1) { - FILE *db = DB_open(DB_FILE, "w"); - check(db, "Cannot open database: %s", DB_FILE); - DB_close(db); - } - - apr_pool_destroy(p); - return 0; - -error: - apr_pool_destroy(p); - return -1; -} - - -int DB_list() -{ - bstring data = DB_load(DB_FILE); - check(data, "Failed to read load: %s", DB_FILE); - - printf("%s", bdata(data)); - bdestroy(data); - return 0; - -error: - return -1; -} diff --git a/oldstuff/lcthw-remnants/devpkg/db.h b/oldstuff/lcthw-remnants/devpkg/db.h deleted file mode 100644 index 6318d62..0000000 --- a/oldstuff/lcthw-remnants/devpkg/db.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _db_h -#define _db_h - -#define DB_FILE "/usr/local/.devpkg/db" -#define DB_DIR "/usr/local/.devpkg" - - -int DB_init(); -int DB_list(); -int DB_update(const char *url); -int DB_find(const char *url); - -#endif diff --git a/oldstuff/lcthw-remnants/devpkg/dbg.h b/oldstuff/lcthw-remnants/devpkg/dbg.h deleted file mode 120000 index 459ed97..0000000 --- a/oldstuff/lcthw-remnants/devpkg/dbg.h +++ /dev/null @@ -1 +0,0 @@ -../dbg.h \ No newline at end of file diff --git a/oldstuff/lcthw-remnants/devpkg/devpkg.c b/oldstuff/lcthw-remnants/devpkg/devpkg.c deleted file mode 100644 index 4dbabfb..0000000 --- a/oldstuff/lcthw-remnants/devpkg/devpkg.c +++ /dev/null @@ -1,105 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "dbg.h" -#include "db.h" -#include "commands.h" - - -int main(int argc, const char const *argv[]) -{ - apr_pool_t *p = NULL; - apr_pool_initialize(); - apr_pool_create(&p, NULL); - - apr_getopt_t *opt; - apr_status_t rv; - - char ch = '\0'; - const char *optarg = NULL; - const char *config_opts = NULL; - const char *install_opts = NULL; - const char *make_opts = NULL; - const char *url = NULL; - enum CommandType request = COMMAND_NONE; - - rv = apr_getopt_init(&opt, p, argc, argv); - - while(apr_getopt(opt, "I:Lc:m:i:d:SF:B:", &ch, &optarg) == APR_SUCCESS) { - switch (ch) { - case 'I': - request = COMMAND_INSTALL; - url = optarg; - break; - - case 'L': - request = COMMAND_LIST; - break; - - case 'c': - config_opts = optarg; - break; - - case 'm': - make_opts = optarg; - break; - - case 'i': - install_opts = optarg; - break; - - case 'S': - request = COMMAND_INIT; - break; - - case 'F': - request = COMMAND_FETCH; - url = optarg; - break; - - case 'B': - request = COMMAND_BUILD; - url = optarg; - break; - } - } - - switch(request) { - case COMMAND_INSTALL: - check(url, "You must at least give a URL."); - Command_install(p, url, config_opts, make_opts, install_opts); - break; - - case COMMAND_LIST: - DB_list(); - break; - - case COMMAND_FETCH: - check(url != NULL, "You must give a URL."); - Command_fetch(p, url, 1); - log_info("Downloaded to %s and in /tmp/", BUILD_DIR); - break; - - case COMMAND_BUILD: - check(url, "You must at least give a URL."); - Command_build(p, url, config_opts, make_opts, install_opts); - break; - - case COMMAND_INIT: - rv = DB_init(); - check(rv == 0, "Failed to make the database."); - break; - - default: - sentinel("Invalid command given."); - } - - return 0; - -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants/devpkg/shell.c b/oldstuff/lcthw-remnants/devpkg/shell.c deleted file mode 100644 index 1bbe0ba..0000000 --- a/oldstuff/lcthw-remnants/devpkg/shell.c +++ /dev/null @@ -1,113 +0,0 @@ -#include "shell.h" -#include "dbg.h" -#include - -int Shell_exec(Shell template, ...) -{ - apr_pool_t *p = NULL; - apr_pool_create(&p, NULL); - - va_list argp; - const char *key = NULL; - const char *arg = NULL; - int i = 0; - - va_start(argp, template); - - for(key = va_arg(argp, const char*); - key != NULL; - key = va_arg(argp, const char *)) - { - arg = va_arg(argp, const char *); - - for(i = 0; template.args[i] != NULL; i++) { - if(strcmp(template.args[i], key) == 0) { - template.args[i] = arg; - break; // found it - } - } - } - - int rc = Shell_run(p, &template); - apr_pool_create(&p, NULL); - va_end(argp); - return rc; -} - - -int Shell_run(apr_pool_t *p, Shell *cmd) -{ - apr_procattr_t *attr; - apr_status_t rv; - apr_proc_t newproc; - - rv = apr_procattr_create(&attr, p); - check(rv == APR_SUCCESS, "Failed to create proc attr."); - - rv = apr_procattr_io_set(attr, APR_NO_PIPE, APR_NO_PIPE, - APR_NO_PIPE); - check(rv == APR_SUCCESS, "Failed to set IO of command."); - - rv = apr_procattr_dir_set(attr, cmd->dir); - check(rv == APR_SUCCESS, "Failed to set root to %s", cmd->dir); - - rv = apr_procattr_cmdtype_set(attr, APR_PROGRAM_PATH); - check(rv == APR_SUCCESS, "Failed to set cmd type."); - - rv = apr_proc_create(&newproc, cmd->exe, cmd->args, NULL, attr, p); - check(rv == APR_SUCCESS, "Failed to run command."); - - rv = apr_proc_wait(&newproc, &cmd->exit_code, &cmd->exit_why, APR_WAIT); - check(rv == APR_CHILD_DONE, "Failed to wait."); - - check(cmd->exit_code == 0, "%s exited badly.", cmd->exe); - check(cmd->exit_why == APR_PROC_EXIT, "%s was killed or crashed", cmd->exe); - - return 0; - -error: - return -1; -} - -Shell CLEANUP_SH = { - .exe = "rm", - .dir = "/tmp", - .args = {"rm", "-rf", "/tmp/pkg-build", "/tmp/pkg-src.tar.gz", - "/tmp/pkg-src.tar.bz2", "/tmp/DEPENDS", NULL} -}; - -Shell GIT_SH = { - .dir = "/tmp", - .exe = "git", - .args = {"git", "clone", "URL", "pkg-build", NULL} -}; - -Shell TAR_SH = { - .dir = "/tmp/pkg-build", - .exe = "tar", - .args = {"tar", "-xzf", "FILE", "--strip-components", "1", NULL} -}; - -Shell CURL_SH = { - .dir = "/tmp", - .exe = "curl", - .args = {"curl", "-L", "-o", "TARGET", "URL", NULL} -}; - -Shell CONFIGURE_SH = { - .exe = "./configure", - .dir = "/tmp/pkg-build", - .args = {"configure", "OPTS", NULL} -}; - -Shell MAKE_SH = { - .exe = "make", - .dir = "/tmp/pkg-build", - .args = {"make", "OPTS", NULL} -}; - -Shell INSTALL_SH = { - .exe = "sudo", - .dir = "/tmp/pkg-build", - .args = {"sudo", "make", "TARGET", NULL} -}; diff --git a/oldstuff/lcthw-remnants/devpkg/shell.h b/oldstuff/lcthw-remnants/devpkg/shell.h deleted file mode 100644 index a4301d3..0000000 --- a/oldstuff/lcthw-remnants/devpkg/shell.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _shell_h -#define _shell_h - -#define MAX_COMMAND_ARGS 100 - -#include - -typedef struct Shell { - const char *dir; - const char *exe; - - apr_procattr_t *attr; - apr_proc_t proc; - apr_exit_why_e exit_why; - int exit_code; - - const char *args[MAX_COMMAND_ARGS]; -} Shell; - -int Shell_run(apr_pool_t *p, Shell *cmd); -int Shell_exec(Shell cmd, ...); - -extern Shell CLEANUP_SH; -extern Shell GIT_SH; -extern Shell TAR_SH; -extern Shell CURL_SH; -extern Shell CONFIGURE_SH; -extern Shell MAKE_SH; -extern Shell INSTALL_SH; - -#endif diff --git a/oldstuff/lcthw-remnants/ex1.c b/oldstuff/lcthw-remnants/ex1.c deleted file mode 100644 index ea59ec4..0000000 --- a/oldstuff/lcthw-remnants/ex1.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int main() -{ - puts("Hello world."); - puts("Hello man."); - puts("Hello to you."); - puts("Hello woman."); - puts("Hello to the world of learning C the hard way, mkay?"); - puts("yup."); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex10.c b/oldstuff/lcthw-remnants/ex10.c deleted file mode 100644 index ebc964b..0000000 --- a/oldstuff/lcthw-remnants/ex10.c +++ /dev/null @@ -1,25 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int i = 0; - - // go through each string in argv - // why am I skipping argv[0]? - for(i = 0; i < argc; i++) { - printf("arg %d: %s\n", i, argv[i]); - } - - // let's make our own array of strings - char *states[] = { - "California", "Oregon", - "Washington", "Texas" - }; - int num_states = 4; - - for(i = 0; i < num_states; i++) { - printf("state %d: %s\n", i, states[i]); - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex11.c b/oldstuff/lcthw-remnants/ex11.c deleted file mode 100644 index eb4155d..0000000 --- a/oldstuff/lcthw-remnants/ex11.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - int i = 0; - while(i < argc) { - printf("arg %d: %s\n", i, argv[i]); - i++; - } - - char *states[] = { - "California", "Oregon", - "Washington", "Texas" - }; - - int num_states = 4; - i = 0; - while(i < num_states) { - printf("state %d: %s\n", i, states[i]); - i++; - } - - i = 0; - size_t l; - - while(i < num_states) { - l = strlen((char *)&(argv[i])); - strncpy((char *)&(states[i]), (char *)&(argv[i]), l); - printf("copied %s into state %d\n", states[i], i); - i++; - } - - i = 0; - while(i < num_states) { - printf("state %d: %s\n", i, states[i]); - i++; - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex12.c b/oldstuff/lcthw-remnants/ex12.c deleted file mode 100644 index 91e7b3e..0000000 --- a/oldstuff/lcthw-remnants/ex12.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int i = 0; - - if(argc == 1) { - printf("You only have one argument. You suck.\n"); - } else if(argc > 1 && argc < 4) { - printf("Here's your arguments:\n"); - - for (i = 0; i< argc; i++) { - printf("%s ", argv[i]); - } - printf("\n"); - } else { - printf("You have too many arguments. You suck.\n"); - } - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex13.c b/oldstuff/lcthw-remnants/ex13.c deleted file mode 100644 index 33356ad..0000000 --- a/oldstuff/lcthw-remnants/ex13.c +++ /dev/null @@ -1,62 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - if (argc < 2) { - fprintf(stderr, "ERROR: You must provide at least one argument.\n"); - return 1; - } - - int i; - int argn; - - char letter; - int up_low_sep = (int)('a' - 'A'); - int upper_floor = (int)'A'; - int upper_ceil = (int)'Z'; - - for(argn = 1; argn < argc; argn++) { - for(i = 0; '\0' != (letter = argv[argn][i]); i++) { - int i_letter = (int)letter; - if (upper_floor < i_letter && i_letter < upper_ceil) { - letter = (char)(i_letter + up_low_sep); - } - - switch(letter) { - case 'a': - printf("%d: 'a'\n", i); - break; - - case 'e': - printf("%d: 'e'\n", i); - break; - - case 'i': - printf("%d: 'i'\n", i); - break; - - case 'o': - printf("%d: 'o'\n", i); - break; - - case 'u': - printf("%d: 'u'\n", i); - break; - - case 'y': - if (i > 2) { - printf("%d: 'Y'\n", i); - } else { - printf("%d: 'Y' isn't a vowel this time\n", i); - } - break; - - default: - printf("%d: '%c' is not a vowel\n", i, letter); - } - } - } - - return 0; -} - diff --git a/oldstuff/lcthw-remnants/ex14.c b/oldstuff/lcthw-remnants/ex14.c deleted file mode 100644 index 403769b..0000000 --- a/oldstuff/lcthw-remnants/ex14.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include - -void print_letters(char arg[], int nchars); - -void print_arguments(int argc, char *argv[]) -{ - int i = 0; - - for(i = 0; i < argc; i++) { - print_letters(argv[i], strlen(argv[i])); - } -} - -void print_letters(char arg[], int nchars) -{ - int i = 0; - - for (i = 0; i < nchars; i++) { - char ch = arg[i]; - - if(isalpha(ch) || isblank(ch)) { - printf("'%c' == %d ", ch, ch); - } - } - - printf("\n"); -} - -int main(int argc, char *argv[]) -{ - print_arguments(argc, argv); - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex15.c b/oldstuff/lcthw-remnants/ex15.c deleted file mode 100644 index 8480c5d..0000000 --- a/oldstuff/lcthw-remnants/ex15.c +++ /dev/null @@ -1,89 +0,0 @@ -#include - -void print_with_array_indexing(int count, char **names, int *ages) -{ - int i = 0; - - // first way using indexing - while(i < count) { - printf("%s has %d years alive.\n", - names[i], ages[i]); - i++; - } - - printf("---\n"); -} - -void print_with_pointer_arithmetic(int count, char **names, int *ages) -{ - int i = 0; - // setup the pointers to the start of the arrays - int *cur_age = ages; - char **cur_name = names; - - // second way using pointers - while(i < count) { - printf("%s is %d years old.\n", - *(cur_name+i), *(cur_age+i)); - i++; - } - - printf("---\n"); -} - -void print_with_pointers_as_arrays(int count, char **names, int *ages) -{ - int i = 0; - int *cur_age = ages; - char **cur_name = names; - // third way, pointers are just arrays - while(i < count) { - printf("%s is %d years old again.\n", - cur_name[i], cur_age[i]); - i++; - } - - printf("---\n"); - -} - -void print_in_stupidly_complex_way(int count, char **names, int *ages) -{ - int *cur_age = ages; - char **cur_name = names; - - // fourth way with pointers in a stupid complex way - while((cur_age - ages) < count) { - printf("%s lived %d years so far.\n", - *cur_name++, *cur_age++); - } - - printf("---\n"); -} - - -int main(int argc, char *argv[]) -{ - // create two arrays we care about - int ages[] = {23, 43, 12, 89, 2}; - char *names[] = { - "Alan", "Frank", - "Mary", "John", "Lisa" - }; - // safely get the size of ages - int count = sizeof(ages) / sizeof(int); - - print_with_array_indexing(count, names, ages); - print_with_pointer_arithmetic(count, names, ages); - print_with_pointers_as_arrays(count, names, ages); - print_in_stupidly_complex_way(count, names, ages); - - int i; - char **arg = argv; - for(i = 0; i < argc; i++) { - printf("argument %d is '%s' (address = %p)\n", i, *arg, (void *)arg); - arg++; - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex16.c b/oldstuff/lcthw-remnants/ex16.c deleted file mode 100644 index 9b4c240..0000000 --- a/oldstuff/lcthw-remnants/ex16.c +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include - -struct Person { - char *name; - int age; - int height; - int weight; -}; - -struct Person *Person_create(char *name, int age, int height, int weight) -{ - struct Person *who = malloc(sizeof(struct Person)); - assert(who != NULL); - - who->name = strdup((char *)name); - who->age = age; - who->height = height; - who->weight = weight; - - return who; -} - -void Person_destroy(struct Person *who) -{ - assert(who != NULL); - - free(who->name); - free(who); -} - -void Person_print(struct Person *who) -{ - printf("Name: %s\n", who->name); - printf("\tAge: %d\n", who->age); - printf("\tHeight: %d\n", who->height); - printf("\tWeight: %d\n", who->weight); -} - -int main(int argc, char *argv[]) -{ - // make two people structures - struct Person *joe = Person_create( - "Joe Alex", 32, 64, 140); - - struct Person *frank = Person_create( - "Frank Blank", 20, 72, 180); - - // print them out and where they are in memory - printf("Joe is at memory location %p:\n", (void *)joe); - Person_print(joe); - - printf("Frank is at memory location %p:\n", (void *)frank); - Person_print(frank); - - // make everyone age 20 years and print them again - joe->age += 20; - joe->height -= 2; - joe->weight += 40; - Person_print(joe); - - frank->age += 20; - frank->weight += 20; - Person_print(frank); - - // destroy them both so we clean up - Person_destroy(joe); - Person_destroy(frank); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex17-ec.c b/oldstuff/lcthw-remnants/ex17-ec.c deleted file mode 100644 index 1eaece1..0000000 --- a/oldstuff/lcthw-remnants/ex17-ec.c +++ /dev/null @@ -1,239 +0,0 @@ -#include -#include -#include -#include -#include - -#define DEFAULT_MAX_DATA 512 -#define DEFAULT_MAX_ROWS 100 - -struct Address { - int id; - int set; - char *name; - char *email; -}; - -struct Database { - size_t size; - int max_data; - int max_rows; - struct Address *rows; -}; - -struct Connection { - FILE *file; - struct Database *db; -}; - -void Database_close(struct Connection *conn); - -void die(const char *message, struct Connection *conn) -{ - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - Database_close(conn); - - exit(1); -} - -void Address_print(struct Address *addr) -{ - printf("%d %s %s\n", - addr->id, addr->name, addr->email); -} - -void Database_load(struct Connection *conn) -{ - rewind(conn->file); - - int rc = fread(&conn->db->max_rows, sizeof(int), 1, conn->file); - if(rc != 1) die("Failed to load database max_rows.", conn); - - rc = fread(&conn->db->max_data, sizeof(int), 1, conn->file); - if(rc != 1) die("Failed to load database max_data.", conn); - - rc = fread(conn->db->rows, sizeof(struct Address), conn->db->max_rows, conn->file); - if(rc != 1) die("Failed to load database rows.", conn); -} - -struct Connection* Database_open(const char *filename, char mode, int max_rows) -{ - struct Connection *conn = malloc(sizeof(struct Connection)); - if(!conn) die("Memory error", conn); - - conn->db = malloc(sizeof(struct Database)); - if(!conn->db) die("Memory error", conn); - - size_t rowsize = max_rows * sizeof(struct Address); - conn->db->size = rowsize; - conn->db->rows = malloc(rowsize); - if(!conn->db->rows) die("Memory error", conn); - - if(mode == 'c') { - conn->file = fopen(filename, "w"); - } else { - conn->file = fopen(filename, "r+"); - - if(conn->file) { - Database_load(conn); - } - } - - if(!conn->file) die("Failed to open the file", conn); - - return conn; -} - -void Database_close(struct Connection *conn) -{ - if(conn != NULL) { - if(conn->file) fclose(conn->file); - if(conn->db) free(conn->db); - free(conn); - } -} - -void Database_write(struct Connection *conn) -{ - rewind(conn->file); - - int rc = fwrite(&conn->db->size, sizeof(size_t), 1, conn->file); - if(rc != 1) die("Failed to write database size.", conn); - - rc = fwrite(&conn->db->max_rows, sizeof(int), 1, conn->file); - if(rc != 1) die("Failed to write database max_rows.", conn); - - rc = fwrite(&conn->db->max_data, sizeof(int), 1, conn->file); - if(rc != 1) die("Failed to write database max_data.", conn); - - rc = fwrite(conn->db->rows, conn->db->size, 1, conn->file); - if(rc != 1) die("Failed to write database rows.", conn); - - rc = fflush(conn->file); - if(rc == -1) die("Cannot flush database.", conn); -} - -void Database_create(struct Connection *conn, int max_rows, int max_data) -{ - int i = 0; - conn->db->max_rows = max_rows; - conn->db->max_data = max_data; - - for(i = 0; i < conn->db->max_rows; i++) { - // make a prototype to initialize it - struct Address addr = {.id = i, .set = 0}; - // then just assign it - conn->db->rows[i] = addr; - } -} - -void Database_set(struct Connection *conn, int id, const char *name, const char *email) -{ - int max_data = conn->db->max_data; - struct Address *addr = &conn->db->rows[id]; - if(addr->set) die("Already set, delete it first", conn); - - addr->set = 1; - char *res = strncpy(addr->name, name, max_data); - if(!res) die("Name copy failed", conn); - addr->name[max_data - 1] = '\0'; - - res = strncpy(addr->email, email, max_data); - if(!res) die("Email copy failed", conn); - addr->email[max_data - 1] = '\0'; -} - -void Database_get(struct Connection *conn, int id) -{ - struct Address *addr = &conn->db->rows[id]; - - if(addr->set) { - Address_print(addr); - } else { - die("ID is not set", conn); - } -} - -void Database_delete(struct Connection *conn, int id) -{ - struct Address addr = {.id = id, .set = 0}; - conn->db->rows[id] = addr; -} - -void Database_list(struct Connection *conn) -{ - int i = 0; - struct Database *db = conn->db; - - for(i = 0; i < conn->db->max_rows; i++) { - struct Address *cur = &db->rows[i]; - - if(cur->set) { - Address_print(cur); - } - } -} - -int main(int argc, char *argv[]) -{ - if(argc < 3) die("USAGE: ex17 [:max_data,max_rows] [action params]", NULL); - - char *filename = argv[1]; - - int max_data = DEFAULT_MAX_DATA; - int max_rows = DEFAULT_MAX_ROWS; - - char action = argv[2][0]; - if(':' == argv[2][1]) { - sscanf(argv[2], "%c:%d,%d", &action, &max_data, &max_rows); - } - - struct Connection *conn = Database_open(filename, action, max_rows); - int id = 0; - - if(argc > 3) id = atoi(argv[3]); - if(id >= max_rows) die("There's not that many records.", conn); - - switch(action) { - case 'c': - Database_create(conn, max_rows, max_data); - Database_write(conn); - break; - - case 'g': - if(argc != 4) die("Need an id to get", conn); - - Database_get(conn, id); - break; - - case 's': - if(argc != 6) die("Need id, name, email to set", conn); - - Database_set(conn, id, argv[4], argv[5]); - Database_write(conn); - break; - - case 'd': - if(argc != 4) die("Need id to delete", conn); - - Database_delete(conn, id); - Database_write(conn); - break; - - case 'l': - Database_list(conn); - break; - default: - die("Invalid action, only: c=create, g=get, s=set, d=del, l=list", conn); - } - - Database_close(conn); - - return 0; -} - diff --git a/oldstuff/lcthw-remnants/ex17-ec1.c b/oldstuff/lcthw-remnants/ex17-ec1.c deleted file mode 100644 index aa360cb..0000000 --- a/oldstuff/lcthw-remnants/ex17-ec1.c +++ /dev/null @@ -1,201 +0,0 @@ -#include -#include -#include -#include -#include - -#define MAX_DATA 512 -#define MAX_ROWS 100 - -struct Address { - int id; - int set; - char name[MAX_DATA]; - char email[MAX_DATA]; -}; - -struct Database { - struct Address rows[MAX_ROWS]; -}; - -struct Connection { - FILE *file; - struct Database *db; -}; - -void Database_close(struct Connection *conn); - -void die(struct Connection *conn, const char *message) -{ - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - Database_close(conn); - exit(1); -} - -void Address_print(struct Address *addr) -{ - printf("%d %s %s\n", - addr->id, addr->name, addr->email); -} - -void Database_load(struct Connection *conn) -{ - int rc = fread(conn->db, sizeof(struct Database), 1, conn->file); - if(rc != 1) die(conn, "Failed to load database."); -} - -struct Connection* Database_open(const char *filename, char mode) -{ - struct Connection *conn = malloc(sizeof(struct Connection)); - if(!conn) die(NULL, "Memory error"); - - conn->db = malloc(sizeof(struct Database)); - if(!conn->db) die(conn, "Memory error"); - - if(mode == 'c') { - conn->file = fopen(filename, "w"); - } else { - conn->file = fopen(filename, "r+"); - - if(conn->file) { - Database_load(conn); - } - } - - if(!conn->file) die(conn, "Failed to open the file"); - - return conn; -} - -void Database_close(struct Connection *conn) -{ - if(conn) { - if(conn->file) fclose(conn->file); - if(conn->db) free(conn->db); - free(conn); - } -} - -void Database_write(struct Connection *conn) -{ - rewind(conn->file); - - int rc = fwrite(conn->db, sizeof(struct Database), 1, conn->file); - if(rc != 1) die(conn, "Failed to write database."); - - rc = fflush(conn->file); - if(rc == -1) die(conn, "Cannot flush database."); -} - -void Database_create(struct Connection *conn) -{ - int i = 0; - - for(i = 0; i < MAX_ROWS; i++) { - // make a prototype to initialize it - struct Address addr = {.id = i, .set = 0}; - // then just assign it - conn->db->rows[i] = addr; - } -} - -void Database_set(struct Connection *conn, int id, const char *name, const char *email) -{ - struct Address *addr = &conn->db->rows[id]; - if(addr->set) die(conn, "Already set, delete it first"); - - addr->set = 1; - // WARNING: bug, read the "How To Break It" and fix this - char *res = strncpy(addr->name, name, MAX_DATA); - // demonstrate the strncpy bug - if(!res) die(conn, "Name copy failed"); - - res = strncpy(addr->email, email, MAX_DATA); - if(!res) die(conn, "Email copy failed"); -} - -void Database_get(struct Connection *conn, int id) -{ - struct Address *addr = &conn->db->rows[id]; - - if(addr->set) { - Address_print(addr); - } else { - die(conn, "ID is not set"); - } -} - -void Database_delete(struct Connection *conn, int id) -{ - struct Address addr = {.id = id, .set = 0}; - conn->db->rows[id] = addr; -} - -void Database_list(struct Connection *conn) -{ - int i = 0; - struct Database *db = conn->db; - - for(i = 0; i < MAX_ROWS; i++) { - struct Address *cur = &db->rows[i]; - - if(cur->set) { - Address_print(cur); - } - } -} - -int main(int argc, char *argv[]) -{ - if(argc < 3) die(NULL, "USAGE: ex17 [action params]"); - - char *filename = argv[1]; - char action = argv[2][0]; - struct Connection *conn = Database_open(filename, action); - int id = 0; - - if(argc > 3) id = atoi(argv[3]); - if(id >= MAX_ROWS) die(conn, "There's not that many records."); - - switch(action) { - case 'c': - Database_create(conn); - Database_write(conn); - break; - - case 'g': - if(argc != 4) die(conn, "Need an id to get"); - - Database_get(conn, id); - break; - - case 's': - if(argc != 6) die(conn, "Need id, name, email to set"); - - Database_set(conn, id, argv[4], argv[5]); - Database_write(conn); - break; - - case 'd': - if(argc != 4) die(conn, "Need id to delete"); - - Database_delete(conn, id); - Database_write(conn); - break; - - case 'l': - Database_list(conn); - break; - default: - die(conn, "Invalid action, only: c=create, g=get, s=set, d=del, l=list"); - } - - Database_close(conn); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex17.c b/oldstuff/lcthw-remnants/ex17.c deleted file mode 100644 index 409a86a..0000000 --- a/oldstuff/lcthw-remnants/ex17.c +++ /dev/null @@ -1,198 +0,0 @@ -#include -#include -#include -#include -#include - -#define MAX_DATA 512 -#define MAX_ROWS 100 - -struct Address { - int id; - int set; - char name[MAX_DATA]; - char email[MAX_DATA]; -}; - -struct Database { - struct Address rows[MAX_ROWS]; -}; - -struct Connection { - FILE *file; - struct Database *db; -}; - -void die(const char *message) -{ - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -void Address_print(struct Address *addr) -{ - printf("%d %s %s\n", - addr->id, addr->name, addr->email); -} - -void Database_load(struct Connection *conn) -{ - int rc = fread(conn->db, sizeof(struct Database), 1, conn->file); - if(rc != 1) die("Failed to load database."); -} - -struct Connection* Database_open(const char *filename, char mode) -{ - struct Connection *conn = malloc(sizeof(struct Connection)); - if(!conn) die("Memory error"); - - conn->db = malloc(sizeof(struct Database)); - if(!conn->db) die("Memory error"); - - if(mode == 'c') { - conn->file = fopen(filename, "w"); - } else { - conn->file = fopen(filename, "r+"); - - if(conn->file) { - Database_load(conn); - } - } - - if(!conn->file) die("Failed to open the file"); - - return conn; -} - -void Database_close(struct Connection *conn) -{ - if(conn) { - if(conn->file) fclose(conn->file); - if(conn->db) free(conn->db); - free(conn); - } -} - -void Database_write(struct Connection *conn) -{ - rewind(conn->file); - - int rc = fwrite(conn->db, sizeof(struct Database), 1, conn->file); - if(rc != 1) die("Failed to write database."); - - rc = fflush(conn->file); - if(rc == -1) die("Cannot flush database."); -} - -void Database_create(struct Connection *conn) -{ - int i = 0; - - for(i = 0; i < MAX_ROWS; i++) { - // make a prototype to initialize it - struct Address addr = {.id = i, .set = 0}; - // then just assign it - conn->db->rows[i] = addr; - } -} - -void Database_set(struct Connection *conn, int id, const char *name, const char *email) -{ - struct Address *addr = &conn->db->rows[id]; - if(addr->set) die("Already set, delete it first"); - - addr->set = 1; - // WARNING: bug, read the "How To Break It" and fix this - char *res = strncpy(addr->name, name, MAX_DATA); - // demonstrate the strncpy bug - if(!res) die("Name copy failed"); - - res = strncpy(addr->email, email, MAX_DATA); - if(!res) die("Email copy failed"); -} - -void Database_get(struct Connection *conn, int id) -{ - struct Address *addr = &conn->db->rows[id]; - - if(addr->set) { - Address_print(addr); - } else { - die("ID is not set"); - } -} - -void Database_delete(struct Connection *conn, int id) -{ - struct Address addr = {.id = id, .set = 0}; - conn->db->rows[id] = addr; -} - -void Database_list(struct Connection *conn) -{ - int i = 0; - struct Database *db = conn->db; - - for(i = 0; i < MAX_ROWS; i++) { - struct Address *cur = &db->rows[i]; - - if(cur->set) { - Address_print(cur); - } - } -} - -int main(int argc, char *argv[]) -{ - if(argc < 3) die("USAGE: ex17 [action params]"); - - char *filename = argv[1]; - char action = argv[2][0]; - struct Connection *conn = Database_open(filename, action); - int id = 0; - - if(argc > 3) id = atoi(argv[3]); - if(id >= MAX_ROWS) die("There's not that many records."); - - switch(action) { - case 'c': - Database_create(conn); - Database_write(conn); - break; - - case 'g': - if(argc != 4) die("Need an id to get"); - - Database_get(conn, id); - break; - - case 's': - if(argc != 6) die("Need id, name, email to set"); - - Database_set(conn, id, argv[4], argv[5]); - Database_write(conn); - break; - - case 'd': - if(argc != 4) die("Need id to delete"); - - Database_delete(conn, id); - Database_write(conn); - break; - - case 'l': - Database_list(conn); - break; - default: - die("Invalid action, only: c=create, g=get, s=set, d=del, l=list"); - } - - Database_close(conn); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex18.c b/oldstuff/lcthw-remnants/ex18.c deleted file mode 100644 index f6735b3..0000000 --- a/oldstuff/lcthw-remnants/ex18.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include - - -void die(const char *message) -{ - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - - -typedef int (*compare_cb)(int a, int b); - - -int *bubble_sort(int *numbers, int count, compare_cb cmp) -{ - int temp = 0; - int i = 0; - int j = 0; - int *target = malloc(count * sizeof(int)); - - if(!target) die("Memory error."); - - memcpy(target, numbers, count * sizeof(int)); - - for(i = 0; i < count; i++) { - for(j = 0; j < count - 1; j++) { - if(cmp(target[j], target[j+1]) > 0) { - temp = target[j+1]; - target[j+1] = target[j]; - target[j] = temp; - } - } - } - - return target; -} - - -int sorted_order(int a, int b) -{ - return a - b; -} - - -int reverse_order(int a, int b) -{ - return b - a; -} - - -int strange_order(int a, int b) -{ - if(a == 0 || b == 0) { - return 0; - } else { - return a % b; - } -} - - -void test_sorting(int *numbers, int count, compare_cb cmp) -{ - int i = 0; - int *sorted = bubble_sort(numbers, count, cmp); - - if(!sorted) die("Failed to sort as requested."); - - for(i = 0; i < count; i++) { - printf("%d ", sorted[i]); - } - printf("\n"); - - free(sorted); - - unsigned char *data = (unsigned char *)&cmp; - - for(i = 0; i < 25; i++) { - printf("%0x:", data[i]); - } - printf("\n"); -} - - -int main(int argc, char *argv[]) -{ - if(argc < 2) die("USAGE: ex18 4 3 1 5 6"); - - int count = argc - 1; - int i = 0; - char **inputs = argv + 1; - - int *numbers = malloc(count * sizeof(int)); - if(!numbers) die("Memory error."); - - for(i = 0; i < count; i++) { - numbers[i] = atoi(inputs[i]); - } - - test_sorting(numbers, count, sorted_order); - test_sorting(numbers, count, reverse_order); - test_sorting(numbers, count, strange_order); - - free(numbers); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex19.c b/oldstuff/lcthw-remnants/ex19.c deleted file mode 100644 index 1615261..0000000 --- a/oldstuff/lcthw-remnants/ex19.c +++ /dev/null @@ -1,241 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "ex19.h" - - -int Monster_attack(void *self, int damage) -{ - assert(self != NULL); - assert(damage > -1); - - Monster *monster = self; - - printf("You attack %s!\n", monster->_(description)); - monster->hit_points -= damage; - - if(monster->hit_points > 0) { - printf("It is still alive.\n"); - return 0; - } else { - printf("It is dead!\n"); - return 1; - } -} - - -int Monster_init(void *self) -{ - assert(self != NULL); - - Monster *monster = self; - monster->hit_points = 10; - return 1; -} - - -Object MonsterProto = { - .init = Monster_init, - .attack = Monster_attack -}; - - -void *Room_move(void *self, Direction direction) -{ - assert(self != NULL); - - Room *room = self; - Room *next = NULL; - - if(direction == NORTH && room->north) { - printf("You go north, into:\n"); - next = room->north; - } else if(direction == SOUTH && room->south) { - printf("You go south, into:\n"); - next = room->south; - } else if(direction == EAST && room->east) { - printf("You go east, into:\n"); - next = room->east; - } else if(direction == WEST && room->west) { - printf("You go west, into:\n"); - next = room->west; - } else { - printf("You can't go that direction."); - next = NULL; - } - - if(next) { - next->_(describe)(next); - } else { - printf("mumble mumble.\n"); - } - - return next; -} - - -int Room_attack(void *self, int damage) -{ - assert(self != NULL); - assert(damage > -1); - - Room *room = self; - Monster *monster = room->bad_guy; - - if(monster) { - monster->_(attack)(monster, damage); - return 1; - } else { - printf("You flail in the air at nothing. Idiot.\n"); - return 0; - } -} - - -Object RoomProto = { - .move = Room_move, - .attack = Room_attack -}; - - -void *Map_move(void *self, Direction direction) -{ - assert(self != NULL); - - Map *map = self; - Room *location = map->location; - Room *next = NULL; - - next = location->_(move)(location, direction); - - if(next) { - map->location = next; - } else { - map->location = location; - } - - return next; -} - - -int Map_attack(void *self, int damage) -{ - assert(self != NULL); - assert(damage > -1); - - Map *map = self; - Room *location = map->location; - - return location->_(attack)(location, damage); -} - - -int Map_init(void *self) -{ - assert(self != NULL); - - Map *map = self; - - // make some rooms for a small map - Room *hall = NEW(Room, "The great Hall"); - Room *throne = NEW(Room, "The throne room"); - Room *arena = NEW(Room, "The arena, with the minotaur"); - Room *kitchen = NEW(Room, "Kitchen, you have the knife now"); - - // put the bad guy in the arena - arena->bad_guy = NEW(Monster, "The evil minotaur"); - - // setup the map rooms; - hall->north = throne; - - throne->west = arena; - throne->east = kitchen; - throne->south = hall; - - arena->east = throne; - kitchen->west = throne; - - // start the map and the character off in the hall - map->start = hall; - map->location = hall; - - return 1; -} - - -Object MapProto = { - .init = Map_init, - .move = Map_move, - .attack = Map_attack -}; - - -int process_input(Map *game) -{ - printf("\n> "); - - char ch = getchar(); - int damage = rand() % 4; - - switch(ch) { - case EOF: - printf("Giving up? You suck.\n"); - return 0; - break; - - case 'n': - game->_(move)(game, NORTH); - break; - - case 's': - game->_(move)(game, SOUTH); - break; - - case 'e': - game->_(move)(game, EAST); - break; - - case 'w': - game->_(move)(game, WEST); - break; - - case 'a': - game->_(attack)(game, damage); - break; - - case 'l': - printf("You can go:\n"); - if(game->location->north) printf("NORTH\n"); - if(game->location->south) printf("SOUTH\n"); - if(game->location->east) printf("EAST\n"); - if(game->location->west) printf("WEST\n"); - break; - - default: - printf("What?: %d\n", ch); - } - - getchar(); // eat ENTER - return 1; -} - - -int main(int argc, char *argv[]) -{ - // simple way to setup randomness - srand(time(NULL)); - - // make our map to work with - Map *game = NEW(Map, "The Hall of the Minotaur."); - - printf("You enter the "); - game->location->_(describe)(game->location); - - while(process_input(game)) { - } - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex19.h b/oldstuff/lcthw-remnants/ex19.h deleted file mode 100644 index 0131465..0000000 --- a/oldstuff/lcthw-remnants/ex19.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _ex19_h -#define _ex19_h - -#include "object.h" - - -struct Monster { - Object proto; - int hit_points; -}; - - -typedef struct Monster Monster; - - -int Monster_attack(void *self, int damage); -int Monster_init(void *self); - - -struct Room { - Object proto; - - Monster *bad_guy; - - struct Room *north; - struct Room *south; - struct Room *east; - struct Room *west; -}; - - -typedef struct Room Room; - - -void *Room_move(void *self, Direction direction); -int Room_attack(void *self, int damage); -int Room_init(void *self); - - -struct Map { - Object proto; - Room *start; - Room *location; -}; - - -typedef struct Map Map; - - -void *Map_move(void *self, Direction direction); -int Map_attack(void *self, int damage); -int Map_init(void *self); - -#endif diff --git a/oldstuff/lcthw-remnants/ex19.mk b/oldstuff/lcthw-remnants/ex19.mk deleted file mode 100644 index edcde16..0000000 --- a/oldstuff/lcthw-remnants/ex19.mk +++ /dev/null @@ -1,17 +0,0 @@ -CFLAGS := -Wall -g - -all: ex19 - - -ex19: object.o - - -test: - ./test_ex19.sh - - -clean: - rm -f ex19 object.o - - -.PHONY: all test clean diff --git a/oldstuff/lcthw-remnants/ex20.c b/oldstuff/lcthw-remnants/ex20.c deleted file mode 100644 index a89f6b6..0000000 --- a/oldstuff/lcthw-remnants/ex20.c +++ /dev/null @@ -1,125 +0,0 @@ -#include "dbg.h" -#include -#include - - -void test_debug() -{ - // notice you don't need the \n - debug("I have Brown Hair."); - - // passing in arguments like printf - debug("I am %d years old.", 37); -} - - -void test_log_err() -{ - log_err("I believe everything is broken."); - log_err("There are %d problems in %s.", 0, "space"); -} - - -void test_log_warn() -{ - log_warn("You can safely ignore this."); - log_warn("Maybe consider looking at: %s", "/etc/passwd"); -} - - -void test_log_info() -{ - log_info("Well I did something mundane."); - log_info("It happened %f times today.", 1.3f); -} - - -int test_check(char *file_name) -{ - FILE *input = NULL; - char *block = NULL; - - block = malloc(100); - check_mem(block); // should work - - input = fopen(file_name, "r"); - check(input, "Failed to open %s.", file_name); - - free(block); - fclose(input); - return 0; - -error: - if(block) free(block); - if(input) fclose(input); - return -1; -} - - -int test_sentinel(int code) -{ - char *temp = malloc(100); - check_mem(temp); - - switch(code) { - case 1: - log_info("It worked."); - break; - default: - sentinel("I shouldn't run."); - } - - free(temp); - return 0; - -error: - if(temp) free(temp); - return -1; -} - - -int test_check_mem() -{ - char *test = NULL; - check_mem(test); - - free(test); - return 1; - -error: - return -1; -} - - -int test_check_debug() -{ - int i = 0; - check_debug(i != 0, "Oops, I was 0."); - - return 0; -error: - return -1; -} - - -int main(int argc, char *argv[]) -{ - check(argc == 2, "Need an argument."); - - test_debug(); - test_log_err(); - test_log_warn(); - test_log_info(); - - check(test_check("ex20.c") == 0, "failed with ex20.c"); - check(test_check(argv[1]) == -1, "failed with argv"); - check(test_sentinel(1) == 0, "test_sentinel failed."); - check(test_sentinel(100) == -1, "test_sentinel failed."); - check(test_check_mem() == -1, "test_check_mem failed."); - check(test_check_debug() == -1, "test_check_debug failed."); - - return 0; - -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants/ex21.c b/oldstuff/lcthw-remnants/ex21.c deleted file mode 100644 index 82833cb..0000000 --- a/oldstuff/lcthw-remnants/ex21.c +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include - - -int main(int argc, char *argv[]) -{ - printf("sizeof(int8_t) = %ld\n", sizeof(int8_t)); - printf("sizeof(uint8_t) = %ld\n", sizeof(uint8_t)); - printf("sizeof(int16_t) = %ld\n", sizeof(int16_t)); - printf("sizeof(uint16_t) = %ld\n", sizeof(uint16_t)); - printf("sizeof(int32_t) = %ld\n", sizeof(int32_t)); - printf("sizeof(uint32_t) = %ld\n", sizeof(uint32_t)); -#if defined(_M_X64) || defined(__amd64__) - printf("sizeof(int64_t) = %ld\n", sizeof(int64_t)); - printf("sizeof(uint64_t) = %ld\n", sizeof(uint64_t)); -#endif - - printf("INT8_MAX = %d\n", INT8_MAX); - printf("INT16_MAX = %d\n", INT16_MAX); - printf("INT32_MAX = %d\n", INT32_MAX); -#if defined(_M_X64) || defined(__amd64__) - printf("INT64_MAX = %ld\n", INT64_MAX); -#endif - - printf("INT8_MIN = %d\n", INT8_MIN); - printf("INT16_MIN = %d\n", INT16_MIN); - printf("INT32_MIN = %d\n", INT32_MIN); -#if defined(_M_X64) || defined(__amd64__) - printf("INT64_MIN = %ld\n", INT64_MIN); -#endif - - printf("sizeof(int_least8_t) = %ld\n", sizeof(int_least8_t)); - printf("sizeof(int_least16_t) = %ld\n", sizeof(int_least16_t)); - printf("sizeof(int_least32_t) = %ld\n", sizeof(int_least32_t)); -#if defined(_M_X64) || defined(__amd64__) - printf("sizeof(int_least64_t) = %ld\n", sizeof(int_least64_t)); -#endif - - printf("sizeof(uint_least8_t) = %ld\n", sizeof(uint_least8_t)); - printf("sizeof(uint_least16_t) = %ld\n", sizeof(uint_least16_t)); - printf("sizeof(uint_least32_t) = %ld\n", sizeof(uint_least32_t)); -#if defined(_M_X64) || defined(__amd64__) - printf("sizeof(uint_least64_t) = %ld\n", sizeof(uint_least64_t)); -#endif - - printf("INT_LEAST8_MAX = %d\n", INT_LEAST8_MAX); - printf("INT_LEAST16_MAX = %d\n", INT_LEAST16_MAX); - printf("INT_LEAST32_MAX = %d\n", INT_LEAST32_MAX); -#if defined(_M_X64) || defined(__amd64__) - printf("INT_LEAST64_MAX = %ld\n", INT_LEAST64_MAX); -#endif - - printf("INT_LEAST8_MIN = %d\n", INT_LEAST8_MIN); - printf("INT_LEAST16_MIN = %d\n", INT_LEAST16_MIN); - printf("INT_LEAST32_MIN = %d\n", INT_LEAST32_MIN); -#if defined(_M_X64) || defined(__amd64__) - printf("INT_LEAST64_MIN = %ld\n", INT_LEAST64_MIN); -#endif - - printf("UINT_LEAST8_MAX = %d\n", UINT_LEAST8_MAX); - printf("UINT_LEAST16_MAX = %d\n", UINT_LEAST16_MAX); - printf("UINT_LEAST32_MAX = %d\n", UINT_LEAST32_MAX); -#if defined(_M_X64) || defined(__amd64__) - printf("UINT_LEAST64_MAX = %ld\n", UINT_LEAST64_MAX); -#endif - - printf("sizeof(int_fast8_t) = %ld\n", sizeof(int_fast8_t)); - printf("sizeof(int_fast16_t) = %ld\n", sizeof(int_fast16_t)); - printf("sizeof(int_fast32_t) = %ld\n", sizeof(int_fast32_t)); -#if defined(_M_X64) || defined(__amd64__) - printf("sizeof(int_fast64_t) = %ld\n", sizeof(int_fast64_t)); -#endif - - printf("sizeof(uint_fast8_t) = %ld\n", sizeof(uint_fast8_t)); - printf("sizeof(uint_fast16_t) = %ld\n", sizeof(uint_fast16_t)); - printf("sizeof(uint_fast32_t) = %ld\n", sizeof(uint_fast32_t)); -#if defined(_M_X64) || defined(__amd64__) - printf("sizeof(uint_fast64_t) = %ld\n", sizeof(uint_fast64_t)); -#endif - - printf("INT_FAST8_MAX = %d\n", INT_FAST8_MAX); - printf("INT_FAST16_MAX = %ld\n", INT_FAST16_MAX); - printf("INT_FAST32_MAX = %ld\n", INT_FAST32_MAX); -#if defined(_M_X64) || defined(__amd64__) - printf("INT_FAST64_MAX = %ld\n", INT_FAST64_MAX); -#endif - - printf("INT_FAST8_MAX = %d\n", INT_FAST8_MAX); - printf("INT_FAST16_MAX = %ld\n", INT_FAST16_MAX); - printf("INT_FAST32_MAX = %ld\n", INT_FAST32_MAX); -#if defined(_M_X64) || defined(__amd64__) - printf("INT_FAST64_MAX = %ld\n", INT_FAST64_MAX); -#endif - - printf("INT_FAST8_MIN = %d\n", INT_FAST8_MIN); - printf("INT_FAST16_MIN = %ld\n", INT_FAST16_MIN); - printf("INT_FAST32_MIN = %ld\n", INT_FAST32_MIN); -#if defined(_M_X64) || defined(__amd64__) - printf("INT_FAST64_MIN = %ld\n", INT_FAST64_MIN); -#endif - - printf("UINT_FAST8_MAX = %d\n", UINT_FAST8_MAX); - printf("UINT_FAST16_MAX = %ld\n", UINT_FAST16_MAX); - printf("UINT_FAST32_MAX = %ld\n", UINT_FAST32_MAX); -#if defined(_M_X64) || defined(__amd64__) - printf("UINT_FAST64_MAX = %ld\n", UINT_FAST64_MAX); -#endif - - printf("sizeof(intptr_t) = %ld\n", sizeof(intptr_t)); - printf("sizeof(uintptr_t) = %ld\n", sizeof(uintptr_t)); - printf("INTPTR_MAX = %ld\n", INTPTR_MAX); - printf("INTPTR_MIN = %ld\n", INTPTR_MIN); - printf("UINTPTR_MAX = %ld\n", UINTPTR_MAX); - printf("sizeof(intmax_t) = %ld\n", sizeof(intmax_t)); - printf("sizeof(uintmax_t) = %ld\n", sizeof(uintmax_t)); - printf("INTMAX_MAX = %ld\n", INTMAX_MAX); - printf("INTMAX_MIN = %ld\n", INTMAX_MIN); - printf("UINTMAX_MAX = %ld\n", UINTMAX_MAX); - printf("PTRDIFF_MIN = %ld\n", PTRDIFF_MIN); - printf("PTRDIFF_MAX = %ld\n", PTRDIFF_MAX); - printf("SIZE_MAX = %ld\n", SIZE_MAX); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex22.c b/oldstuff/lcthw-remnants/ex22.c deleted file mode 100644 index df5612c..0000000 --- a/oldstuff/lcthw-remnants/ex22.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include "ex22.h" -#include "dbg.h" - -int THE_SIZE = 1000; - -static int THE_AGE = 37; - - -int get_age() -{ - return THE_AGE; -} - - -int *get_age_pointer() -{ - return &THE_AGE; -} - - -void set_age(int age) -{ - THE_AGE = age; -} - - -double *get_function_static(double to_add) -{ - static double value = 1.0; - - double old = value; - value = value + to_add; - - return &value; -} - - -double update_ratio(double new_ratio) -{ - static double ratio = 1.0; - - double old_ratio = ratio; - ratio = new_ratio; - - return old_ratio; -} - -void print_size() -{ - log_info("I think size is: %d", THE_SIZE); -} diff --git a/oldstuff/lcthw-remnants/ex22.h b/oldstuff/lcthw-remnants/ex22.h deleted file mode 100644 index c89665f..0000000 --- a/oldstuff/lcthw-remnants/ex22.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _ex22_h -#define _ex22_h - -// makes THE_SIZE in ex22.c available to other .c files -int THE_SIZE; - -// gets and sets an internal static variable in ex22.c -int get_age(); -int * get_age_pointer(); -double * get_function_static(double); -void set_age(int age); - -// updates a static variable that's inside update_ratio -double update_ratio(double ratio); - -void print_size(); - -#endif diff --git a/oldstuff/lcthw-remnants/ex22.mk b/oldstuff/lcthw-remnants/ex22.mk deleted file mode 100644 index 5ef707f..0000000 --- a/oldstuff/lcthw-remnants/ex22.mk +++ /dev/null @@ -1,10 +0,0 @@ -all: ex22_main ex22_ec1 - - -ex22_main: ex22_main.o ex22.o - - -clean: - rm -f ex22_main ex22.o ex22_main.o ex22_ec1 - -.PHONY: all clean diff --git a/oldstuff/lcthw-remnants/ex22_ec1.c b/oldstuff/lcthw-remnants/ex22_ec1.c deleted file mode 100644 index c86c33b..0000000 --- a/oldstuff/lcthw-remnants/ex22_ec1.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include "dbg.h" - - -int pass_by_value(int n) -{ - n = n + 2; - return n; -} - - -int pass_by_reference(int *n) -{ - *n = *n + 8; - return *n; -} - - -int main(int argc, char *argv[]) -{ - int n = 2; - log_info("n = %d", n); - log_info("By value example: %d", pass_by_value(n)); - log_info("n = %d", n); - log_info("By reference example: %d", pass_by_reference(&n)); - log_info("n = %d", n); - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex22_main.c b/oldstuff/lcthw-remnants/ex22_main.c deleted file mode 100644 index 7b608e2..0000000 --- a/oldstuff/lcthw-remnants/ex22_main.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "ex22.h" -#include "dbg.h" - -const char *MY_NAME = "Zed A. Shaw"; - - -void scope_demo(int count) -{ - log_info("count is: %d", count); - - if(count > 10) { - int count = 100; // BAD! BUGS! - - log_info("count in this scope is %d", count); - } - - log_info("count is at exit: %d", count); - - count = 3000; - - log_info("count after assign: %d", count); -} - - -int main(int argc, char *argv[]) -{ - // test out THE_AGE accessors - log_info("My name: %s, age: %d", MY_NAME, get_age()); - - set_age(100); - - log_info("My age is now: %d", get_age()); - - int new_age = 44; - log_info("Setting age directly to %d", new_age); - int *age = get_age_pointer(); - *age = new_age; - - log_info("My age is now: %d", get_age()); - - // test out THE_SIZE extern - log_info("THE_SIZE is: %d", THE_SIZE); - print_size(); - - THE_SIZE = 9; - - log_info("THE_SIZE is now: %d", THE_SIZE); - print_size(); - - // test the ratio function static - log_info("Ratio at first: %f", update_ratio(2.0)); - log_info("Ratio again: %f", update_ratio(10.0)); - log_info("Ratio once more: %f", update_ratio(300.0)); - - // accessing a function static - double *func_static_value = get_function_static(4.0); - log_info("get_function_static(4.0) = %.1f", *func_static_value); - double new_func_static_value = 8.0; - log_info("Setting the function static var directly to %.1f", - new_func_static_value); - *func_static_value = new_func_static_value; - log_info("get_function_static(4.0) = %.1f", *get_function_static(4.0)); - - // test the scope demo - int count = 4; - scope_demo(count); - scope_demo(count * 20); - - log_info("count after calling scope_demo: %d", count); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex23.c b/oldstuff/lcthw-remnants/ex23.c deleted file mode 100644 index a6f373a..0000000 --- a/oldstuff/lcthw-remnants/ex23.c +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include "dbg.h" - - -int normal_copy(char *from, char *to, int count) -{ - int i = 0; - - for(i = 0; i < count; i++) { - to[i] = from[i]; - } - - return i; -} - - -int duffs_device(char *from, char *to, int count) -{ - { - int n = (count + 7) / 8; - - switch(count % 8) { - case 0: do { *to++ = *from++; - case 7: *to++ = *from++; - case 6: *to++ = *from++; - case 5: *to++ = *from++; - case 4: *to++ = *from++; - case 3: *to++ = *from++; - case 2: *to++ = *from++; - case 1: *to++ = *from++; - } while(--n > 0); - } - } - - return count; -} - -int zeds_device(char *from, char *to, int count) -{ - { - int n = (count + 7) / 8; - - switch(count % 8) { - case 0: - again: *to++ = *from++; - case 7: *to++ = *from++; - case 6: *to++ = *from++; - case 5: *to++ = *from++; - case 4: *to++ = *from++; - case 3: *to++ = *from++; - case 2: *to++ = *from++; - case 1: *to++ = *from++; - if(--n > 0) goto again; - } - } - - return count; -} - - -int valid_copy(char *data, int count, char expects) -{ - int i = 0; - for(i = 0; i < count; i++) { - if(data[i] != expects) { - log_err("[%d] %c != %c", i, data[i], expects); - return 0; - } - } - - return 1; -} - - -int main(int argc, char *argv[]) -{ - char from[1000] = {'a'}; - char to[1000] = {'c'}; - int rc = 0; - - // setup the from to have some stuff - memset(from, 'x', 1000); - // set it to a failure mode - memset(to, 'y', 1000); - check(valid_copy(to, 1000, 'y'), "Not initialized right."); - - // use normal copy to - rc = normal_copy(from, to, 1000); - check(rc == 1000, "Normal copy failed: %d", rc); - check(valid_copy(to, 1000, 'x'), "Normal copy failed"); - - // reset - memset(to, 'y', 1000); - - // duffs version - rc = duffs_device(from, to, 1000); - check(rc == 1000, "Duff's device failed: %d", rc); - check(valid_copy(to, 1000, 'x'), "Duff's device failed copy."); - - // reset - memset(to, 'y', 1000); - - // my version - rc = zeds_device(from, to, 1000); - check(rc == 1000, "Zed's device failed: %d", rc); - check(valid_copy(to, 1000, 'x'), "Zed's device failed copy."); - - log_info("DING!"); - return 0; -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants/ex24.c b/oldstuff/lcthw-remnants/ex24.c deleted file mode 100644 index 67b4dd6..0000000 --- a/oldstuff/lcthw-remnants/ex24.c +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include "dbg.h" - -#define MAX_DATA 100 - -typedef enum EyeColor { - BLUE_EYES, GREEN_EYES, BROWN_EYES, - BLACK_EYES, OTHER_EYES -} EyeColor; - -const char *EYE_COLOR_NAMES[] = { - "Blue", "Green", "Brown", "Black", "Other" -}; - -typedef struct Person { - int age; - char first_name[MAX_DATA]; - char last_name[MAX_DATA]; - EyeColor eyes; - float income; -} Person; - - -int main(int argc, char *argv[]) -{ - Person you = {.age = 0}; - int i = 0; - char *in = NULL; - char tmp[MAX_DATA]; - - printf("What's your First Name? "); - in = fgets(you.first_name, MAX_DATA-1, stdin); - check(in != NULL, "Failed to read first name."); - - printf("What's your Last Name? "); - in = fgets(you.last_name, MAX_DATA-1, stdin); - check(in != NULL, "Failed to read last name."); - - printf("How old are you? "); - in = fgets(tmp, MAX_DATA-1, stdin); - check(in != NULL, "Failed to read age."); - you.age = atoi(tmp); - check(you.age != -1, "Failed to convert age to int."); - - printf("What color are your eyes:\n"); - for(i = 0; i <= OTHER_EYES; i++) { - printf("%d) %s\n", i+1, EYE_COLOR_NAMES[i]); - } - printf("> "); - - int eyes = -1; - in = fgets(tmp, MAX_DATA-1, stdin); - check(in != NULL, "Failed to read eye color selection."); - eyes = atoi(tmp); - check(eyes <= OTHER_EYES && eyes > 0, "Do it right, that's not an option."); - you.eyes = eyes - 1; - - printf("How much do you make an hour? "); - in = fgets(tmp, MAX_DATA-1, stdin); - check(in != NULL, "Failed to read income."); - you.income = strtod(tmp, NULL); - check(you.income != -1, "Failed to convert income."); - - printf("----- RESULTS -----\n"); - printf("First Name: %s", you.first_name); - printf("Last Name: %s", you.last_name); - printf("Age: %d\n", you.age); - printf("Eyes: %s\n", EYE_COLOR_NAMES[you.eyes]); - printf("Income: %f\n", you.income); - - return 0; -error: - - return -1; -} diff --git a/oldstuff/lcthw-remnants/ex24_iofunctions01.c b/oldstuff/lcthw-remnants/ex24_iofunctions01.c deleted file mode 100644 index 3de50fa..0000000 --- a/oldstuff/lcthw-remnants/ex24_iofunctions01.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include "dbg.h" - - -int main(int argc, char *argv[]) -{ - int a, b, rc; - char c; - printf("Reading from stdin: \n> "); - rc = fscanf(stdin, "%d %d %c", &a, &b, &c); - check(rc == 3, "Failed to read from stdin."); - - printf("Read in: a=%d b=%d c=%c\n", a, b, c); - - return 0; - -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants/ex24_iofunctions02.c b/oldstuff/lcthw-remnants/ex24_iofunctions02.c deleted file mode 100644 index e1e21db..0000000 --- a/oldstuff/lcthw-remnants/ex24_iofunctions02.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "dbg.h" - - -int main(int argc, char *argv[]) -{ - int a, b, rc; - char c; - char filename[1024 * 2]; - FILE *fp; - - printf("Provide filename from which to inputs\n> "); - rc = fscanf(stdin, "%s", filename); - check(rc == 1, "Failed to read filename"); - fp = fopen(filename, "r"); - check(fp != NULL, "Failed to open file %s", filename); - - printf("Reading from file: \n"); - rc = fscanf(fp, "%d %d %c", &a, &b, &c); - check(rc == 3, "Failed to read from \"%s\".", filename); - - printf("Read in: a=%d b=%d c=%c\n", a, b, c); - rc = fclose(fp); - check(rc != EOF, "Failed to close file \"%s\"", filename); - - return 0; - -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants/ex24_iofunctions03.c b/oldstuff/lcthw-remnants/ex24_iofunctions03.c deleted file mode 100644 index 6413fc4..0000000 --- a/oldstuff/lcthw-remnants/ex24_iofunctions03.c +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include "dbg.h" - -#define MAX_FILENAME 2048 - - -int main(int argc, char *argv[]) -{ - int rc = -1; - char *filename; - int nchars = 0; - int nlines = 0; - int i; - long seekpos; - char c; - FILE *fp; - - check(argc > 1, "You must provide a filename as arg 1"); - filename = argv[1]; - - fp = fopen(filename, "r"); - check(fp != NULL, "Failed to open \"%s\".", filename); - - while((c = fgetc(fp)) != EOF) { - nchars++; - if (c == '\n') { - nlines++; - if (nlines % 10 == 0) { - printf("At line %d of \"%s\"\n", nlines, filename); - } - } - } - - printf("\"%s\" contains %d chars\n", filename, nchars); - - printf("Current position of \"%s\" is %ld\n", filename, ftell(fp)); - printf("Writing out \"%s\" in reverse:\n", filename); - - for (i = 0; i < nchars; i++) { - seekpos = (long)nchars - (i + 1); - rc = fseek(fp, seekpos, SEEK_SET); - check(rc != -1, "Failed to seek to %ld", seekpos); - c = fgetc(fp); - check(c != EOF, "Failed to read char at %ld", seekpos); - putc(c, stdout); - } - - rewind(fp); - printf("\n\nRewound \"%s\" to position %ld\n", filename, ftell(fp)); - - rc = fclose(fp); - check(rc != -1, "Failed to close \"%s\".", filename); - - - return 1; - -error: - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex24_iofunctions04.c b/oldstuff/lcthw-remnants/ex24_iofunctions04.c deleted file mode 100644 index 15e4608..0000000 --- a/oldstuff/lcthw-remnants/ex24_iofunctions04.c +++ /dev/null @@ -1,27 +0,0 @@ -#define _GNU_SOURCE -#include -#include "dbg.h" - - -int main(int argc, char *argv[]) -{ - int rc = -1; - printf("This should be visible, I think.\n"); - - rc = fcloseall(); - check(rc == 0, "Failed to close all io streams."); - printf("I've used `fcloseall`, so this should not be visible, right?\n"); - - rc = fflush(stdout); - check(rc != EOF, "Failed to flush stdout."); - printf("Maybe we won't see anything after I explicitly `fflush(stdout)`?\n"); - - rc = fclose(stdout); - check(rc != EOF, "Failed to explicitly close stdout."); - printf("This had better not show up, right?\n"); - - return 0; - -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants/ex24_iofunctions05.c b/oldstuff/lcthw-remnants/ex24_iofunctions05.c deleted file mode 100644 index d733709..0000000 --- a/oldstuff/lcthw-remnants/ex24_iofunctions05.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include "dbg.h" - - -int main(int argc, char *argv[]) -{ - FILE *fp; - char *filename; - check(argc == 2, "You must provide a filename for redirecting stdout."); - - filename = argv[1]; - fp = freopen(filename, "w", stdout); - check(fp != NULL, "Failed to reopen stdout as \"%s\"", filename); - - printf("This should be written to the file you specified!\n"); - - - return 0; - -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants/ex24_iofunctions06.c b/oldstuff/lcthw-remnants/ex24_iofunctions06.c deleted file mode 100644 index 3ae3cc7..0000000 --- a/oldstuff/lcthw-remnants/ex24_iofunctions06.c +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include -#include -#include -#include "dbg.h" - - -int main(int argc, char *argv[]) -{ - int fd; - int rc; - long lrc; - char *out; - char buffer[1024]; - fpos_t pos; - FILE *instream; - FILE *outstream; - - check(argc == 2, "You must provide a filename."); - - fd = open(argv[1], O_RDWR | O_CREAT); - check(fd != -1, "Unable to open \"%s\" for reading and writing.", argv[1]); - - rc = fchmod(fd, 0644); - check(rc != -1, "Failed to chmod \"%s\"", argv[1]); - - outstream = fdopen(fd, "w"); - check(outstream != NULL, "Unable to open an outstream."); - - rc = fgetpos(outstream, &pos); - check(rc != -1, "Failed to get position of outstream."); - - rc = fprintf(outstream, "It was written."); - check(rc > 0, "Failed to write to outstream."); - - rc = fflush(outstream); - check(rc != EOF, "Failed to flush outstream."); - - rc = fsetpos(outstream, &pos); - check(rc != -1, "Failed to set outstream back to old position."); - - instream = fdopen(fd, "r"); - check(instream != NULL, "Unable to open an instream."); - - rewind(instream); - lrc = ftell(instream); - check(lrc == 0, "Failed to rewind instream."); - - out = fgets(buffer, 1023, instream); - check(buffer != NULL, "Failed to read from instream."); - - printf("Read this from instream: \"%s\"\n", buffer); - - return 0; -error: - return 1; -} diff --git a/oldstuff/lcthw-remnants/ex25-fuzz-input b/oldstuff/lcthw-remnants/ex25-fuzz-input deleted file mode 100644 index 8ae8399..0000000 --- a/oldstuff/lcthw-remnants/ex25-fuzz-input +++ /dev/null @@ -1 +0,0 @@ -909 6LeaPin LizarDs1 170 202 SnArF61 LeaPin LizarDs 7LeaPin LizarDs2 39LeaPin LizarDs 710 6LeaPin LizarDs0 SnArF6LeaPin LizarDs 757 116 20 LeaPin LizarDs26 LeaPin LizarDsSnArF9 921 912 131 717 SnArF5SnArF 312 LeaPin LizarDsLeaPin LizarDs9 6LeaPin LizarDs7 731 9LeaPin LizarDs6 527 333 LeaPin LizarDsSnArFSnArF 77 LeaPin LizarDs3LeaPin LizarDs LeaPin LizarDsLeaPin LizarDs6 593 350 36 6SnArF 510 SnArF32 760 379 373 575 523 SnArF22 766 SnArF77 265 SnArF1SnArF SnArF27 6SnArF1 2SnArF6 557 67SnArF 590 69SnArF 235 976 67 9SnArFSnArF 156 SnArF07 673 1SnArF1 102 216 507 302 27LeaPin LizarDs 110 605 737 520 290 269 351 750 555 1LeaPin LizarDs2 33 SnArF31 691 SnArF10 73SnArF 22SnArF 1 SnArF69 275 LeaPin LizarDsLeaPin LizarDsLeaPin LizarDs 55SnArF 227 7SnArF3 3SnArFLeaPin LizarDs 975 907 99 255 SnArF90 LeaPin LizarDs07 7SnArF7 SnArF0LeaPin LizarDs 939 71 LeaPin LizarDs9 LeaPin LizarDs70 LeaPin LizarDs67 SnArF5LeaPin LizarDs 33LeaPin LizarDs SnArFLeaPin LizarDs2 359 299 31LeaPin LizarDs 5SnArF1 LeaPin LizarDs12 32LeaPin LizarDs 367 767 712 206 SnArFSnArF9 120 99LeaPin LizarDs 3LeaPin LizarDs5 SnArF99 32SnArF 9LeaPin LizarDs9 SnArF13 915 60LeaPin LizarDs 123 166 91 SnArF01 5SnArF7 151 9SnArF1 101 SnArF03 9LeaPin LizarDs2 60 306 SnArF51 715 9SnArF3 3SnArF1 532 277 LeaPin LizarDs9SnArF 36SnArF 576 266 122 LeaPin LizarDs77 716 SnArF59 97 675 9SnArF 7LeaPin LizarDs 732 9LeaPin LizarDs3 7LeaPin LizarDs0 75LeaPin LizarDs 723 796 619 27 17LeaPin LizarDs 90LeaPin LizarDs 6LeaPin LizarDs3 573 229 97SnArF 720 626 LeaPin LizarDs92 39 577 7SnArF2 LeaPin LizarDs09 739 551 56SnArF SnArF33 LeaPin LizarDs63 262 1LeaPin LizarDs 779 270 SnArF95 562 61 936 7SnArF0 15LeaPin LizarDs 251 670 LeaPin LizarDs50 191 129 1SnArF SnArF76 LeaPin LizarDs21 79 63LeaPin LizarDs 205 509 793 21LeaPin LizarDs 513 2LeaPin LizarDsSnArF 6LeaPin LizarDs9 5SnArF 506 26 20LeaPin LizarDs SnArF6SnArF 620 SnArF50 132 77LeaPin LizarDs 571 11LeaPin LizarDs LeaPin LizarDsSnArF6 LeaPin LizarDs19 556 135 LeaPin LizarDs20 319 953 12SnArF 5SnArF6 773 167 16LeaPin LizarDs 126 7LeaPin LizarDsLeaPin LizarDs 951 599 663 11SnArF LeaPin LizarDs11 703 5LeaPin LizarDs0 SnArF02 726 7SnArFSnArF 97LeaPin LizarDs 933 2LeaPin LizarDs0 1SnArF0 90SnArF 220 112 501 SnArF53 62SnArF 655 735 711 372 676 771 130 535 1LeaPin LizarDs3 903 SnArF70 35SnArF 6LeaPin LizarDs5 9LeaPin LizarDs 6SnArF3 652 633 56LeaPin LizarDs SnArFLeaPin LizarDs5 195 600 113 92LeaPin LizarDs 51SnArF 6 529 967 669 2LeaPin LizarDs2 991 273 521 37LeaPin LizarDs 332 300 SnArF60 76 932 677 LeaPin LizarDs00 5LeaPin LizarDsSnArF 539 3SnArF5 15SnArF LeaPin LizarDs27 923 707 72 5SnArF0 SnArF65 763 550 2SnArFLeaPin LizarDs 671 11 25 252 7LeaPin LizarDs9 237 396 LeaPin LizarDsLeaPin LizarDs 622 LeaPin LizarDs23 LeaPin LizarDs91 LeaPin LizarDs53 SnArF11 977 1LeaPin LizarDs7 1000 5LeaPin LizarDs1 597 52 LeaPin LizarDsSnArF1 LeaPin LizarDs90 SnArF6 665 616 LeaPin LizarDsSnArF 656 650 165 327 SnArF67 19 192 500 755 LeaPin LizarDsLeaPin LizarDs1 SnArF91 LeaPin LizarDs32 55LeaPin LizarDs LeaPin LizarDs35 95SnArF 7SnArF 609 377 37SnArF 659 1SnArF5 60SnArF 5 SnArFLeaPin LizarDs6 316 79SnArF SnArF16 SnArFSnArF1 2SnArF 50SnArF SnArF9 762 9LeaPin LizarDs7 9SnArFLeaPin LizarDs 35LeaPin LizarDs 959 31SnArF 317 993 SnArF3SnArF LeaPin LizarDs2SnArF SnArF23 LeaPin LizarDsLeaPin LizarDs2 13SnArF 3LeaPin LizarDsSnArF 5SnArF5 661 SnArF9LeaPin LizarDs 3SnArF9 2SnArF5 LeaPin LizarDs99 922 515 962 153 SnArF05 905 566 256 9SnArF2 LeaPin LizarDs31 LeaPin LizarDs10 775 LeaPin LizarDs30 137 70SnArF 261 3LeaPin LizarDs1 LeaPin LizarDs36 271 736 900 LeaPin LizarDs60 30LeaPin LizarDs 197 769 LeaPin LizarDs13 SnArFSnArF 7LeaPin LizarDsSnArF 2SnArFSnArF 9LeaPin LizarDsLeaPin LizarDs 92 292 719 76LeaPin LizarDs 207 2 355 567 9LeaPin LizarDs0 601 93 362 26SnArF SnArF3 3SnArF3 960 91LeaPin LizarDs 356 210 LeaPin LizarDs59 65LeaPin LizarDs 997 307 70LeaPin LizarDs 5LeaPin LizarDs6 236 331 LeaPin LizarDs7 23LeaPin LizarDs LeaPin LizarDs3 961 SnArFLeaPin LizarDsLeaPin LizarDs 10 761 696 13LeaPin LizarDs 7LeaPin LizarDs5 6SnArF6 627 106 1SnArF6 SnArFSnArFLeaPin LizarDs LeaPin LizarDs71 259 79LeaPin LizarDs 175 5SnArF9 27SnArF 179 12 LeaPin LizarDs69 9SnArF9 3LeaPin LizarDs6 SnArF92 371 12LeaPin LizarDs SnArF21 LeaPin LizarDs0 530 337 LeaPin LizarDs01 67LeaPin LizarDs 701 225 69LeaPin LizarDs 3LeaPin LizarDs3 3SnArF7 309 6LeaPin LizarDsLeaPin LizarDs LeaPin LizarDs93 SnArFSnArFSnArF 9SnArF7 LeaPin LizarDs76 322 533 320 19SnArF 76SnArF LeaPin LizarDs39 631 552 591 399 926 911 365 51 169 636 791 2SnArF0 3LeaPin LizarDs9 200 LeaPin LizarDs0SnArF SnArF0SnArF 5LeaPin LizarDs2 272 72SnArF LeaPin LizarDs6LeaPin LizarDs 2LeaPin LizarDs1 150 LeaPin LizarDs55 361 SnArFSnArF6 325 71SnArF 910 1LeaPin LizarDs1 LeaPin LizarDsLeaPin LizarDs5 73 LeaPin LizarDs29 516 931 956 LeaPin LizarDs72 59 3SnArF2 2SnArF7 336 565 LeaPin LizarDsSnArFLeaPin LizarDs LeaPin LizarDs17 666 19LeaPin LizarDs 792 639 SnArFLeaPin LizarDs 13 752 16SnArF LeaPin LizarDs22 37 970 305 7LeaPin LizarDs3 SnArFLeaPin LizarDs1 257 5LeaPin LizarDs5 390 296 1LeaPin LizarDs0 375 56 53LeaPin LizarDs 303 75SnArF LeaPin LizarDs15 770 725 759 729 3SnArF 155 6SnArFSnArF 610 511 293 95LeaPin LizarDs 66LeaPin LizarDs LeaPin LizarDs02 63 657 579 LeaPin LizarDsSnArF0 LeaPin LizarDs97 62 66SnArF 9 2SnArF1 LeaPin LizarDs9LeaPin LizarDs 5LeaPin LizarDsLeaPin LizarDs 517 223 6LeaPin LizarDs 795 6SnArF0 930 250 9SnArF6 635 136 SnArF30 995 5SnArF3 502 5SnArFLeaPin LizarDs LeaPin LizarDsLeaPin LizarDs0 7LeaPin LizarDs6 105 SnArF71 531 519 190 9LeaPin LizarDsSnArF 65 797 706 201 301 31 695 LeaPin LizarDs61 1SnArFSnArF 66 776 SnArF39 SnArF15 21SnArF 963 SnArFSnArF3 6SnArF7 57SnArF 662 6SnArFLeaPin LizarDs 751 702 212 107 10LeaPin LizarDs 5SnArFSnArF 1LeaPin LizarDsSnArF LeaPin LizarDs79 71LeaPin LizarDs SnArF29 721 73LeaPin LizarDs 2SnArF2 SnArF56 SnArFSnArF5 16 1LeaPin LizarDs9 30 2LeaPin LizarDs6 LeaPin LizarDsLeaPin LizarDs3 LeaPin LizarDs5 353 3SnArFSnArF 92SnArF LeaPin LizarDs1SnArF 6LeaPin LizarDsSnArF 20SnArF 6SnArF2 3SnArF6 335 SnArF63 176 9SnArF5 111 919 SnArF06 17SnArF 2LeaPin LizarDs 22 2LeaPin LizarDs5 629 990 196 SnArF3LeaPin LizarDs 52LeaPin LizarDs LeaPin LizarDs65 709 LeaPin LizarDsLeaPin LizarDsSnArF 906 LeaPin LizarDs03 172 SnArF09 LeaPin LizarDs2 109 321 5LeaPin LizarDs7 525 LeaPin LizarDs16 1SnArF2 1LeaPin LizarDs6 53SnArF 36LeaPin LizarDs 603 159 360 6LeaPin LizarDs6 2SnArF3 522 263 1SnArF7 93SnArF 1LeaPin LizarDs5 213 215 637 LeaPin LizarDsSnArF3 6SnArF5 222 3 311 1SnArF3 209 1LeaPin LizarDsLeaPin LizarDs LeaPin LizarDs62 LeaPin LizarDsSnArF2 LeaPin LizarDs6SnArF 7LeaPin LizarDs1 526 326 LeaPin LizarDsSnArF7 LeaPin LizarDs06 3LeaPin LizarDs2 LeaPin LizarDs66 SnArF57 75 119 SnArF1 LeaPin LizarDs96 29SnArF 230 SnArF2LeaPin LizarDs 91SnArF 700 29LeaPin LizarDs LeaPin LizarDs95 667 171 125 920 570 SnArF19 705 LeaPin LizarDs51 569 SnArF7 592 39SnArF 25SnArF 607 7LeaPin LizarDs7 276 279 231 100 3LeaPin LizarDs LeaPin LizarDs75 SnArF1LeaPin LizarDs 177 96SnArF LeaPin LizarDs0LeaPin LizarDs SnArF5 163 226 611 23 59LeaPin LizarDs SnArF9SnArF 203 660 560 727 25LeaPin LizarDs 952 239 51LeaPin LizarDs 7SnArF6 SnArF35 173 SnArF55 2LeaPin LizarDs3 3LeaPin LizarDs7 SnArFLeaPin LizarDs0 SnArF97 615 SnArF96 697 291 972 LeaPin LizarDs7LeaPin LizarDs 61LeaPin LizarDs 29 SnArF7LeaPin LizarDs 376 32 162 5SnArF2 1SnArF9 15 9SnArF0 LeaPin LizarDs57 672 297 SnArF 971 SnArF62 772 157 553 357 902 211 692 SnArF12 2SnArF9 2LeaPin LizarDsLeaPin LizarDs 267 121 33SnArF 370 330 9LeaPin LizarDs1 26LeaPin LizarDs 973 50LeaPin LizarDs SnArFLeaPin LizarDs3 SnArF2SnArF SnArF26 7SnArF5 965 217 SnArFLeaPin LizarDsSnArF LeaPin LizarDs05 563 612 SnArF17 SnArF72 95 LeaPin LizarDs33 777 329 722 559 96LeaPin LizarDs 7SnArF9 133 621 SnArF93 3SnArF0 651 606 339 9LeaPin LizarDs5 21 950 160 935 937 93LeaPin LizarDs 127 117 LeaPin LizarDs5LeaPin LizarDs 653 916 10SnArF 221 23SnArF 6LeaPin LizarDs2 SnArF00 969 7SnArF1 SnArF52 901 90 LeaPin LizarDs7SnArF 537 602 392 996 3LeaPin LizarDs0 65SnArF 219 161 756 369 925 505 397 SnArF0 623 LeaPin LizarDs3SnArF 313 17 7 2LeaPin LizarDs9 693 595 966 103 630 SnArF75 503 52SnArF SnArF20 7SnArFLeaPin LizarDs 115 955 53 713 391 625 LeaPin LizarDs2LeaPin LizarDs SnArF36 5LeaPin LizarDs3 310 69 SnArF73 62LeaPin LizarDs 753 99SnArF 512 999 536 SnArF7SnArF 30SnArF 561 72LeaPin LizarDs LeaPin LizarDs25 63SnArF SnArFLeaPin LizarDs9 929 917 LeaPin LizarDs56 193 SnArFLeaPin LizarDs7 979 LeaPin LizarDs73 LeaPin LizarDs6 57 613 SnArFSnArF7 2LeaPin LizarDs7 232 SnArF37 260 LeaPin LizarDsLeaPin LizarDs7 55 913 799 315 57LeaPin LizarDs 199 957 SnArF79 LeaPin LizarDs37 366 50 70 596 SnArFSnArF0 152 SnArF66 295 690 679 139 5LeaPin LizarDs 96 SnArF25 233 LeaPin LizarDs5SnArF 3LeaPin LizarDsLeaPin LizarDs 992 LeaPin LizarDsSnArF5 617 363 35 253 LeaPin LizarDs1 SnArF2 323 395 632 765 393 SnArFSnArF2 77SnArF 790 1SnArFLeaPin LizarDs 927 699 5LeaPin LizarDs9 22LeaPin LizarDs 352 733 572 LeaPin LizarDs1LeaPin LizarDs 59SnArF 6SnArF9 730 LeaPin LizarDs52 61SnArF diff --git a/oldstuff/lcthw-remnants/ex25.c b/oldstuff/lcthw-remnants/ex25.c deleted file mode 100644 index d940368..0000000 --- a/oldstuff/lcthw-remnants/ex25.c +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include -#include -#include "dbg.h" - -#define MAX_DATA 100 - - -int read_string(char **out_string, int max_buffer) -{ - *out_string = calloc(1, max_buffer + 1); - check_mem(*out_string); - - char *result = fgets(*out_string, max_buffer, stdin); - check(result != NULL, "Input error."); - - return 0; - -error: - if(*out_string) free(*out_string); - *out_string = NULL; - return -1; -} - - -int read_int(int *out_int) -{ - char *input = NULL; - int rc = read_string(&input, MAX_DATA); - check(rc == 0, "Failed to read number."); - - *out_int = atoi(input); - - free(input); - return 0; - -error: - if(input) free(input); - return -1; -} - - -int read_scan(const char *fmt, ...) -{ - int i = 0; - int rc = 0; - int *out_int = NULL; - char *out_char = NULL; - char **out_string = NULL; - int max_buffer = 0; - - va_list argp; - va_start(argp, fmt); - - for(i = 0; fmt[i] != '\0'; i++) { - if(fmt[i] == '%') { - i++; - switch(fmt[i]) { - case '\0': - sentinel("Invalid format, you ended with %%."); - break; - - case 'd': - out_int = va_arg(argp, int *); - rc = read_int(out_int); - check(rc == 0, "Failed to read int."); - break; - - case 'c': - out_char = va_arg(argp, char *); - *out_char = fgetc(stdin); - break; - - case 's': - max_buffer = va_arg(argp, int); - out_string = va_arg(argp, char**); - rc = read_string(out_string, max_buffer); - check(rc == 0, "Failed to read string."); - break; - - default: - sentinel("Invalid format."); - } - } else { - fgetc(stdin); - } - - check(!feof(stdin) && !ferror(stdin), "Input error."); - } - - va_end(argp); - return 0; - -error: - va_end(argp); - return -1; -} - - -int main(int argc, char *argv[]) -{ - char *first_name = NULL; - char initial = ' '; - char *last_name = NULL; - int age = 0; - - printf("What's your first name? "); - int rc = read_scan("%s", MAX_DATA, &first_name); - check(rc == 0, "Failed first name."); - - printf("What's your initial? "); - rc = read_scan("%c\n", &initial); - check(rc == 0, "Failed initial."); - - printf("What's your last name? "); - rc = read_scan("%s", MAX_DATA, &last_name); - check(rc == 0, "Failed last name."); - - printf("How old are you? "); - rc = read_scan("%d", &age); - check(rc == 0, "Failed age."); - - printf("---- RESULTS ----\n"); - printf("First Name: %s", first_name); - printf("Initial: '%c'\n", initial); - printf("Last Name: %s", last_name); - printf("Age: %d\n", age); - - free(first_name); - free(last_name); - return 0; - -error: - return -1; -} diff --git a/oldstuff/lcthw-remnants/ex3.c b/oldstuff/lcthw-remnants/ex3.c deleted file mode 100644 index df2f7ef..0000000 --- a/oldstuff/lcthw-remnants/ex3.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() -{ - int age = 10; - int height = 72; - - printf("I am %d years old.\n", age); - printf("I am %d inches tall.\n", height); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex4.c b/oldstuff/lcthw-remnants/ex4.c deleted file mode 100644 index df2f7ef..0000000 --- a/oldstuff/lcthw-remnants/ex4.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() -{ - int age = 10; - int height = 72; - - printf("I am %d years old.\n", age); - printf("I am %d inches tall.\n", height); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex4.sh b/oldstuff/lcthw-remnants/ex4.sh deleted file mode 100644 index c32c4e1..0000000 --- a/oldstuff/lcthw-remnants/ex4.sh +++ /dev/null @@ -1,20 +0,0 @@ -# 1) Download it (use wget if you don't have curl) -curl -O http://valgrind.org/downloads/valgrind-3.7.0.tar.bz2 - -# use md5sum to make sure it matches the one on the site -md5sum valgrind-3.7.0.tar.bz2 - -# 2) Unpack it. -tar -xjvf valgrind-3.7.0.tar.bz2 - -# cd into the newly created directory -cd valgrind-3.7.0 - -# 3) configure it -./configure - -# 4) make it -make - -# 5) install it (need root) -sudo make install diff --git a/oldstuff/lcthw-remnants/ex5.c b/oldstuff/lcthw-remnants/ex5.c deleted file mode 100644 index ac12e73..0000000 --- a/oldstuff/lcthw-remnants/ex5.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -/* This is a comment. */ -int main(int argc, char *argv[]) -{ - int distance = 100; - - // this is also a comment - printf("You are %d miles away.\n", distance); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex6.c b/oldstuff/lcthw-remnants/ex6.c deleted file mode 100644 index 118d615..0000000 --- a/oldstuff/lcthw-remnants/ex6.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int distance = 0xaf + 0747; - float power = 2.345f + 'Z' + 'A' + 'P'; - double super_power = 56789.4532f; - char initial = 'A'; - char first_name[] = "Zed"; - char last_name[] = {'S', 'h', 'a', 'w', '\0'}; - - printf("You are %08d miles away.\n", distance); - printf("You have %.2f levels of power.\n", power); - printf("You have %.3f awesome super powers.\n", super_power); - printf("I have an initial %c.\n", initial); - printf("I have a first name %s.\n", first_name); - printf("I have a last name %s.\n", last_name); - printf("My whole name is %s %c. %s.\n", - first_name, initial, last_name); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex7.c b/oldstuff/lcthw-remnants/ex7.c deleted file mode 100644 index b6e9cfe..0000000 --- a/oldstuff/lcthw-remnants/ex7.c +++ /dev/null @@ -1,36 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int bugs = 100; - double bug_rate = 1.2; - - printf("You have %d bugs imaginary rate of %f.\n", - bugs, bug_rate); - - unsigned long universe_of_defects = 63.99999999999 * 32 * 1024 * 1024; - printf("The entire universe has %ld bugs.\n", - universe_of_defects); - - double expected_bugs = bugs * bug_rate; - printf("You are expected to have %f bugs.\n", - expected_bugs); - - double part_of_universe = expected_bugs / universe_of_defects; - printf("That is only a %e portion of the universe.\n", - part_of_universe); - - // this makes no sense, just a demo of something weird - char nul_byte = '\0'; - int care_percentage = bugs * nul_byte; - printf("Which means you should care %d%%.\n", - care_percentage); - - puts("also..."); - int nul = (int)nul_byte; - int *nul_ptr = &nul; - printf("char '\\0' = '%c', (int)'\\0' = '%d', &(int)'\\0' = '%n'.\n", - nul_byte, nul, nul_ptr); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex8.c b/oldstuff/lcthw-remnants/ex8.c deleted file mode 100644 index 0b42543..0000000 --- a/oldstuff/lcthw-remnants/ex8.c +++ /dev/null @@ -1,58 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int areas[] = {10, 12, 13, 14, 20}; - char name[] = "Zed"; - char full_name[] = { - 'Z', 'e', 'd', - ' ', 'A', '.', ' ', - 'S', 'h', 'a', 'w', '\0' - }; - - // WARNING: On some systems you may have to change the - // %ld in this code to a %u since it will use unsigned ints - printf("The size of an int: %ld\n", sizeof(int)); - printf("The size of areas (int[]): %ld\n", - sizeof(areas)); - printf("The number of ints in areas: %ld\n", - sizeof(areas) / sizeof(int)); - printf("The first area is %d, then 2nd %d.\n", - areas[0], areas[1]); - areas[0] = 100; - areas[2] = areas[1]; - printf("Now the first area is %d and the 3rd area is %d.\n", - areas[0], areas[2]); - - printf("The size of char: %ld\n", sizeof(char)); - printf("The size of name (char[]): %ld\n", - sizeof(name)); - printf("The number of chars: %ld\n", - sizeof(name) / sizeof(char)); - - printf("The size of full_name (char[]): %ld\n", - sizeof(full_name)); - printf("The number of chars: %ld\n", - sizeof(full_name) / sizeof(char)); - - printf("name=\"%s\" and full_name=\"%s\"\n", - name, full_name); - - printf("name[0] is %c.\n", name[0]); - printf("full_name[7] is %c.\n", full_name[7]); - - name[0] = 'X'; - printf("Now name[0] is %c.\n", name[0]); - - full_name[7] = 'T'; - printf("Now full_name[7] is %c.\n", full_name[7]); - - printf("name=\"%s\" and full_name=\"%s\"\n", - name, full_name); - - areas[2] = name[0]; - printf("First area is now name[0]: %%c=%c, %%d=%d.\n", - areas[2], areas[2]); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/ex9.c b/oldstuff/lcthw-remnants/ex9.c deleted file mode 100644 index 7ea8227..0000000 --- a/oldstuff/lcthw-remnants/ex9.c +++ /dev/null @@ -1,60 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - int numbers[4] = {0}; - char name[4] = {'a'}; - - // first, print them out raw - printf("numbers: %d %d %d %d\n", - numbers[0], numbers[1], - numbers[2], numbers[3]); - - printf("name each: %c %c %c %c\n", - name[0], name[1], - name[2], name[3]); - - printf("name: %s\n", name); - - // setup the numbers - numbers[0] = 1; - numbers[1] = 2; - numbers[2] = 3; - numbers[3] = 4; - - // setup the name - name[0] = 'Z'; - name[1] = 'e'; - name[2] = 'd'; - name[3] = '\0'; - - printf("%d\n", name[0]); - printf("%d\n", name[1]); - printf("%d\n", name[2]); - printf("%d\n", name[3]); - - printf("name as int=%d\n", (int)*name); - - // then print them out initialized - printf("numbers: %d %d %d %d\n", - numbers[0], numbers[1], - numbers[2], numbers[3]); - - printf("name each: %c %c %c %c\n", - name[0], name[1], - name[2], name[3]); - - // print the name like a string - printf("name: %s\n", name); - - // another way to use name - char *another = "Zed"; - - printf("another: %s\n", another); - - printf("another each: %c %c %c %c\n", - another[0], another[1], - another[2], another[3]); - - return 0; -} diff --git a/oldstuff/lcthw-remnants/iofunctions.txt b/oldstuff/lcthw-remnants/iofunctions.txt deleted file mode 100644 index e9c7947..0000000 --- a/oldstuff/lcthw-remnants/iofunctions.txt +++ /dev/null @@ -1,14 +0,0 @@ -fscanf -fgets -fopen -freopen -fdopen -fclose -fcloseall -fgetpos -fseek -ftell -rewind -fprintf -fwrite -fread diff --git a/oldstuff/lcthw-remnants/object.c b/oldstuff/lcthw-remnants/object.c deleted file mode 100644 index 63db33e..0000000 --- a/oldstuff/lcthw-remnants/object.c +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include -#include -#include "object.h" -#include - - -void Object_destroy(void *self) -{ - assert(self != NULL); - - Object *obj = self; - - if(obj) { - if(obj->description) free(obj->description); - free(obj); - } -} - - -void Object_describe(void *self) -{ - assert(self != NULL); - - Object *obj = self; - printf("%s\n", obj->description); -} - - -int Object_init(void *self) -{ - assert(self != NULL); - - // do nothing really - return 1; -} - - -void *Object_move(void *self, Direction direction) -{ - assert(self != NULL); - assert(direction); - - printf("You can't go that direction.\n"); - return NULL; -} - - -int Object_attack(void *self, int damage) -{ - assert(self != NULL); - assert(damage); - - printf("You can't attack that.\n"); - return 0; -} - - -void *Object_new(size_t size, Object proto, char *description) -{ - assert(size); - assert(description != NULL); - - // setup the default functions in case they aren't set - if(!proto.init) proto.init = Object_init; - if(!proto.describe) proto.describe = Object_describe; - if(!proto.destroy) proto.destroy = Object_destroy; - if(!proto.attack) proto.attack = Object_attack; - if(!proto.move) proto.move = Object_move; - - // this seems weird, but we can make a struct of one size, - // then point a different pointer at it to "cast" it - Object *el = calloc(size, 1); - assert(el != NULL); - *el = proto; - - // copy the description over - el->description = strdup(description); - assert(el->description != NULL); - - // initialize it with whatever init we were given - if(!el->init(el)) { - // looks like it didn't initialize properly - el->destroy(el); - return NULL; - } else { - // all done, we made an object of any type - assert(el != NULL); - return el; - } -} diff --git a/oldstuff/lcthw-remnants/object.h b/oldstuff/lcthw-remnants/object.h deleted file mode 100644 index 65b5aca..0000000 --- a/oldstuff/lcthw-remnants/object.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _object_h -#define _object_h - -typedef enum { - NORTH, SOUTH, EAST, WEST -} Direction; - -typedef struct { - char *description; - int (*init)(void *self); - void (*describe)(void *self); - void (*destroy)(void *self); - void *(*move)(void *self, Direction direction); - int (*attack)(void *self, int damage); -} Object; - -int Object_init(void *self); -void Object_destroy(void *self); -void Object_describe(void *self); -void *Object_move(void *self, Direction direction); -int Object_attack(void *self, int damage); -void *Object_new(size_t size, Object proto, char *description); - -#define NEW(T, N) Object_new(sizeof(T), T##Proto, N) -#define _(N) proto.N - -#endif diff --git a/oldstuff/lcthw-remnants/test.sh b/oldstuff/lcthw-remnants/test.sh deleted file mode 100644 index 7a580f2..0000000 --- a/oldstuff/lcthw-remnants/test.sh +++ /dev/null @@ -1,35 +0,0 @@ -EXIT_CODE=0 -ASSERT_COUNT=0 - - -function assert_equal(){ - if [[ $1 == $2 ]] ; then - echo -n "." - else - echo -n "F" - EXIT_CODE=1 - fi - ASSERT_COUNT=$(expr $ASSERT_COUNT + 1) -} - - -function assert_not_equal(){ - if [[ $1 != $2 ]] ; then - echo -n "." - else - echo -n "F" - EXIT_CODE=1 - fi - ASSERT_COUNT=$(expr $ASSERT_COUNT + 1) -} - - -function test_finish(){ - echo - if [ $EXIT_CODE -eq 0 ]; then - echo "PASS" - else - echo "FAIL" - fi - exit $EXIT_CODE -} diff --git a/oldstuff/lcthw-remnants/test_ex17.sh b/oldstuff/lcthw-remnants/test_ex17.sh deleted file mode 100755 index 2619301..0000000 --- a/oldstuff/lcthw-remnants/test_ex17.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -source './test.sh' - -prog=${1-'./ex17'} -test_db=db.$$.$RANDOM.dat - -# ---------------------------------------------------------------------------- - -$prog 2>&1 >/dev/null -assert_equal $? 1 - -$prog $test_db c 2>&1 >/dev/null -assert_equal $? 0 - -$prog $test_db s 2>&1 >/dev/null -assert_equal $? 1 - -$prog $test_db s 1 ham ham@foo.bar -assert_equal $? 0 -$prog $test_db s 2 derp derp@foo.bar -assert_equal $? 0 -$prog $test_db s 3 herp herp@foo.bar -assert_equal $? 0 -$prog $test_db s 4 zap zap@foo.bar -assert_equal $? 0 - -$prog $test_db l > $$.out -grep '1 ham ham@foo.bar' $$.out >/dev/null -assert_equal $? 0 -$prog $test_db l > $$.out -grep '2 derp derp@foo.bar' $$.out >/dev/null -assert_equal $? 0 -$prog $test_db l > $$.out -grep '3 herp herp@foo.bar' $$.out >/dev/null -assert_equal $? 0 -$prog $test_db l > $$.out -grep '4 zap zap@foo.bar' $$.out >/dev/null -assert_equal $? 0 - -$prog $test_db g 1 > $$.out -grep '1 ham ham@foo.bar' $$.out >/dev/null -assert_equal $? 0 - -$prog $test_db d 1 -$prog $test_db l > $$.out -grep 'ham@foo.bar' $$.out >/dev/null -assert_not_equal $? 0 - -# ---------------------------------------------------------------------------- - -rm -f $$.out -rm -f $test_db - -test_finish diff --git a/oldstuff/lcthw-remnants/test_ex19.sh b/oldstuff/lcthw-remnants/test_ex19.sh deleted file mode 100755 index 0455133..0000000 --- a/oldstuff/lcthw-remnants/test_ex19.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -EXIT_CODE=0 - -run_test() -{ - echo -n " $1" - cat "$2" | ./ex19 >/dev/null - if [[ "$?" -eq "0" ]] - then - echo " ... OK" - else - echo " ... FAIL" - EXIT_CODE=1 - fi - rm -f "$2" -} - - -tmp_01="`mktemp`" -cat > "$tmp_01" < "$tmp_02" < "$out_tmp" - diff_out="$(mktemp)" - diff -u "$3" "$out_tmp" > "$diff_out" - diff_count="$(cat "$diff_out" | wc -l)" - if [[ "$?" == "0" ]] && [[ "$diff_count" == "0" ]] - then - echo " ... OK" - else - echo " ... FAIL" - echo " diff count => $diff_count" - cat "$diff_out" - EXIT_CODE=1 - fi - rm -f "$2" "$out_tmp" "$diff_out" -} - - -tmp_01="$(mktemp)" -cat > "$tmp_01" < "$expected_01" < -> Read in: a=2 b=8 c=n -EOF - -tmp_02="$(mktemp)" -tmp_02in="$(mktemp)" -cat > "$tmp_02in" < "$tmp_02" < "$expected_02" < Reading from file: -Read in: a=1 b=4 c=a -EOF - - -run_test '01' "$tmp_01" "$expected_01" -run_test '02' "$tmp_02" "$expected_02" - - -exit $EXIT_CODE diff --git a/oldstuff/logstash/.gitignore b/oldstuff/logstash/.gitignore deleted file mode 100644 index fad1989..0000000 --- a/oldstuff/logstash/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/agent/lib/ -/crispy/crispy -/sirgoldenvoncrispywhite/sirgoldenvoncrispywhite diff --git a/oldstuff/logstash/Makefile b/oldstuff/logstash/Makefile deleted file mode 100644 index 3c557bc..0000000 --- a/oldstuff/logstash/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -SHELL := /bin/bash - -run-crispy: crispy/crispy - $^ - -run-sirgoldenvoncrispywhite: sirgoldenvoncrispywhite/sirgoldenvoncrispywhite - $^ - -crispy/crispy: crispy/main.go - pushd crispy && go build -v -x . ; popd - -sirgoldenvoncrispywhite/sirgoldenvoncrispywhite: sirgoldenvoncrispywhite/main.go - pushd sirgoldenvoncrispywhite && go build -v -x . ; popd - -.PHONY: run-crispy run-sirgoldenvoncrispywhite diff --git a/oldstuff/logstash/agent/Makefile b/oldstuff/logstash/agent/Makefile deleted file mode 100644 index 9a78ec7..0000000 --- a/oldstuff/logstash/agent/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -SHELL := /bin/bash -LOGSTASH_VERSION ?= 1.1.13 - -all: lib/logstash-$(LOGSTASH_VERSION)-flatjar.jar - -lib/logstash-$(LOGSTASH_VERSION)-flatjar.jar: lib - pushd lib && \ - curl -L -O http://logstash.objects.dreamhost.com/release/logstash-$(LOGSTASH_VERSION)-flatjar.jar ; \ - popd - -lib: - mkdir -p $@ - -run-agent: all - java -jar lib/logstash-$(LOGSTASH_VERSION)-flatjar.jar agent -f agent.conf diff --git a/oldstuff/logstash/agent/agent.conf b/oldstuff/logstash/agent/agent.conf deleted file mode 100644 index 842478f..0000000 --- a/oldstuff/logstash/agent/agent.conf +++ /dev/null @@ -1,14 +0,0 @@ -input { - tcp { - message_format => "json" - port => 55784 - type => "fried" - } -} - -output { - stdout { - debug => true - debug_format => "json" - } -} diff --git a/oldstuff/logstash/crispy/main.go b/oldstuff/logstash/crispy/main.go deleted file mode 100644 index 92592f1..0000000 --- a/oldstuff/logstash/crispy/main.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "net" - "net/http" -) - -func main() { - server := newCrispyServer() - http.Handle("/", server) - log.Printf("Serving on :9799 with %+v\n", server) - log.Fatal(http.ListenAndServe(":9799", nil)) -} - -type crispyServer struct { - logstasher *log.Logger -} - -func newCrispyServer() *crispyServer { - return &crispyServer{ - logstasher: newLogstashLogger(), - } -} - -func (me *crispyServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == "/DIE" && r.Method == "POST" { - me.logstasher.Fatal("OH GOSH") - } - - j, err := json.Marshal(r) - if err == nil { - me.logstasher.Println(string(j)) - } -} - -func newLogstashLogger() *log.Logger { - return log.New(&logstashWriter{}, "", 0) -} - -type logstashWriter struct{} - -func (me *logstashWriter) Write(b []byte) (int, error) { - conn, err := net.Dial("tcp", ":55784") - if err == nil { - defer conn.Close() - fmt.Fprintf(conn, string(b)) - } else { - fmt.Printf(string(b)) - } - return 0, nil -} diff --git a/oldstuff/logstash/fake-logstash-agent.rb b/oldstuff/logstash/fake-logstash-agent.rb deleted file mode 100644 index fa2799c..0000000 --- a/oldstuff/logstash/fake-logstash-agent.rb +++ /dev/null @@ -1,9 +0,0 @@ -# vim:fileencoding=utf-8 - -require 'socket' - -server = TCPServer.new(55784) -loop do - client = server.accept - $stderr.puts client.gets -end diff --git a/oldstuff/logstash/sirgoldenvoncrispywhite/main.go b/oldstuff/logstash/sirgoldenvoncrispywhite/main.go deleted file mode 100644 index 9faab59..0000000 --- a/oldstuff/logstash/sirgoldenvoncrispywhite/main.go +++ /dev/null @@ -1,52 +0,0 @@ -package main - -import ( - "encoding/json" - "log" - "net/http" - - "github.com/modcloth-labs/golog" -) - -func main() { - server, err := newCrispyServer() - if err != nil { - log.Fatal(err) - } - - http.Handle("/", server) - log.Printf("Serving on :9799 with %+v\n", server) - log.Fatal(http.ListenAndServe(":9799", nil)) -} - -type crispyServer struct { - logstasher *golog.Logger -} - -func newCrispyServer() (*crispyServer, error) { - logstasher, err := newLogstashLogger() - if err != nil { - return nil, err - } - return &crispyServer{logstasher: logstasher}, nil -} - -func (me *crispyServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { - j, err := json.Marshal(r) - if err == nil { - if me.logstasher != nil { - me.logstasher.Infof("%s", string(j)) - } - } -} - -func newLogstashLogger() (*golog.Logger, error) { - logger := golog.NewLogger("") - tcpProcessor, err := golog.NewTcpProcessorAt(":55784", golog.LOG_DEBUG) - if err != nil { - log.Printf("WARNING: %+v\n", err) - } - - logger.AddProcessor("tcp", tcpProcessor) - return logger, nil -} diff --git a/oldstuff/lrthw-remnants/.gitignore b/oldstuff/lrthw-remnants/.gitignore deleted file mode 100644 index 2e1099c..0000000 --- a/oldstuff/lrthw-remnants/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*~ -copied.txt -.rbenv-version diff --git a/oldstuff/lrthw-remnants/ex1.rb b/oldstuff/lrthw-remnants/ex1.rb deleted file mode 100644 index 1fd549f..0000000 --- a/oldstuff/lrthw-remnants/ex1.rb +++ /dev/null @@ -1,7 +0,0 @@ -puts "Hello World!" -puts "Hello Again" -puts "I like typing this." -puts "This is fun." -puts 'Yay! Printing.' -puts "I'd much rather you 'not'." -puts 'I "said" do not touch this.' diff --git a/oldstuff/lrthw-remnants/ex10.rb b/oldstuff/lrthw-remnants/ex10.rb deleted file mode 100644 index 4da7001..0000000 --- a/oldstuff/lrthw-remnants/ex10.rb +++ /dev/null @@ -1,15 +0,0 @@ -tabby_cat = "\tI'm tabbed in." -persian_cat = "I'm split\non a line." -backslash_cat = "I'm \\ a \\ cat." - -fat_cat = < - puts f.content_type # "text/html" - puts f.charset # "iso-8859-1" - puts f.content_encoding # [] - puts f.last_modified # Thu Dec 05 02:45:02 UTC 2002 -end diff --git a/oldstuff/lrthw-remnants/ex13.rb b/oldstuff/lrthw-remnants/ex13.rb deleted file mode 100644 index a5e38c6..0000000 --- a/oldstuff/lrthw-remnants/ex13.rb +++ /dev/null @@ -1,9 +0,0 @@ -first, second, third = ARGV - -puts "The script is called: #{$0}" -puts "Your first variable is: #{first}" -puts "Your second variable is: #{second}" -puts "Your third variable is: #{third}" - -print "And your fourth is?: " -puts "That's right, it's #{STDIN.gets.chomp}" diff --git a/oldstuff/lrthw-remnants/ex14-ec.rb b/oldstuff/lrthw-remnants/ex14-ec.rb deleted file mode 100644 index 689222e..0000000 --- a/oldstuff/lrthw-remnants/ex14-ec.rb +++ /dev/null @@ -1,28 +0,0 @@ -user = ARGV.first -prompt = '~: ' - -puts "Hi #{user}, I'm the #{$0} script." -puts "I'd like to ask you a few questions." -puts "Do you like me #{user}?" -print prompt -likes = STDIN.gets.chomp - -puts "Where do you live #{user}?" -print prompt -lives = STDIN.gets.chomp - -puts "What kind of computer do you have?" -print prompt -computer = STDIN.gets.chomp - -puts "What's your favorite name for a dog?" -print prompt -dogname = STDIN.gets.chomp - -puts < -2 -puts "Is it greater or equal?", 5 >= -2 -puts "Is it less or equal?", 5 <= -2 diff --git a/oldstuff/lrthw-remnants/ex4.rb b/oldstuff/lrthw-remnants/ex4.rb deleted file mode 100644 index 1712506..0000000 --- a/oldstuff/lrthw-remnants/ex4.rb +++ /dev/null @@ -1,15 +0,0 @@ -cars = 100 -space_in_a_car = 4.0 -drivers = 30 -passengers = 90 -cars_not_driven = cars - drivers -cars_driven = drivers -carpool_capacity = cars_driven * space_in_a_car -average_passengers_per_car = passengers / cars_driven - -puts "There are #{cars} cars available." -puts "There are only #{drivers} drivers available." -puts "There will be #{cars_not_driven} empty cars today." -puts "We can transport #{carpool_capacity} people today." -puts "We have #{passengers} passengers to carpool today." -puts "We need to put about #{average_passengers_per_car} in each car." diff --git a/oldstuff/lrthw-remnants/ex5.rb b/oldstuff/lrthw-remnants/ex5.rb deleted file mode 100644 index 5998ab2..0000000 --- a/oldstuff/lrthw-remnants/ex5.rb +++ /dev/null @@ -1,18 +0,0 @@ -my_name = 'Zed A. Shaw' -my_age = 35 -my_height = 74 -my_weight = 180 -my_eyes = 'Blue' -my_teeth = 'White' -my_hair = 'Brown' - -puts "Let's talk about %s." % my_name -puts "He's %d inches tall." % my_height -puts "He's %d pounds heavy." % my_weight -puts "Actually that's not too heavy." -puts "He's got %s eyes and %s hair." % [my_eyes, my_hair] -puts "His teeth are usually %s depending on the coffee." % my_teeth - -# this line is tricky, try to get it exactly right -puts "If I add %d, %d, and %d I get %d." % [ - my_age, my_height, my_weight, my_age + my_height + my_weight] diff --git a/oldstuff/lrthw-remnants/ex6.rb b/oldstuff/lrthw-remnants/ex6.rb deleted file mode 100644 index b6361f5..0000000 --- a/oldstuff/lrthw-remnants/ex6.rb +++ /dev/null @@ -1,20 +0,0 @@ -x = "There are #{10} types of people." -binary = "binary" -do_not = "don't" -y = "Those who know #{binary} and those who #{do_not}." - -puts x -puts y - -puts "I said: #{x}" -puts "I also said: '#{y}'." - -hilarious = false -joke_evaluation = "Isn't that joke so funny?! #{hilarious}" - -puts joke_evaluation - -w = "This is the left side of..." -e = "a string with a right side." - -puts w + e diff --git a/oldstuff/lrthw-remnants/ex7.rb b/oldstuff/lrthw-remnants/ex7.rb deleted file mode 100644 index e163cfa..0000000 --- a/oldstuff/lrthw-remnants/ex7.rb +++ /dev/null @@ -1,25 +0,0 @@ -puts "Mary had a little lamb." -puts "Its fleece was white as %s." % 'snow' -puts "And everywhere that Mary went." -puts "." * 10 # what'd that do? - -end1 = "C" -end2 = "h" -end3 = "e" -end4 = "e" -end5 = "s" -end6 = "e" -end7 = "B" -end8 = "u" -end9 = "r" -end10 = "g" -end11 = "e" -end12 = "r" - -# notice how we are using print instead of puts here. change it to puts -# and see what happens. -print end1 + end2 + end3 + end4 + end5 + end6 -print end7 + end8 + end9 + end10 + end11 + end12 - -# this just is polite use of the terminal, try removing it -puts diff --git a/oldstuff/lrthw-remnants/ex8.rb b/oldstuff/lrthw-remnants/ex8.rb deleted file mode 100644 index a75b3db..0000000 --- a/oldstuff/lrthw-remnants/ex8.rb +++ /dev/null @@ -1,12 +0,0 @@ -formatter = "%s %s %s %s" - -puts formatter % [1, 2, 3, 4] -puts formatter % ["one", "two", "three", "four"] -puts formatter % [true, false, false, true] -puts formatter % [formatter, formatter, formatter, formatter] -puts formatter % [ - "I had this thing.", - "That you could type up right.", - "But it didn't sing.", - "So I said goodnight." -] diff --git a/oldstuff/lrthw-remnants/ex9.rb b/oldstuff/lrthw-remnants/ex9.rb deleted file mode 100644 index 5bd8195..0000000 --- a/oldstuff/lrthw-remnants/ex9.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Here's some new strange stuff, remember type it exactly. - -days = "Mon Tue Wed Thu Fri Sat Sun" -months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug" - -puts "Here are the days: ", days -puts "Here are the months: ", months - -puts <= DATETIME('2004-01-01 00:00:00') - AND person_pet.pet_id = pet.id - AND person_pet.person_id = person.id; - -SELECT pet.name -FROM pet, person -WHERE pet.parent = person.id - AND person.first_name = 'Zed'; diff --git a/oldstuff/lsqlthw-remnants/ex13.sql b/oldstuff/lsqlthw-remnants/ex13.sql deleted file mode 100644 index 0a6163b..0000000 --- a/oldstuff/lsqlthw-remnants/ex13.sql +++ /dev/null @@ -1,141 +0,0 @@ -ALTER TABLE person ADD COLUMN dead INTEGER; - -ALTER TABLE person ADD COLUMN phone_number TEXT; - -ALTER TABLE person ADD COLUMN salary FLOAT; - -ALTER TABLE person ADD COLUMN dob DATETIME; - -ALTER TABLE pet ADD COLUMN dob DATETIME; - -ALTER TABLE person_pet ADD COLUMN purchased_on DATETIME; - -ALTER TABLE pet ADD COLUMN parent INTEGER; - -UPDATE pet -SET parent = 0 -WHERE id IN ( - SELECT pet_id - FROM person_pet - WHERE person_id = 0 -); - -UPDATE person_pet -SET purchased_on = DATETIME('now') -WHERE person_id = 0; - -INSERT INTO person ( - id, first_name, last_name, age, dob, - dead, phone_number, salary -) -VALUES ( - 1, 'Fred', 'Shub', 43, DATETIME('1971-12-23 11:23:00'), - 0, '4128898282', 45390.80 -); - -INSERT INTO person ( - id, first_name, last_name, age, dob, - dead, phone_number, salary -) -VALUES ( - 2, 'Alice', 'Blurb', 27, DATETIME('1987-02-03 01:15:00'), - 0, '7243871222', 89500.00 -); - -INSERT INTO person ( - id, first_name, last_name, age, dob, - dead, phone_number, salary -) -VALUES ( - 3, 'Regina', 'Nerp', 19, DATETIME('1995-09-12 19:04:00'), - 0, '4154401190', 142880.70 -); - -INSERT INTO person ( - id, first_name, last_name, age, dob, - dead, phone_number, salary -) -VALUES ( - 4, 'Sam', 'Wut', 59, DATETIME('1955-10-25 21:31:10'), - 0, '4125511328', 62422.00 -); - -INSERT INTO pet ( - id, name, breed, age, dead, - dob, parent -) -VALUES ( - 2, 'Hanky', 'Bone', 94, 0, - DATETIME('1920-03-14 04:13:00'), 4 -); - -INSERT INTO pet ( - id, name, breed, age, dead, - dob, parent -) -VALUES ( - 3, 'Rhonda', 'Guinea Pig', 1, 0, - DATETIME('2013-01-11 00:00:00'), 2 -); - -INSERT INTO pet ( - id, name, breed, age, dead, - dob, parent -) -VALUES ( - 4, 'Tippy', 'Dog', 18, 1, - DATETIME('1996-10-04 00:00:00'), 1 -); - -INSERT INTO pet ( - id, name, breed, age, dead, - dob, parent -) -VALUES ( - 5, 'Chuck', 'Parakeet', 3, 0, - DATETIME('2010-07-05 00:00:00'), 3 -); - -INSERT INTO pet ( - id, name, breed, age, dead, - dob, parent -) -VALUES ( - 6, 'Sal', 'Horse', 8, 0, - DATETIME('2006-05-21 00:00:00'), 2 -); - -INSERT INTO person_pet ( - person_id, pet_id, purchased_on -) -VALUES ( - 2, 6, DATETIME('2007-03-11 00:00:00') -); - -INSERT INTO person_pet ( - person_id, pet_id, purchased_on -) -VALUES ( - 4, 2, DATETIME('1955-11-05 00:00:00') -); - -INSERT INTO person_pet ( - person_id, pet_id, purchased_on -) -VALUES ( - 2, 3, DATETIME('2013-09-01 00:00:00') -); - -INSERT INTO person_pet ( - person_id, pet_id, purchased_on -) -VALUES ( - 1, 4, DATETIME('1999-01-25 00:00:00') -); - -INSERT INTO person_pet ( - person_id, pet_id, purchased_on -) -VALUES ( - 3, 5, DATETIME('2010-12-15 00:00:00') -); diff --git a/oldstuff/lsqlthw-remnants/ex2.sql b/oldstuff/lsqlthw-remnants/ex2.sql deleted file mode 100644 index 48a85a9..0000000 --- a/oldstuff/lsqlthw-remnants/ex2.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE person ( - id INTEGER PRIMARY KEY, - first_name TEXT, - last_name TEXT, - age INTEGER -); - -CREATE TABLE pet ( - id INTEGER PRIMARY KEY, - name TEXT, - breed TEXT, - age INTEGER, - dead INTEGER -); - -CREATE TABLE person_pet ( - person_id INTEGER, - pet_id INTEGER -); diff --git a/oldstuff/lsqlthw-remnants/ex3-myself.sql b/oldstuff/lsqlthw-remnants/ex3-myself.sql deleted file mode 100644 index 54273b4..0000000 --- a/oldstuff/lsqlthw-remnants/ex3-myself.sql +++ /dev/null @@ -1,8 +0,0 @@ -INSERT INTO person (id, first_name, last_name, age) - VALUES (1, "Dan", "Buch", 31); - -INSERT INTO pet (id, name, breed, age, dead) - VALUES (2, "Franny", "Dog", 14, 1); - -INSERT INTO pet (id, name, breed, age, dead) - VALUES (3, "Zooey", "Cat", 7, 0); diff --git a/oldstuff/lsqlthw-remnants/ex3.sql b/oldstuff/lsqlthw-remnants/ex3.sql deleted file mode 100644 index 0c14ca2..0000000 --- a/oldstuff/lsqlthw-remnants/ex3.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO person (id, first_name, last_name, age) - VALUES (0, "Zed", "Shaw", 37); - -INSERT INTO pet (id, name, breed, age, dead) - VALUES (0, "Fluffy", "Unicorn", 1000, 0); - -INSERT INTO pet VALUES (1, "Gigantor", "Robot", 1, 1); diff --git a/oldstuff/lsqlthw-remnants/ex4-myself.sql b/oldstuff/lsqlthw-remnants/ex4-myself.sql deleted file mode 100644 index 432b133..0000000 --- a/oldstuff/lsqlthw-remnants/ex4-myself.sql +++ /dev/null @@ -1,5 +0,0 @@ -INSERT INTO person_pet (person_id, pet_id) - VALUES (1, 2); - -INSERT INTO person_pet (person_id, pet_id) - VALUES (1, 3); diff --git a/oldstuff/lsqlthw-remnants/ex4.sql b/oldstuff/lsqlthw-remnants/ex4.sql deleted file mode 100644 index 5d5eb14..0000000 --- a/oldstuff/lsqlthw-remnants/ex4.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO person_pet (person_id, pet_id) VALUES (0, 0); -INSERT INTO person_pet VALUES (0, 1); diff --git a/oldstuff/lsqlthw-remnants/ex5.sql b/oldstuff/lsqlthw-remnants/ex5.sql deleted file mode 100644 index 0839fcf..0000000 --- a/oldstuff/lsqlthw-remnants/ex5.sql +++ /dev/null @@ -1,7 +0,0 @@ -SELECT * FROM person; - -SELECT name, age FROM pet; - -SELECT name, age FROM pet WHERE dead = 0; - -SELECT * FROM person WHERE first_name != "Zed"; diff --git a/oldstuff/lsqlthw-remnants/ex6.sql b/oldstuff/lsqlthw-remnants/ex6.sql deleted file mode 100644 index 0c30148..0000000 --- a/oldstuff/lsqlthw-remnants/ex6.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT pet.id, pet.name, pet.age, pet.dead - FROM pet, person_pet, person - WHERE - pet.id = person_pet.pet_id AND - person_pet.person_id = person.id AND - person.first_name = "Zed"; diff --git a/oldstuff/lsqlthw-remnants/ex7-ec.sql b/oldstuff/lsqlthw-remnants/ex7-ec.sql deleted file mode 100644 index e5ec770..0000000 --- a/oldstuff/lsqlthw-remnants/ex7-ec.sql +++ /dev/null @@ -1,71 +0,0 @@ -DROP TABLE pet; -DROP TABLE person; -DROP TABLE person_pet; - --- ex2.sql - -CREATE TABLE person ( - id INTEGER PRIMARY KEY, - first_name TEXT, - last_name TEXT, - age INTEGER -); - -CREATE TABLE pet ( - id INTEGER PRIMARY KEY, - name TEXT, - breed TEXT, - age INTEGER, - dead INTEGER -); - -CREATE TABLE person_pet ( - person_id INTEGER, - pet_id INTEGER -); - --- ex3.sql - -INSERT INTO person (id, first_name, last_name, age) - VALUES (0, "Zed", "Shaw", 37); - -INSERT INTO pet (id, name, breed, age, dead) - VALUES (0, "Fluffy", "Unicorn", 1000, 0); - -INSERT INTO pet VALUES (1, "Gigantor", "Robot", 1, 1); - --- ex4.sql - -INSERT INTO person_pet (person_id, pet_id) VALUES (0, 0); -INSERT INTO person_pet VALUES (0, 1); - --- ex5.sql - -SELECT * FROM person; - -SELECT name, age FROM pet; - -SELECT name, age FROM pet WHERE dead = 0; - -SELECT * FROM person WHERE first_name != "Zed"; - --- ex6.sql - -SELECT pet.id, pet.name, pet.age, pet.dead - FROM pet, person_pet, person - WHERE - pet.id = person_pet.pet_id AND - person_pet.person_id = person.id AND - person.first_name = "Zed"; - --- ex7.sql - -SELECT name, age FROM pet WHERE dead = 1; - -DELETE FROM pet WHERE dead = 1; - -SELECT * FROM pet; - -INSERT INTO pet VALUES (1, "Gigantor", "Robot", 1, 0); - -SELECT * FROM pet; diff --git a/oldstuff/lsqlthw-remnants/ex7.sql b/oldstuff/lsqlthw-remnants/ex7.sql deleted file mode 100644 index 794c9d0..0000000 --- a/oldstuff/lsqlthw-remnants/ex7.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT name, age FROM pet WHERE dead = 1; - -DELETE FROM pet WHERE dead = 1; - -SELECT * FROM pet; - -INSERT INTO pet VALUES (1, "Gigantor", "Robot", 1, 0); - -SELECT * FROM pet; diff --git a/oldstuff/lsqlthw-remnants/ex8.sql b/oldstuff/lsqlthw-remnants/ex8.sql deleted file mode 100644 index 5306ab0..0000000 --- a/oldstuff/lsqlthw-remnants/ex8.sql +++ /dev/null @@ -1,18 +0,0 @@ -DELETE FROM pet WHERE id IN ( - SELECT pet.id - FROM pet, person_pet, person - WHERE - person.id = person_pet.person_id AND - pet.id = person_pet.pet_id AND - person.first_name = "Zed" -); - -SELECT * FROM pet; -SELECT * FROM person_pet; - -DELETE FROM person_pet - WHERE pet_id NOT IN ( - SELECT id FROM pet - ); - -SELECT * FROM person_pet; diff --git a/oldstuff/lsqlthw-remnants/ex9.sql b/oldstuff/lsqlthw-remnants/ex9.sql deleted file mode 100644 index f4b8a8a..0000000 --- a/oldstuff/lsqlthw-remnants/ex9.sql +++ /dev/null @@ -1,8 +0,0 @@ -UPDATE person SET first_name = "Hilarious Guy" - WHERE first_name = "Zed"; - -UPDATE pet SET name = "Fancy Pants" - WHERE id = 0;; - -SELECT * FROM person; -SELECT * FROM pet; diff --git a/oldstuff/lyahfgg/.ghci b/oldstuff/lyahfgg/.ghci deleted file mode 100644 index c77d0c8..0000000 --- a/oldstuff/lyahfgg/.ghci +++ /dev/null @@ -1,3 +0,0 @@ -:set prompt "ghci> " - --- vim:filetype=haskell diff --git a/oldstuff/lyahfgg/ch01/baby.hs b/oldstuff/lyahfgg/ch01/baby.hs deleted file mode 100644 index 6ccf1bd..0000000 --- a/oldstuff/lyahfgg/ch01/baby.hs +++ /dev/null @@ -1,11 +0,0 @@ -doubleMe x = x + x - -doubleUs x y = doubleMe x + doubleMe y - -doubleSmallNumber x = if x > 100 - then x - else x*2 - -doubleSmallNumber' x = (if x > 100 then x else x*2) + 1 - -conanO'Brien = "It's a-me, Conan O'Brien!" diff --git a/oldstuff/lyahfgg/ch01/boombangs.hs b/oldstuff/lyahfgg/ch01/boombangs.hs deleted file mode 100644 index f9c17b8..0000000 --- a/oldstuff/lyahfgg/ch01/boombangs.hs +++ /dev/null @@ -1 +0,0 @@ -boomBangs xs = [if x < 10 then "BOOM!" else "BANG!" | x <- xs, odd x] diff --git a/oldstuff/lyahfgg/ch01/hilarity.hs b/oldstuff/lyahfgg/ch01/hilarity.hs deleted file mode 100644 index 8ffa1d3..0000000 --- a/oldstuff/lyahfgg/ch01/hilarity.hs +++ /dev/null @@ -1,2 +0,0 @@ -adjNounHilarity adjectives nouns = - [adjective ++ " " ++ noun | adjective <- adjectives, noun <- nouns] diff --git a/oldstuff/map-mash/.gitignore b/oldstuff/map-mash/.gitignore deleted file mode 100644 index 263134a..0000000 --- a/oldstuff/map-mash/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -log/*.log -tmp/* -db/*.sqlite3 -config/redis.conf -db/*.sqlite3-journal -public/maps/*.png -.rbenv-version diff --git a/oldstuff/map-mash/Gemfile b/oldstuff/map-mash/Gemfile deleted file mode 100644 index e0317da..0000000 --- a/oldstuff/map-mash/Gemfile +++ /dev/null @@ -1,53 +0,0 @@ -source :rubygems - -gem 'rails', '2.3.2' -gem 'active_presenter', '1.2.1' -gem 'activesupport', '2.3.2' -gem 'awesome_print', '0.2.1', :require => 'ap' -gem 'fastercsv' -gem 'haml' -gem 'mc-settings' -gem 'mongrel', '1.1.5' -gem 'nokogiri', '1.4.3.1' -gem 'rack', '1.2.1' -gem 'rake', '0.8.7' -gem 'rdoc' -gem 'redis' -gem 'redis-session-store' -gem 'responds_to_parent', '1.0.20091013' -gem 'resque', '1.19.0' -gem 'resque-cleaner' -gem 'resque-lock' -gem 'resque-loner', '1.0.1' -gem 'resque-scheduler', '2.0.0.d' -gem 'rmagick', '2.13.1' -gem 'ruby-debug', '0.10.3' -gem 'sqlite3' -gem 'typhoeus', '0.2.4' -gem 'unicorn', '3.7.0' -gem 'uuid', '2.3.3' -gem 'yajl-ruby', '0.8.1' - -group :development, :test, :cucumber do - gem 'ci_reporter', '1.6.5' - gem 'database_cleaner', '0.6.7' - gem 'email_spec', '0.6.2' - gem 'fake_ftp', '0.0.9' - gem 'faker' - gem 'fakeredis', '0.2.2' - gem 'fakeweb', '1.3.0' - gem 'foreman' - gem 'guard' - gem 'guard-livereload' - gem 'launchy', '0.3.7' - gem 'machinist', '1.0.6' - gem 'pry' - gem 'rcov', '0.9.9' - gem 'remarkable_activerecord', '3.1.13', :require => false - gem 'remarkable_rails', '3.1.13', :require => false - gem 'rspec', '1.3.0' - gem 'rspec-rails', '1.3.2' - gem 'ruby-debug-ide' - gem 'ruby-prof', '0.9.2' - gem 'sanitize' -end diff --git a/oldstuff/map-mash/Gemfile.lock b/oldstuff/map-mash/Gemfile.lock deleted file mode 100644 index 497625e..0000000 --- a/oldstuff/map-mash/Gemfile.lock +++ /dev/null @@ -1,211 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - actionmailer (2.3.2) - actionpack (= 2.3.2) - actionpack (2.3.2) - activesupport (= 2.3.2) - active_presenter (1.2.1) - activerecord (2.3.2) - activesupport (= 2.3.2) - activeresource (2.3.2) - activesupport (= 2.3.2) - activesupport (2.3.2) - addressable (2.2.7) - awesome_print (0.2.1) - builder (2.1.2) - cgi_multipart_eof_fix (2.5.0) - ci_reporter (1.6.5) - builder (>= 2.1.2) - coderay (1.0.5) - columnize (0.3.6) - configuration (1.3.1) - daemons (1.1.8) - database_cleaner (0.6.7) - em-websocket (0.3.6) - addressable (>= 2.1.1) - eventmachine (>= 0.12.9) - email_spec (0.6.2) - eventmachine (0.12.10) - fake_ftp (0.0.9) - faker (0.3.1) - fakeredis (0.2.2) - redis (~> 2.2.0) - fakeweb (1.3.0) - fastercsv (1.5.3) - fastthread (1.0.7) - ffi (1.0.11) - foreman (0.40.0) - term-ansicolor (~> 1.0.7) - thor (>= 0.13.6) - gem_plugin (0.2.3) - guard (1.0.0) - ffi (>= 0.5.0) - thor (~> 0.14.6) - guard-livereload (0.4.2) - em-websocket (>= 0.2.0) - guard (>= 0.10.0) - multi_json (~> 1.0) - haml (3.1.1) - json (1.6.5) - kgio (2.7.2) - launchy (0.3.7) - configuration (>= 0.0.5) - rake (>= 0.8.1) - linecache (0.46) - rbx-require-relative (> 0.0.4) - macaddr (1.5.0) - systemu (>= 2.4.0) - machinist (1.0.6) - mc-settings (0.1.6) - method_source (0.7.1) - mime-types (1.17.2) - mongrel (1.1.5) - cgi_multipart_eof_fix (>= 2.4) - daemons (>= 1.0.3) - fastthread (>= 1.0.1) - gem_plugin (>= 0.2.3) - multi_json (1.0.4) - nokogiri (1.4.3.1) - pry (0.8.3) - coderay (>= 0.9.7) - method_source (>= 0.4.0) - ruby_parser (>= 2.0.5) - slop (>= 1.5.3) - rack (1.2.1) - rails (2.3.2) - actionmailer (= 2.3.2) - actionpack (= 2.3.2) - activerecord (= 2.3.2) - activeresource (= 2.3.2) - activesupport (= 2.3.2) - rake (>= 0.8.3) - rake (0.8.7) - rbx-require-relative (0.0.9) - rcov (0.9.9) - rdoc (3.12) - json (~> 1.4) - redis (2.2.2) - redis-namespace (1.0.3) - redis (< 3.0.0) - redis-session-store (0.1.8) - redis - remarkable (3.1.13) - rspec (>= 1.2.0) - remarkable_activerecord (3.1.13) - remarkable (~> 3.1.13) - rspec (>= 1.2.0) - remarkable_rails (3.1.13) - remarkable (~> 3.1.13) - remarkable_activerecord (~> 3.1.13) - rspec (>= 1.2.0) - rspec-rails (>= 1.2.0) - responds_to_parent (1.0.20091013) - resque (1.19.0) - multi_json (~> 1.0) - redis-namespace (~> 1.0.2) - sinatra (>= 0.9.2) - vegas (~> 0.1.2) - resque-cleaner (0.2.7) - resque (~> 1.0) - resque-lock (1.0.0) - resque-loner (1.0.1) - resque (~> 1.0) - resque-scheduler (2.0.0.d) - redis (>= 2.0.1) - resque (>= 1.8.0) - rufus-scheduler - rmagick (2.13.1) - rspec (1.3.0) - rspec-rails (1.3.2) - rack (>= 1.0.0) - rspec (>= 1.3.0) - ruby-debug (0.10.3) - columnize (>= 0.1) - ruby-debug-base (~> 0.10.3.0) - ruby-debug-base (0.10.3) - linecache (>= 0.3) - ruby-debug-ide (0.4.16) - rake (>= 0.8.1) - ruby-prof (0.9.2) - ruby_parser (2.3.1) - sexp_processor (~> 3.0) - rufus-scheduler (2.0.16) - tzinfo (>= 0.3.23) - sanitize (1.2.1) - nokogiri (~> 1.4.1) - sexp_processor (3.1.0) - sinatra (1.2.8) - rack (~> 1.1) - tilt (>= 1.2.2, < 2.0) - slop (2.4.2) - sqlite3 (1.3.5) - systemu (2.4.2) - term-ansicolor (1.0.7) - thor (0.14.6) - tilt (1.3.3) - typhoeus (0.2.4) - mime-types - mime-types - tzinfo (0.3.31) - unicorn (3.7.0) - kgio (~> 2.3) - rack - uuid (2.3.3) - macaddr (~> 1.0) - vegas (0.1.11) - rack (>= 1.0.0) - yajl-ruby (0.8.1) - -PLATFORMS - ruby - -DEPENDENCIES - active_presenter (= 1.2.1) - activesupport (= 2.3.2) - awesome_print (= 0.2.1) - ci_reporter (= 1.6.5) - database_cleaner (= 0.6.7) - email_spec (= 0.6.2) - fake_ftp (= 0.0.9) - faker - fakeredis (= 0.2.2) - fakeweb (= 1.3.0) - fastercsv - foreman - guard - guard-livereload - haml - launchy (= 0.3.7) - machinist (= 1.0.6) - mc-settings - mongrel (= 1.1.5) - nokogiri (= 1.4.3.1) - pry - rack (= 1.2.1) - rails (= 2.3.2) - rake (= 0.8.7) - rcov (= 0.9.9) - rdoc - redis - redis-session-store - remarkable_activerecord (= 3.1.13) - remarkable_rails (= 3.1.13) - responds_to_parent (= 1.0.20091013) - resque (= 1.19.0) - resque-cleaner - resque-lock - resque-loner (= 1.0.1) - resque-scheduler (= 2.0.0.d) - rmagick (= 2.13.1) - rspec (= 1.3.0) - rspec-rails (= 1.3.2) - ruby-debug (= 0.10.3) - ruby-debug-ide - ruby-prof (= 0.9.2) - sanitize - sqlite3 - typhoeus (= 0.2.4) - unicorn (= 3.7.0) - uuid (= 2.3.3) - yajl-ruby (= 0.8.1) diff --git a/oldstuff/map-mash/Procfile b/oldstuff/map-mash/Procfile deleted file mode 100644 index 83722ed..0000000 --- a/oldstuff/map-mash/Procfile +++ /dev/null @@ -1,3 +0,0 @@ -rails_server: bundle exec script/server -resque_web: bundle exec script/resque-web-runner -redis: bundle exec script/redis-runner diff --git a/oldstuff/map-mash/README.md b/oldstuff/map-mash/README.md deleted file mode 100644 index a529335..0000000 --- a/oldstuff/map-mash/README.md +++ /dev/null @@ -1 +0,0 @@ -# Mashing of Maps! diff --git a/oldstuff/map-mash/Rakefile b/oldstuff/map-mash/Rakefile deleted file mode 100644 index 90542d5..0000000 --- a/oldstuff/map-mash/Rakefile +++ /dev/null @@ -1,6 +0,0 @@ -require File.expand_path('config/boot', File.dirname(__FILE__)) - -require 'rake' -require 'rdoc/task' -require 'rake/testtask' -require 'tasks/rails' diff --git a/oldstuff/map-mash/app/controllers/application_controller.rb b/oldstuff/map-mash/app/controllers/application_controller.rb deleted file mode 100644 index 6635a3f..0000000 --- a/oldstuff/map-mash/app/controllers/application_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Filters added to this controller apply to all controllers in the application. -# Likewise, all the methods added will be available for all controllers. - -class ApplicationController < ActionController::Base - helper :all # include all helpers, all the time - protect_from_forgery # See ActionController::RequestForgeryProtection for details - - # Scrub sensitive parameters from your log - # filter_parameter_logging :password -end diff --git a/oldstuff/map-mash/app/controllers/maps_controller.rb b/oldstuff/map-mash/app/controllers/maps_controller.rb deleted file mode 100644 index 7f61733..0000000 --- a/oldstuff/map-mash/app/controllers/maps_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class MapsController < ApplicationController - def index - @maps = Map.all - - respond_to do |format| - format.html - format.xml { render :xml => @maps } - end - end - - def show - @map = Map.find(params[:id]) - - respond_to do |format| - format.png do - GoogleMapLocationFetcher.new.fetch([@map.name]) do |loc,image| - dest = Rails.root.join("public/maps/#{@map.id}.png") - FileUtils.mkdir_p(File.dirname(dest)) - - File.open(dest, 'w') do |f| - f.write(image) - end - send_file(dest, :type => 'image/png') - end - end - end - end -end diff --git a/oldstuff/map-mash/app/controllers/mash_tournaments_controller.rb b/oldstuff/map-mash/app/controllers/mash_tournaments_controller.rb deleted file mode 100644 index 1a24b34..0000000 --- a/oldstuff/map-mash/app/controllers/mash_tournaments_controller.rb +++ /dev/null @@ -1,76 +0,0 @@ -class MashTournamentsController < ApplicationController - def index - @mash_tournaments = MashTournament.all - - respond_to do |format| - format.html - end - end - - def show - begin - @mash_tournament = MashTournament.find(params[:id]) - rescue ActiveRecord::RecordNotFound - redirect_to :action => 'new' and return - end - - if not @mash_tournament.done? - redirect_to new_mash_path - flash[:notice] = "You're not quite done there." - return - end - - logger.info("Mash tournament #{@mash_tournament.id} is done!") - respond_to do |format| - format.html - end - end - - def new - requester = Requester.find_or_initialize_by_ip(request.remote_ip) - if requester.current_tournament && !requester.current_tournament.done? - flash[:notice] = "But you haven't finished this one yet :-(" - redirect_to new_mash_path and return - end - - @mash_tournament = MashTournament.new(:requester => requester) - requester.save - - respond_to do |format| - format.html - end - end - - def create - if not (requester = Requester.find_by_ip(request.remote_ip)) - flash[:notice] = "Not so fast..." - redirect_to new_mash_tournament_path and return - end - if requester.current_tournament && !requester.current_tournament.done? - flash[:notice] = "Seriously, you haven't finished this one yet! :-P" - redirect_to new_mash_path and return - end - - @mash_tournament = MashTournament.new(:requester => requester) - rounds = params.fetch(:mash_tournament, {}).fetch(:total_rounds, 3).to_i - - respond_to do |format| - action_new = lambda { format.html { render :action => 'new' } } - - if @mash_tournament.save - builder = @mash_tournament.builder - if builder.create_rounds_for_contenders(2 ** rounds) == rounds and - builder.fill_in_next_round.length == (2 ** rounds) / 2 - flash[:notice] = "Let's start mashing!" - format.html do - redirect_to :controller => 'mashes', :action => 'new' - end - else - action_new.call - end - else - action_new.call - end - end - end -end diff --git a/oldstuff/map-mash/app/controllers/mashes_controller.rb b/oldstuff/map-mash/app/controllers/mashes_controller.rb deleted file mode 100644 index 5aa68d4..0000000 --- a/oldstuff/map-mash/app/controllers/mashes_controller.rb +++ /dev/null @@ -1,54 +0,0 @@ -class MashesController < ApplicationController - def redirect_to_new - flash[:notice] = 'Sneaky pete.' - redirect_to(:action => 'new') - end - - alias_method :index, :redirect_to_new - alias_method :show, :redirect_to_new - - def new - return if not already_registered?(request.remote_ip) - - requester = Requester.find_by_ip(request.remote_ip) - @mash = requester.current_tournament.next_unplayed_mash - - if not @mash - flash[:notice] = "You're done!" - redirect_to requester.current_tournament, :action => 'show' - return - end - - respond_to do |format| - format.html - end - end - - def update - return if not already_registered?(request.remote_ip) - logger.info("Got params: #{params.inspect}") - - @mash = Mash.find(params[:id]) - @mash.winner = Map.find((params[:mash][:winner_id] || -1).to_i) - - logger.info("About to save #{@mash.inspect}") - - respond_to do |format| - if @mash.save - flash[:notice] = 'Mashed!' - format.html { redirect_to(:action => 'new') } - else - format.html { render :action => 'new' } - end - end - end - - def already_registered?(ip) - if not Requester.find_by_ip(ip) - redirect_to :controller => :mash_tournaments, :action => 'new' - return false - end - - true - end -end diff --git a/oldstuff/map-mash/app/helpers/mash_tournaments_helper.rb b/oldstuff/map-mash/app/helpers/mash_tournaments_helper.rb deleted file mode 100644 index 03ce2be..0000000 --- a/oldstuff/map-mash/app/helpers/mash_tournaments_helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -module MashTournamentsHelper - def total_rounds_options_for_select - options = [] - @mash_tournament.total_rounds_options.each do |n| - options << [n, n] - end - options - end -end diff --git a/oldstuff/map-mash/app/models/map.rb b/oldstuff/map-mash/app/models/map.rb deleted file mode 100644 index 4eb3db2..0000000 --- a/oldstuff/map-mash/app/models/map.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'fastercsv' - - -class Map < ActiveRecord::Base - def self.from_city_name(city_name) - self.find_or_initialize_by_name(city_name).save! - end - - def self.pair - second = nil - max_tries = self.count - tries = 0 - - while second.nil? && tries < max_tries - first = self.all(:order => 'RANDOM()', :limit => 1).first - second = self.all(:order => 'RANDOM()', :limit => 1, - :conditions => [%{ - ( - points >= :first_points - AND id <> :first_id - ) OR ( - id NOT IN ( - SELECT map_a_id - FROM mashes - WHERE map_b_id = :first_id - ) - AND id NOT IN ( - SELECT map_b_id - FROM mashes - WHERE map_a_id = :first_id - ) - )}, { - :first_id => first.id, - :first_points => first.points - } - ] - ).first - tries += 1 - end - - if second.nil? - logger.error('OH CRAP thar be no more pairings for ye olde mashes') - [first, first] - else - [first, second] - end - end - - def self.import(csv_filename) - FasterCSV.parse(open(csv_filename), :headers => true, - :header_converters => [:downcase, :symbol]).each do |row| - map = self.find_or_initialize_by_name("#{row[:city]}, #{row[:region]}") - map.save - if block_given? - yield map - end - end - end - - def self.mashes - Mash.all(:conditions => ['map_a = :id OR map_b = :id', {:id => self.id}]) - end - - def rounds - Mash.count(:conditions => ['map_a = :id OR map_b = :id', {:id => self.id}]) - end -end diff --git a/oldstuff/map-mash/app/models/mash.rb b/oldstuff/map-mash/app/models/mash.rb deleted file mode 100644 index 8846de2..0000000 --- a/oldstuff/map-mash/app/models/mash.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Mash < ActiveRecord::Base - belongs_to :map_a, :class_name => 'Map' - belongs_to :map_b, :class_name => 'Map' - belongs_to :winner, :class_name => 'Map' - has_one :tournament, :class_name => 'MashTournament' - has_one :round, :class_name => 'MashTournamentRound' - - named_scope :unplayed, :conditions => [%{ - winner_id IS NULL - AND map_a_id IS NOT NULL - AND map_b_id IS NOT NULL - }] -end diff --git a/oldstuff/map-mash/app/models/mash_tournament.rb b/oldstuff/map-mash/app/models/mash_tournament.rb deleted file mode 100644 index 520cc6c..0000000 --- a/oldstuff/map-mash/app/models/mash_tournament.rb +++ /dev/null @@ -1,39 +0,0 @@ -class MashTournament < ActiveRecord::Base - belongs_to :requester - has_many :mashes - has_many :rounds, :class_name => 'MashTournamentRound' - - def next_unplayed_mash - mash = self.mashes.unplayed.first - if not mash - filled = self.builder.fill_in_next_round - if filled - return self.mashes.unplayed.first - else - return nil - end - else - return mash - end - end - - def total_rounds_options - @total_rounds_options ||= [3, 4, 5, 6, 7] - end - - def done? - self.rounds.collect(&:done?).uniq == [true] - end - - def round(number = 0) - MashTournamentRound.find_by_mash_tournament_id(self.id, - :conditions => {:number => number} - ) - end - - def builder - MashTournamentBuilder.new( - self, MashTournament, MashTournamentRound, Map, Mash - ) - end -end diff --git a/oldstuff/map-mash/app/models/mash_tournament_round.rb b/oldstuff/map-mash/app/models/mash_tournament_round.rb deleted file mode 100644 index bfe616d..0000000 --- a/oldstuff/map-mash/app/models/mash_tournament_round.rb +++ /dev/null @@ -1,16 +0,0 @@ -class MashTournamentRound < ActiveRecord::Base - belongs_to :tournament, :class_name => 'MashTournament' - has_many :mashes - - def self.for_round(tournament, round_number) - self.find_by_mash_tournament_id_and_number(tournament, round_number) - end - - def done? - winners = [] - self.mashes.collect do |mash| - winners << mash.winner_id - end - !winners.include?(nil) - end -end diff --git a/oldstuff/map-mash/app/models/requester.rb b/oldstuff/map-mash/app/models/requester.rb deleted file mode 100644 index 8939300..0000000 --- a/oldstuff/map-mash/app/models/requester.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Requester < ActiveRecord::Base - has_many :mash_tournaments - - def current_tournament - self.mash_tournaments.last - end -end diff --git a/oldstuff/map-mash/app/views/layouts/mash_tournaments.html.erb b/oldstuff/map-mash/app/views/layouts/mash_tournaments.html.erb deleted file mode 100644 index a801780..0000000 --- a/oldstuff/map-mash/app/views/layouts/mash_tournaments.html.erb +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - MashTournaments: <%= controller.action_name %> - <%= stylesheet_link_tag 'scaffold' %> - - - -

    <%= flash[:notice] %>

    - -<%= yield %> - - - diff --git a/oldstuff/map-mash/app/views/layouts/mashes.html.erb b/oldstuff/map-mash/app/views/layouts/mashes.html.erb deleted file mode 100644 index 8452ebd..0000000 --- a/oldstuff/map-mash/app/views/layouts/mashes.html.erb +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - Map Mash - <%= stylesheet_link_tag 'styles' %> - <%= stylesheet_link_tag 'scaffold' %> - <%= javascript_include_tag 'jquery.min' %> - <%= yield :head_js %> - - - -

    <%= flash[:notice] %>

    - -<%= yield %> - - - diff --git a/oldstuff/map-mash/app/views/maps/edit.html.erb b/oldstuff/map-mash/app/views/maps/edit.html.erb deleted file mode 100644 index 2dc0b23..0000000 --- a/oldstuff/map-mash/app/views/maps/edit.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

    Editing map

    - -<% form_for(@map) do |f| %> - <%= f.error_messages %> - -

    - <%= f.label :name %>
    - <%= f.text_field :name %> -

    -

    - <%= f.submit 'Update' %> -

    -<% end %> - -<%= link_to 'Show', @map %> | -<%= link_to 'Back', maps_path %> \ No newline at end of file diff --git a/oldstuff/map-mash/app/views/maps/index.html.erb b/oldstuff/map-mash/app/views/maps/index.html.erb deleted file mode 100644 index 847a526..0000000 --- a/oldstuff/map-mash/app/views/maps/index.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -

    Listing maps

    - - - - - - -<% @maps.each do |map| %> - - - - - - -<% end %> -
    Name
    <%=h map.name %><%= link_to 'Show', map %><%= link_to 'Edit', edit_map_path(map) %><%= link_to 'Destroy', map, :confirm => 'Are you sure?', :method => :delete %>
    - -
    - -<%= link_to 'New map', new_map_path %> \ No newline at end of file diff --git a/oldstuff/map-mash/app/views/maps/new.html.erb b/oldstuff/map-mash/app/views/maps/new.html.erb deleted file mode 100644 index 838745b..0000000 --- a/oldstuff/map-mash/app/views/maps/new.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -

    New map

    - -<% form_for(@map) do |f| %> - <%= f.error_messages %> - -

    - <%= f.label :name %>
    - <%= f.text_field :name %> -

    -

    - <%= f.submit 'Create' %> -

    -<% end %> - -<%= link_to 'Back', maps_path %> \ No newline at end of file diff --git a/oldstuff/map-mash/app/views/maps/show.html.erb b/oldstuff/map-mash/app/views/maps/show.html.erb deleted file mode 100644 index 4210382..0000000 --- a/oldstuff/map-mash/app/views/maps/show.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

    - Name: - <%=h @map.name %> -

    - - -<%= link_to 'Edit', edit_map_path(@map) %> | -<%= link_to 'Back', maps_path %> \ No newline at end of file diff --git a/oldstuff/map-mash/app/views/mash_tournaments/edit.html.erb b/oldstuff/map-mash/app/views/mash_tournaments/edit.html.erb deleted file mode 100644 index 3dda81d..0000000 --- a/oldstuff/map-mash/app/views/mash_tournaments/edit.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -

    Editing mash_tournament

    - -<% form_for(@mash_tournament) do |f| %> - <%= f.error_messages %> - -

    - <%= f.submit 'Update' %> -

    -<% end %> - -<%= link_to 'Show', @mash_tournament %> | -<%= link_to 'Back', mash_tournaments_path %> \ No newline at end of file diff --git a/oldstuff/map-mash/app/views/mash_tournaments/index.html.erb b/oldstuff/map-mash/app/views/mash_tournaments/index.html.erb deleted file mode 100644 index ee7e8d8..0000000 --- a/oldstuff/map-mash/app/views/mash_tournaments/index.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -

    Listing mash_tournaments

    - - - - - -<% @mash_tournaments.each do |mash_tournament| %> - - - - - -<% end %> -
    <%= link_to 'Show', mash_tournament %><%= link_to 'Edit', edit_mash_tournament_path(mash_tournament) %><%= link_to 'Destroy', mash_tournament, :confirm => 'Are you sure?', :method => :delete %>
    - -
    - -<%= link_to 'New mash_tournament', new_mash_tournament_path %> \ No newline at end of file diff --git a/oldstuff/map-mash/app/views/mash_tournaments/new.html.haml b/oldstuff/map-mash/app/views/mash_tournaments/new.html.haml deleted file mode 100644 index d42174a..0000000 --- a/oldstuff/map-mash/app/views/mash_tournaments/new.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%h1 New Map Mash tournament! - -- form_for(@mash_tournament) do |f| - = f.error_messages - - = f.label(:total_rounds) - = f.select(:total_rounds, total_rounds_options_for_select) - %p - = f.submit 'Start' diff --git a/oldstuff/map-mash/app/views/mash_tournaments/show.html.haml b/oldstuff/map-mash/app/views/mash_tournaments/show.html.haml deleted file mode 100644 index 74c647c..0000000 --- a/oldstuff/map-mash/app/views/mash_tournaments/show.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -%h1 - Tournament #{@mash_tournament.id} Complete! You chose - %em #{@mash_tournament.rounds.reverse.first.mashes.first.winner.name}! - -- @mash_tournament.rounds.reverse.each do |round| - %h2 Round #{round.number} - - round.mashes.each do |mash| - %ul - - if mash.map_a.present? && mash.map_b.present? && mash.winner.present? - %li - #{mash.map_a.name} vs. #{mash.map_b.name}, winner = - %strong #{mash.winner.name} - - -= link_to 'New!', :controller => 'mash_tournaments', :action => 'new' diff --git a/oldstuff/map-mash/app/views/mashes/new.html.haml b/oldstuff/map-mash/app/views/mashes/new.html.haml deleted file mode 100644 index cb6162c..0000000 --- a/oldstuff/map-mash/app/views/mashes/new.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -- content_for :head_js do - :javascript - $(function() { - $('.mash-image').click(function(elem) { - $('#mash_winner_id').val($(elem.target).attr('data-map-id')); - $('form[id^="edit_mash_"]').submit(); - }); - }); - -%h1 Mash the Maps! -%p Choose your fave. - -- form_for(@mash) do |f| - = f.error_messages - - #maps - #map_a.mash-image - %image{:src => "#{url_for @mash.map_a}.png", :'data-map-id' => @mash.map_a.id} - #map_b.mash-image - %image{:src => "#{url_for @mash.map_b}.png", :'data-map-id' => @mash.map_b.id} - - = f.hidden_field :winner_id, :value => '?' diff --git a/oldstuff/map-mash/config/boot.rb b/oldstuff/map-mash/config/boot.rb deleted file mode 100644 index 0e15cca..0000000 --- a/oldstuff/map-mash/config/boot.rb +++ /dev/null @@ -1,111 +0,0 @@ -# Don't change this file! -# Configure your app in config/environment.rb and config/environments/*.rb -require 'thread' - -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) - -module Rails - class << self - def boot! - unless booted? - preinitialize - pick_boot.run - end - end - - def booted? - defined? Rails::Initializer - end - - def pick_boot - (vendor_rails? ? VendorBoot : GemBoot).new - end - - def vendor_rails? - File.exist?("#{RAILS_ROOT}/vendor/rails") - end - - def preinitialize - load(preinitializer_path) if File.exist?(preinitializer_path) - end - - def preinitializer_path - "#{RAILS_ROOT}/config/preinitializer.rb" - end - end - - class Boot - def run - load_initializer - Rails::Initializer.run(:set_load_path) - end - end - - class VendorBoot < Boot - def load_initializer - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" - Rails::Initializer.run(:install_gem_spec_stubs) - Rails::GemDependency.add_frozen_gem_path - end - end - - class GemBoot < Boot - def load_initializer - self.class.load_rubygems - load_rails_gem - require 'initializer' - end - - def load_rails_gem - if version = self.class.gem_version - gem 'rails', version - else - gem 'rails' - end - rescue Gem::LoadError => load_error - $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) - exit 1 - end - - class << self - def rubygems_version - Gem::RubyGemsVersion rescue nil - end - - def gem_version - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - elsif ENV.include?('RAILS_GEM_VERSION') - ENV['RAILS_GEM_VERSION'] - else - parse_gem_version(read_environment_rb) - end - end - - def load_rubygems - require 'rubygems' - min_version = '1.3.1' - unless rubygems_version >= min_version - $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) - exit 1 - end - - rescue LoadError - $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) - exit 1 - end - - def parse_gem_version(text) - $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ - end - - private - def read_environment_rb - File.read("#{RAILS_ROOT}/config/environment.rb") - end - end - end -end - -# All that for this: -Rails.boot! diff --git a/oldstuff/map-mash/config/database.yml b/oldstuff/map-mash/config/database.yml deleted file mode 100644 index 025d62a..0000000 --- a/oldstuff/map-mash/config/database.yml +++ /dev/null @@ -1,22 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3-ruby (not necessary on OS X Leopard) -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 diff --git a/oldstuff/map-mash/config/environment.rb b/oldstuff/map-mash/config/environment.rb deleted file mode 100644 index 631a3a3..0000000 --- a/oldstuff/map-mash/config/environment.rb +++ /dev/null @@ -1,41 +0,0 @@ -# Be sure to restart your server when you modify this file - -# Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION - -# Bootstrap the Rails environment, frameworks, and default configuration -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Add additional load paths for your own custom dirs - # config.load_paths += %W( #{RAILS_ROOT}/extras ) - - # Specify gems that this application depends on and have them installed with rake gems:install - # config.gem "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "sqlite3-ruby", :lib => "sqlite3" - # config.gem "aws-s3", :lib => "aws/s3" - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Skip frameworks you're not going to use. To use Rails without a database, - # you must remove the Active Record framework. - # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] - - # Activate observers that should always be running - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. - config.time_zone = 'UTC' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] - # config.i18n.default_locale = :de -end diff --git a/oldstuff/map-mash/config/environments/development.rb b/oldstuff/map-mash/config/environments/development.rb deleted file mode 100644 index 85c9a60..0000000 --- a/oldstuff/map-mash/config/environments/development.rb +++ /dev/null @@ -1,17 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# In the development environment your application's code is reloaded on -# every request. This slows down response time but is perfect for development -# since you don't have to restart the webserver when you make code changes. -config.cache_classes = false - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_view.debug_rjs = true -config.action_controller.perform_caching = false - -# Don't care if the mailer can't send -config.action_mailer.raise_delivery_errors = false \ No newline at end of file diff --git a/oldstuff/map-mash/config/environments/production.rb b/oldstuff/map-mash/config/environments/production.rb deleted file mode 100644 index 27119d2..0000000 --- a/oldstuff/map-mash/config/environments/production.rb +++ /dev/null @@ -1,28 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# The production environment is meant for finished, "live" apps. -# Code is not reloaded between requests -config.cache_classes = true - -# Full error reports are disabled and caching is turned on -config.action_controller.consider_all_requests_local = false -config.action_controller.perform_caching = true -config.action_view.cache_template_loading = true - -# See everything in the log (default is :info) -# config.log_level = :debug - -# Use a different logger for distributed setups -# config.logger = SyslogLogger.new - -# Use a different cache store in production -# config.cache_store = :mem_cache_store - -# Enable serving of images, stylesheets, and javascripts from an asset server -# config.action_controller.asset_host = "http://assets.example.com" - -# Disable delivery errors, bad email addresses will be ignored -# config.action_mailer.raise_delivery_errors = false - -# Enable threaded mode -# config.threadsafe! \ No newline at end of file diff --git a/oldstuff/map-mash/config/environments/test.rb b/oldstuff/map-mash/config/environments/test.rb deleted file mode 100644 index 16775ff..0000000 --- a/oldstuff/map-mash/config/environments/test.rb +++ /dev/null @@ -1,30 +0,0 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# The test environment is used exclusively to run your application's -# test suite. You never need to work with it otherwise. Remember that -# your test database is "scratch space" for the test suite and is wiped -# and recreated between test runs. Don't rely on the data there! -config.cache_classes = true - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_controller.perform_caching = false -config.action_view.cache_template_loading = true - -# Disable request forgery protection in test environment -config.action_controller.allow_forgery_protection = false - -# Tell Action Mailer not to deliver emails to the real world. -# The :test delivery method accumulates sent emails in the -# ActionMailer::Base.deliveries array. -config.action_mailer.delivery_method = :test - -# Use SQL instead of Active Record's schema dumper when creating the test database. -# This is necessary if your schema can't be completely dumped by the schema dumper, -# like if you have constraints or database-specific column types -# config.active_record.schema_format = :sql - - config.gem 'rspec-rails', :version => '>= 1.3.2', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails')) diff --git a/oldstuff/map-mash/config/initializers/01-settings.rb b/oldstuff/map-mash/config/initializers/01-settings.rb deleted file mode 100644 index b3f0efe..0000000 --- a/oldstuff/map-mash/config/initializers/01-settings.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'mc-settings' - -Setting.load( - :path => Rails.root, - :files => ['config/settings.yml'] -) diff --git a/oldstuff/map-mash/config/initializers/inflections.rb b/oldstuff/map-mash/config/initializers/inflections.rb deleted file mode 100644 index d531b8b..0000000 --- a/oldstuff/map-mash/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/oldstuff/map-mash/config/initializers/mime_types.rb b/oldstuff/map-mash/config/initializers/mime_types.rb deleted file mode 100644 index 71306b9..0000000 --- a/oldstuff/map-mash/config/initializers/mime_types.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone - -Mime::Type.register 'image/png', :png diff --git a/oldstuff/map-mash/config/initializers/new_rails_defaults.rb b/oldstuff/map-mash/config/initializers/new_rails_defaults.rb deleted file mode 100644 index 8ec3186..0000000 --- a/oldstuff/map-mash/config/initializers/new_rails_defaults.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# These settings change the behavior of Rails 2 apps and will be defaults -# for Rails 3. You can remove this initializer when Rails 3 is released. - -if defined?(ActiveRecord) - # Include Active Record class name as root for JSON serialized output. - ActiveRecord::Base.include_root_in_json = true - - # Store the full class name (including module namespace) in STI type column. - ActiveRecord::Base.store_full_sti_class = true -end - -# Use ISO 8601 format for JSON serialized times and dates. -ActiveSupport.use_standard_json_time_format = true - -# Don't escape HTML entities in JSON, leave that for the #json_escape helper. -# if you're including raw json in an HTML page. -ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file diff --git a/oldstuff/map-mash/config/initializers/redis_conf.rb b/oldstuff/map-mash/config/initializers/redis_conf.rb deleted file mode 100644 index 49fa692..0000000 --- a/oldstuff/map-mash/config/initializers/redis_conf.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'erb' - -File.open(Rails.root.join('config/redis.conf.erb'), 'r') do |f| - tmpl = ERB.new(f.read) - File.open(Rails.root.join('config/redis.conf'), 'w') do |conf| - conf.write(tmpl.result(binding)) - end -end diff --git a/oldstuff/map-mash/config/initializers/session_store.rb b/oldstuff/map-mash/config/initializers/session_store.rb deleted file mode 100644 index 0c9a2d3..0000000 --- a/oldstuff/map-mash/config/initializers/session_store.rb +++ /dev/null @@ -1,15 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying cookie session data integrity. -# If you change this key, all old sessions will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -ActionController::Base.session = { - :key => '_map_mash_session', - :secret => '28f75daa5d26dcf4393a379bca87589d42118d8796f9c32fd5a183e879765c0ba458f1e9803caf5f183ed68d1a107de6f06871353a49bc1e29a758f7ada4c324' -} - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rake db:sessions:create") -# ActionController::Base.session_store = :active_record_store diff --git a/oldstuff/map-mash/config/locales/en.yml b/oldstuff/map-mash/config/locales/en.yml deleted file mode 100644 index f265c06..0000000 --- a/oldstuff/map-mash/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" \ No newline at end of file diff --git a/oldstuff/map-mash/config/redis.conf.erb b/oldstuff/map-mash/config/redis.conf.erb deleted file mode 100644 index 5d9c27a..0000000 --- a/oldstuff/map-mash/config/redis.conf.erb +++ /dev/null @@ -1,417 +0,0 @@ -# Redis configuration file example - -# Note on units: when memory size is needed, it is possible to specifiy -# it in the usual form of 1k 5GB 4M and so forth: -# -# 1k => 1000 bytes -# 1kb => 1024 bytes -# 1m => 1000000 bytes -# 1mb => 1024*1024 bytes -# 1g => 1000000000 bytes -# 1gb => 1024*1024*1024 bytes -# -# units are case insensitive so 1GB 1Gb 1gB are all the same. - -# By default Redis does not run as a daemon. Use 'yes' if you need it. -# Note that Redis will write a pid file in /var/run/redis.pid when daemonized. -daemonize no - -# When running daemonized, Redis writes a pid file in /var/run/redis.pid by -# default. You can specify a custom pid file location here. -pidfile /tmp/rails-map-mash-redis/server.pid - -# Accept connections on the specified port, default is 6379. -# If port 0 is specified Redis will not listen on a TCP socket. -port <%= Setting.redis(:port) %> - -# If you want you can bind a single interface, if the bind option is not -# specified all the interfaces will listen for incoming connections. -# -bind 127.0.0.1 - -# Specify the path for the unix socket that will be used to listen for -# incoming connections. There is no default, so Redis will not listen -# on a unix socket when not specified. -# -# unixsocket /var/run/redis.sock - -# Close the connection after a client is idle for N seconds (0 to disable) -timeout 300 - -# Set server verbosity to 'debug' -# it can be one of: -# debug (a lot of information, useful for development/testing) -# verbose (many rarely useful info, but not a mess like the debug level) -# notice (moderately verbose, what you want in production probably) -# warning (only very important / critical messages are logged) -loglevel verbose - -# Specify the log file name. Also 'stdout' can be used to force -# Redis to log on the standard output. Note that if you use standard -# output for logging but daemonize, logs will be sent to /dev/null -logfile /tmp/rails-map-mash-redis/server.log - -# To enable logging to the system logger, just set 'syslog-enabled' to yes, -# and optionally update the other syslog parameters to suit your needs. -# syslog-enabled no - -# Specify the syslog identity. -# syslog-ident redis - -# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. -# syslog-facility local0 - -# Set the number of databases. The default database is DB 0, you can select -# a different one on a per-connection basis using SELECT where -# dbid is a number between 0 and 'databases'-1 -databases 16 - -################################ SNAPSHOTTING ################################# -# -# Save the DB on disk: -# -# save -# -# Will save the DB if both the given number of seconds and the given -# number of write operations against the DB occurred. -# -# In the example below the behaviour will be to save: -# after 900 sec (15 min) if at least 1 key changed -# after 300 sec (5 min) if at least 10 keys changed -# after 60 sec if at least 10000 keys changed -# -# Note: you can disable saving at all commenting all the "save" lines. - -save 900 1 -save 300 10 -save 60 10000 - -# Compress string objects using LZF when dump .rdb databases? -# For default that's set to 'yes' as it's almost always a win. -# If you want to save some CPU in the saving child set it to 'no' but -# the dataset will likely be bigger if you have compressible values or keys. -rdbcompression yes - -# The filename where to dump the DB -dbfilename dump.rdb - -# The working directory. -# -# The DB will be written inside this directory, with the filename specified -# above using the 'dbfilename' configuration directive. -# -# Also the Append Only File will be created inside this directory. -# -# Note that you must specify a directory here, not a file name. -dir /tmp/rails-map-mash-redis/ - -################################# REPLICATION ################################# - -# Master-Slave replication. Use slaveof to make a Redis instance a copy of -# another Redis server. Note that the configuration is local to the slave -# so for example it is possible to configure the slave to save the DB with a -# different interval, or to listen to another port, and so on. -# -# slaveof - -# If the master is password protected (using the "requirepass" configuration -# directive below) it is possible to tell the slave to authenticate before -# starting the replication synchronization process, otherwise the master will -# refuse the slave request. -# -# masterauth - -# When a slave lost the connection with the master, or when the replication -# is still in progress, the slave can act in two different ways: -# -# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will -# still reply to client requests, possibly with out of data data, or the -# data set may just be empty if this is the first synchronization. -# -# 2) if slave-serve-stale data is set to 'no' the slave will reply with -# an error "SYNC with master in progress" to all the kind of commands -# but to INFO and SLAVEOF. -# -slave-serve-stale-data yes - -################################## SECURITY ################################### - -# Require clients to issue AUTH before processing any other -# commands. This might be useful in environments in which you do not trust -# others with access to the host running redis-server. -# -# This should stay commented out for backward compatibility and because most -# people do not need auth (e.g. they run their own servers). -# -# Warning: since Redis is pretty fast an outside user can try up to -# 150k passwords per second against a good box. This means that you should -# use a very strong password otherwise it will be very easy to break. -# -# requirepass foobared - -# Command renaming. -# -# It is possilbe to change the name of dangerous commands in a shared -# environment. For instance the CONFIG command may be renamed into something -# of hard to guess so that it will be still available for internal-use -# tools but not available for general clients. -# -# Example: -# -# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 -# -# It is also possilbe to completely kill a command renaming it into -# an empty string: -# -# rename-command CONFIG "" - -################################### LIMITS #################################### - -# Set the max number of connected clients at the same time. By default there -# is no limit, and it's up to the number of file descriptors the Redis process -# is able to open. The special value '0' means no limits. -# Once the limit is reached Redis will close all the new connections sending -# an error 'max number of clients reached'. -# -# maxclients 128 - -# Don't use more memory than the specified amount of bytes. -# When the memory limit is reached Redis will try to remove keys with an -# EXPIRE set. It will try to start freeing keys that are going to expire -# in little time and preserve keys with a longer time to live. -# Redis will also try to remove objects from free lists if possible. -# -# If all this fails, Redis will start to reply with errors to commands -# that will use more memory, like SET, LPUSH, and so on, and will continue -# to reply to most read-only commands like GET. -# -# WARNING: maxmemory can be a good idea mainly if you want to use Redis as a -# 'state' server or cache, not as a real DB. When Redis is used as a real -# database the memory usage will grow over the weeks, it will be obvious if -# it is going to use too much memory in the long run, and you'll have the time -# to upgrade. With maxmemory after the limit is reached you'll start to get -# errors for write operations, and this may even lead to DB inconsistency. -# -# maxmemory - -# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory -# is reached? You can select among five behavior: -# -# volatile-lru -> remove the key with an expire set using an LRU algorithm -# allkeys-lru -> remove any key accordingly to the LRU algorithm -# volatile-random -> remove a random key with an expire set -# allkeys->random -> remove a random key, any key -# volatile-ttl -> remove the key with the nearest expire time (minor TTL) -# noeviction -> don't expire at all, just return an error on write operations -# -# Note: with all the kind of policies, Redis will return an error on write -# operations, when there are not suitable keys for eviction. -# -# At the date of writing this commands are: set setnx setex append -# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd -# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby -# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby -# getset mset msetnx exec sort -# -# The default is: -# -# maxmemory-policy volatile-lru - -# LRU and minimal TTL algorithms are not precise algorithms but approximated -# algorithms (in order to save memory), so you can select as well the sample -# size to check. For instance for default Redis will check three keys and -# pick the one that was used less recently, you can change the sample size -# using the following configuration directive. -# -# maxmemory-samples 3 - -############################## APPEND ONLY MODE ############################### - -# By default Redis asynchronously dumps the dataset on disk. If you can live -# with the idea that the latest records will be lost if something like a crash -# happens this is the preferred way to run Redis. If instead you care a lot -# about your data and don't want to that a single record can get lost you should -# enable the append only mode: when this mode is enabled Redis will append -# every write operation received in the file appendonly.aof. This file will -# be read on startup in order to rebuild the full dataset in memory. -# -# Note that you can have both the async dumps and the append only file if you -# like (you have to comment the "save" statements above to disable the dumps). -# Still if append only mode is enabled Redis will load the data from the -# log file at startup ignoring the dump.rdb file. -# -# IMPORTANT: Check the BGREWRITEAOF to check how to rewrite the append -# log file in background when it gets too big. - -appendonly no - -# The name of the append only file (default: "appendonly.aof") -# appendfilename appendonly.aof - -# The fsync() call tells the Operating System to actually write data on disk -# instead to wait for more data in the output buffer. Some OS will really flush -# data on disk, some other OS will just try to do it ASAP. -# -# Redis supports three different modes: -# -# no: don't fsync, just let the OS flush the data when it wants. Faster. -# always: fsync after every write to the append only log . Slow, Safest. -# everysec: fsync only if one second passed since the last fsync. Compromise. -# -# The default is "everysec" that's usually the right compromise between -# speed and data safety. It's up to you to understand if you can relax this to -# "no" that will will let the operating system flush the output buffer when -# it wants, for better performances (but if you can live with the idea of -# some data loss consider the default persistence mode that's snapshotting), -# or on the contrary, use "always" that's very slow but a bit safer than -# everysec. -# -# If unsure, use "everysec". - -# appendfsync always -appendfsync everysec -# appendfsync no - -# When the AOF fsync policy is set to always or everysec, and a background -# saving process (a background save or AOF log background rewriting) is -# performing a lot of I/O against the disk, in some Linux configurations -# Redis may block too long on the fsync() call. Note that there is no fix for -# this currently, as even performing fsync in a different thread will block -# our synchronous write(2) call. -# -# In order to mitigate this problem it's possible to use the following option -# that will prevent fsync() from being called in the main process while a -# BGSAVE or BGREWRITEAOF is in progress. -# -# This means that while another child is saving the durability of Redis is -# the same as "appendfsync none", that in pratical terms means that it is -# possible to lost up to 30 seconds of log in the worst scenario (with the -# default Linux settings). -# -# If you have latency problems turn this to "yes". Otherwise leave it as -# "no" that is the safest pick from the point of view of durability. -no-appendfsync-on-rewrite no - -################################ VIRTUAL MEMORY ############################### - -# Virtual Memory allows Redis to work with datasets bigger than the actual -# amount of RAM needed to hold the whole dataset in memory. -# In order to do so very used keys are taken in memory while the other keys -# are swapped into a swap file, similarly to what operating systems do -# with memory pages. -# -# To enable VM just set 'vm-enabled' to yes, and set the following three -# VM parameters accordingly to your needs. - -vm-enabled no -# vm-enabled yes - -# This is the path of the Redis swap file. As you can guess, swap files -# can't be shared by different Redis instances, so make sure to use a swap -# file for every redis process you are running. Redis will complain if the -# swap file is already in use. -# -# The best kind of storage for the Redis swap file (that's accessed at random) -# is a Solid State Disk (SSD). -# -# *** WARNING *** if you are using a shared hosting the default of putting -# the swap file under /tmp is not secure. Create a dir with access granted -# only to Redis user and configure Redis to create the swap file there. -vm-swap-file /var/lib/redis/redis.swap - -# vm-max-memory configures the VM to use at max the specified amount of -# RAM. Everything that deos not fit will be swapped on disk *if* possible, that -# is, if there is still enough contiguous space in the swap file. -# -# With vm-max-memory 0 the system will swap everything it can. Not a good -# default, just specify the max amount of RAM you can in bytes, but it's -# better to leave some margin. For instance specify an amount of RAM -# that's more or less between 60 and 80% of your free RAM. -vm-max-memory 0 - -# Redis swap files is split into pages. An object can be saved using multiple -# contiguous pages, but pages can't be shared between different objects. -# So if your page is too big, small objects swapped out on disk will waste -# a lot of space. If you page is too small, there is less space in the swap -# file (assuming you configured the same number of total swap file pages). -# -# If you use a lot of small objects, use a page size of 64 or 32 bytes. -# If you use a lot of big objects, use a bigger page size. -# If unsure, use the default :) -vm-page-size 32 - -# Number of total memory pages in the swap file. -# Given that the page table (a bitmap of free/used pages) is taken in memory, -# every 8 pages on disk will consume 1 byte of RAM. -# -# The total swap size is vm-page-size * vm-pages -# -# With the default of 32-bytes memory pages and 134217728 pages Redis will -# use a 4 GB swap file, that will use 16 MB of RAM for the page table. -# -# It's better to use the smallest acceptable value for your application, -# but the default is large in order to work in most conditions. -vm-pages 134217728 - -# Max number of VM I/O threads running at the same time. -# This threads are used to read/write data from/to swap file, since they -# also encode and decode objects from disk to memory or the reverse, a bigger -# number of threads can help with big objects even if they can't help with -# I/O itself as the physical device may not be able to couple with many -# reads/writes operations at the same time. -# -# The special value of 0 turn off threaded I/O and enables the blocking -# Virtual Memory implementation. -vm-max-threads 4 - -############################### ADVANCED CONFIG ############################### - -# Hashes are encoded in a special way (much more memory efficient) when they -# have at max a given numer of elements, and the biggest element does not -# exceed a given threshold. You can configure this limits with the following -# configuration directives. -hash-max-zipmap-entries 512 -hash-max-zipmap-value 64 - -# Similarly to hashes, small lists are also encoded in a special way in order -# to save a lot of space. The special representation is only used when -# you are under the following limits: -list-max-ziplist-entries 512 -list-max-ziplist-value 64 - -# Sets have a special encoding in just one case: when a set is composed -# of just strings that happens to be integers in radix 10 in the range -# of 64 bit signed integers. -# The following configuration setting sets the limit in the size of the -# set in order to use this special memory saving encoding. -set-max-intset-entries 512 - -# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in -# order to help rehashing the main Redis hash table (the one mapping top-level -# keys to values). The hash table implementation redis uses (see dict.c) -# performs a lazy rehashing: the more operation you run into an hash table -# that is rhashing, the more rehashing "steps" are performed, so if the -# server is idle the rehashing is never complete and some more memory is used -# by the hash table. -# -# The default is to use this millisecond 10 times every second in order to -# active rehashing the main dictionaries, freeing memory when possible. -# -# If unsure: -# use "activerehashing no" if you have hard latency requirements and it is -# not a good thing in your environment that Redis can reply form time to time -# to queries with 2 milliseconds delay. -# -# use "activerehashing yes" if you don't have such hard requirements but -# want to free memory asap when possible. -activerehashing yes - -################################## INCLUDES ################################### - -# Include one or more other config files here. This is useful if you -# have a standard template that goes to all redis server but also need -# to customize a few per-server settings. Include files can include -# other files, so use this wisely. -# -# include /path/to/local.conf -# include /path/to/other.conf diff --git a/oldstuff/map-mash/config/routes.rb b/oldstuff/map-mash/config/routes.rb deleted file mode 100644 index 5d979c6..0000000 --- a/oldstuff/map-mash/config/routes.rb +++ /dev/null @@ -1,7 +0,0 @@ -ActionController::Routing::Routes.draw do |map| - map.resources :maps - map.resources :mashes - map.resources :mash_tournaments - - map.root :controller => 'mash_tournaments', :action => 'new' -end diff --git a/oldstuff/map-mash/config/settings.yml b/oldstuff/map-mash/config/settings.yml deleted file mode 100644 index 82d93e5..0000000 --- a/oldstuff/map-mash/config/settings.yml +++ /dev/null @@ -1,5 +0,0 @@ -resque_web: - port: 15678 - -redis: - port: 16379 diff --git a/oldstuff/map-mash/db/capital-cities.csv b/oldstuff/map-mash/db/capital-cities.csv deleted file mode 100644 index 00a41fa..0000000 --- a/oldstuff/map-mash/db/capital-cities.csv +++ /dev/null @@ -1,191 +0,0 @@ -region,city -Afghanistan,Kabul -Albania,Tirane -Algeria,Algiers -Andorra,Andorra la Vella -Angola,Luanda -Antigua and Barbuda,St. John's -Argentina,Buenos Aires -Australia,Canberra -Austria,Vienna -Azerbaijan,Baku -Bahamas,Nassau -Bahrain,Manama -Bangladesh,Dhaka -Barbados,Bridgetown -Belarus,Minsk -Belgium,Brussels -Belize,Belmopan -Benin,Porto-Novo -Bhutan,Thimphu -Bolivia,Sucre -Bosnia and Herzegovina,Sarajevo -Botswana,Gaborone -Brazil,Brasilia -Brunei,Darussalam Bandar Seri Begawan -Bulgaria,Sofia -Burkina Faso,Ouagadougou -Burundi,Bujumbura -Cambodia,Phnom Penh -Cameroon,Yaounde -Canada,Ottawa -Cape Verde,Praia -Central African Republic,Bangui -Chad,N'Djamena -Chile,Santiago -China,Beijing -Colombia,Bogota -Comoros,Moroni -Congo,Brazzaville -Congo,Kinshasa -Costa Rica,San Jose -Cote d'Ivoire,Yamoussoukro -Croatia,Zagreb -Cuba,Havana -Cyprus,Nicosia -Czech Republic,Prague -Denmark,Copenhagen -Djibouti,Djibouti -Dominica,Roseau -Dominican Republic,Santo Domingo -Ecuador,Quito -Egypt,Cairo -El Salvador,San Salvador -Equatorial Guinea,Malabo -Eritrea,Asmara -Estonia,Tallinn -Ethiopia,Addis Ababa -Fiji,Suva -Finland,Helsinki -France,Paris -Gabon,Libreville -Gambia,Banjul -Georgia,Tbilisi -Germany,Berlin -Ghana,Accra -Greece,Athens -Grenada,St. George's -Guatemala,Guatemala City -Guinea,Conakry -Guinea-Bissau,Bissau -Guyana,Georgetown -Haiti,Port-au-Prince -Honduras,Tegucigalpa -Hungary,Budapest -Iceland,Reykjavik -India,New Delhi -Indonesia,Jakarta -Iran,Teheran -Iraq,Baghdad -Ireland,Dublin -Israel,Jerusalem -Italy,Rome -Jamaica,Kingston -Japan,Tokyo -Jordan,Amman -Kazakhstan,Astana -Kenya,Nairobi -Kiribati,South Tarawa -Korea,Pyongyang -Korea,Seoul -Kuwait,Kuwait City -Kyrgyzstan,Bishkek -Laos,Vientiane -Latvia,Riga -Lebanon,Beirut -Lesotho,Maseru -Liberia,Monrovia -Libya,Tripoli -Liechtenstein,Vaduz -Lithuania,Vilnius -Luxembourg,Luxembourg -Macedonia,Skopje -Madagascar,Antananarivo -Malawi,Lilongwe -Malaysia,Kuala Lumpur -Maldives,Male -Mali,Bamako -Malta,Valletta -Marshall Islands,Majuro -Mauritania,Nouakchott -Mauritius,Port Louis -Mexico,Mexico City -Micronesia,Palikir -Moldova,Chisinau -Monaco,Monaco -Mongolia,Ulan Bator -Morocco,Rabat -Mozambique,Maputo -Myanmar,Rangoon -Namibia,Windhoek -Nauru,Yaren -Nepal,Kathmandu -Netherlands,Amsterdam -New Zealand,Wellington -Nicaragua,Managua -Niger,Niamey -Nigeria,Abuja -Norway,Oslo -Oman,Muscat -Pakistan,Islamabad -Palau,Koror -Panama,Panama City -Papua New Guinea,Port Moresby -Paraguay,Asuncion -Peru,Lima -Philippines,Manila -Poland,Warsaw -Portugal,Lisbon -Qatar,Doha -Romania,Bucharest -Russian Federation,Moscow -Rwanda,Kigali -St. Kitts and Nevis,Basseterre -St. Lucia,Castries -St. Vincent and The Grenadines,Kingstown -Samoa,Apia -San Marino,San Marino -Sao Tome and Principe,Sao Tome -Saudi Arabia,Riyadh -Senegal,Dakar -Seychelles,Victoria -Sierra Leone,Freetown -Singapore,Singapore -Slovakia,Bratislava -Slovenia,Ljubljana -Solomon Islands,Honiara -Somalia,Mogadishu -South Africa,Pretoria -Spain,Madrid -Sri Lanka,Colombo -Sudan,Khartoum -Suriname,Paramaribo -Swaziland,Mbabane -Sweden,Stockholm -Switzerland,Bern -Syria,Damascus -Taiwan,Taipei -Tajikistan,Dushanbe -Tanzania,Dar es Salaam -Thailand,Bangkok -Togo,Lome -Tonga,Nuku'alofa -Trinidad and Tobago,Port-of-Spain -Tunisia,Tunis -Turkey,Ankara -Turkmenistan,Ashgabat -Tuvalu,Funafuti -Uganda,Kampala -Ukraine,Kiev -United Arab Emirates,Abu Dhabi -United Kingdom,London -United States,Washington -Uruguay,Montevideo -Uzbekistan,Tashkent -Vanuatu,Port Vila -Venezuela,Caracas -Vietnam,Hanoi -Western Sahara,El Aaiun -Yemen,Sana -Zambia,Lusaka -Zimbabwe,Harare diff --git a/oldstuff/map-mash/db/migrate/20120304151123_create_maps.rb b/oldstuff/map-mash/db/migrate/20120304151123_create_maps.rb deleted file mode 100644 index 0b9e4a2..0000000 --- a/oldstuff/map-mash/db/migrate/20120304151123_create_maps.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateMaps < ActiveRecord::Migration - def self.up - create_table :maps do |t| - t.string :name, :null => false - - t.timestamps - end - - add_index :maps, [:name] - end - - def self.down - remove_index :maps, [:name] - drop_table :maps - end -end diff --git a/oldstuff/map-mash/db/migrate/20120304164625_create_mashes.rb b/oldstuff/map-mash/db/migrate/20120304164625_create_mashes.rb deleted file mode 100644 index 3b130b6..0000000 --- a/oldstuff/map-mash/db/migrate/20120304164625_create_mashes.rb +++ /dev/null @@ -1,22 +0,0 @@ -class CreateMashes < ActiveRecord::Migration - def self.up - create_table :mashes do |t| - t.integer :mash_tournament_id, :null => false - t.integer :map_a_id - t.integer :map_b_id - t.integer :winner_id - t.integer :mash_tournament_round_id - - t.timestamps - end - - add_index :mashes, [:winner_id] - add_index :mashes, [:mash_tournament_id] - end - - def self.down - remove_index :mashes, [:winner_id] - remove_index :mashes, [:mash_tournament_id] - drop_table :mashes - end -end diff --git a/oldstuff/map-mash/db/migrate/20120309000749_create_requesters.rb b/oldstuff/map-mash/db/migrate/20120309000749_create_requesters.rb deleted file mode 100644 index da3197b..0000000 --- a/oldstuff/map-mash/db/migrate/20120309000749_create_requesters.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateRequesters < ActiveRecord::Migration - def self.up - create_table :requesters do |t| - t.string :ip - - t.timestamps - end - end - - def self.down - drop_table :requesters - end -end diff --git a/oldstuff/map-mash/db/migrate/20120309130609_create_mash_tournaments.rb b/oldstuff/map-mash/db/migrate/20120309130609_create_mash_tournaments.rb deleted file mode 100644 index 46dbc2a..0000000 --- a/oldstuff/map-mash/db/migrate/20120309130609_create_mash_tournaments.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CreateMashTournaments < ActiveRecord::Migration - def self.up - create_table :mash_tournaments do |t| - t.references :requester, :null => false - t.integer :total_rounds, :default => 1 - - t.timestamps - end - - add_index :mash_tournaments, [:requester_id] - add_index :mash_tournaments, [:total_rounds] - end - - def self.down - remove_index :mash_tournaments, [:total_rounds] - remove_index :mash_tournaments, [:requester_id] - drop_table :mash_tournaments - end -end diff --git a/oldstuff/map-mash/db/migrate/20120310035133_create_mash_tournament_rounds.rb b/oldstuff/map-mash/db/migrate/20120310035133_create_mash_tournament_rounds.rb deleted file mode 100644 index 44cbd6c..0000000 --- a/oldstuff/map-mash/db/migrate/20120310035133_create_mash_tournament_rounds.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CreateMashTournamentRounds < ActiveRecord::Migration - def self.up - create_table :mash_tournament_rounds do |t| - t.references :mash_tournament - t.integer :number, :null => false - t.integer :mash_count, :null => false - - t.timestamps - end - - add_index :mash_tournament_rounds, [:mash_tournament_id, :number] - add_index :mash_tournament_rounds, [:mash_count] - end - - def self.down - remove_index :mash_tournament_rounds, [:mash_tournament_id, :number] - remove_index :mash_tournament_rounds, [:mash_count] - drop_table :mash_tournament_rounds - end -end diff --git a/oldstuff/map-mash/db/schema.rb b/oldstuff/map-mash/db/schema.rb deleted file mode 100644 index 120299c..0000000 --- a/oldstuff/map-mash/db/schema.rb +++ /dev/null @@ -1,62 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead of editing this file, -# please use the migrations feature of Active Record to incrementally modify your database, and -# then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your database schema. If you need -# to create the application database on another system, you should be using db:schema:load, not running -# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20120310035133) do - - create_table "maps", :force => true do |t| - t.string "name", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "maps", ["name"], :name => "index_maps_on_name" - - create_table "mash_tournament_rounds", :force => true do |t| - t.integer "mash_tournament_id" - t.integer "number", :null => false - t.integer "mash_count", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "mash_tournament_rounds", ["mash_count"], :name => "index_mash_tournament_rounds_on_mash_count" - add_index "mash_tournament_rounds", ["mash_tournament_id", "number"], :name => "index_mash_tournament_rounds_on_mash_tournament_id_and_number" - - create_table "mash_tournaments", :force => true do |t| - t.integer "requester_id", :null => false - t.integer "total_rounds", :default => 1 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "mash_tournaments", ["requester_id"], :name => "index_mash_tournaments_on_requester_id" - add_index "mash_tournaments", ["total_rounds"], :name => "index_mash_tournaments_on_total_rounds" - - create_table "mashes", :force => true do |t| - t.integer "mash_tournament_id", :null => false - t.integer "map_a_id" - t.integer "map_b_id" - t.integer "winner_id" - t.integer "mash_tournament_round_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "mashes", ["mash_tournament_id"], :name => "index_mashes_on_mash_tournament_id" - add_index "mashes", ["winner_id"], :name => "index_mashes_on_winner_id" - - create_table "requesters", :force => true do |t| - t.string "ip" - t.datetime "created_at" - t.datetime "updated_at" - end - -end diff --git a/oldstuff/map-mash/db/top-us-cities.csv b/oldstuff/map-mash/db/top-us-cities.csv deleted file mode 100644 index 435da4c..0000000 --- a/oldstuff/map-mash/db/top-us-cities.csv +++ /dev/null @@ -1,10 +0,0 @@ -city,region -Omaha,Nebraska -Charlotte,North Carolina -Nashville,Tenessee -Colorado Springs,Colorado -Knoxville,Tenessee -Lexington,Kentucky -Little Rock,Arkansas -Wichita,Kansas -Cedar Rapids,Iowa diff --git a/oldstuff/map-mash/doc/README_FOR_APP b/oldstuff/map-mash/doc/README_FOR_APP deleted file mode 100644 index fe41f5c..0000000 --- a/oldstuff/map-mash/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/oldstuff/map-mash/lib/google_map_location_fetcher.rb b/oldstuff/map-mash/lib/google_map_location_fetcher.rb deleted file mode 100644 index dfd9bc3..0000000 --- a/oldstuff/map-mash/lib/google_map_location_fetcher.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'base64' -require 'logger' -require 'uri' - -require 'nokogiri' -require 'typhoeus' - - -class GoogleMapLocationFetcher - attr_accessor :base_map_url, :log - - def initialize - @base_map_url = [ - 'http://maps.googleapis.com/maps/api/staticmap', - '?zoom=12', - '&sensor=false', - '&size=512x512', - '&maptype=satellite', - ].join('') - - @log = Logger.new( - File.expand_path('../log/map-crawler.log', File.dirname(__FILE__)) - ) - @log.level = Logger::INFO - @log.formatter = lambda do |severity, time, prog, message| - "#{time} - #{severity} - #{message}\n" - end - end - - def self.mapdump_callback(location, image) - puts "Map '#{location}':" - puts Base64.encode64(image) - end - - def fetch(locations, &callback) - callback ||= self.class.method(:mapdump_callback) - hydra = Typhoeus::Hydra.new(:initial_pool_size => 26) - - locations.each do |location| - request = Typhoeus::Request.new( - "#{@base_map_url}¢er=#{URI.encode(location)}" - ) - request.on_complete do |response| - handle_response(response, location, &callback) - end - - hydra.queue(request) - end - - hydra.run - end - - def handle_response(response, location, &callback) - @log.info("Handling request at url #{response.effective_url}") - if response.success? and response.headers_hash[:content_type] =~ /image\/.*/ - callback.call(location, response.body) - else - callback.call(location, '') - end - end -end diff --git a/oldstuff/map-mash/lib/mash_tournament_builder.rb b/oldstuff/map-mash/lib/mash_tournament_builder.rb deleted file mode 100644 index 0e0b47d..0000000 --- a/oldstuff/map-mash/lib/mash_tournament_builder.rb +++ /dev/null @@ -1,128 +0,0 @@ -require 'logger' - - -class MashTournamentBuilder - attr_accessor :tournament, :tournament_model, :round_model - attr_accessor :map_model, :mash_model - - def initialize(tournament, tournament_model, round_model, - map_model, mash_model) - @tournament = tournament - @tournament_model = tournament_model - @round_model = round_model - @map_model = map_model - @mash_model = mash_model - @logger = Logger.new( - File.expand_path( - '../log/mash-tournament-builder.log', File.dirname(__FILE__) - ) - ) - end - - def valid_number_of_contenders?(n_contenders) - [8, 16, 32, 64, 128].include?(n_contenders) - end - - def create_rounds_for_contenders(n_contenders) - if not valid_number_of_contenders?(n_contenders) - raise StandardError.new( - "The number of contenders must be 8, 16, 32, 64, or 128! " + - "Got '#{n_contenders}'" - ) - end - - round = 1 - - while n_contenders > 1 - create_round(round, n_contenders) - n_contenders = n_contenders / 2 - round += 1 - end - - @tournament.total_rounds = round - 1 - end - - def fill_in_next_round - @tournament.rounds.sort{ |a,b| a.number <=> b.number}.each do |round| - if not round.done? - return assign_maps_for_round(round) - end - end - end - - private - def create_round(round_number, n_contenders) - round_options = { - :mash_tournament_id => @tournament.id, - :number => round_number, - :mash_count => n_contenders / 2 - } - @logger.info("Creating round #{round_number} of #{n_contenders} contenders " + - "with options: #{round_options.inspect}") - - round = @round_model.new(round_options) - round.save! - - round.mash_count.times do - @mash_model.new( - :mash_tournament_id => @tournament.id, - :mash_tournament_round_id => round.id - ).save! - end - end - - def assign_maps_for_round(round) - if round.number == 1 - return assign_maps_for_round_one(round) - end - - previous = @round_model.find_by_mash_tournament_id_and_number( - @tournament.id, round.number - 1 - ) - previous_winners = previous.mashes.collect(&:winner_id) - pool = @map_model.all( - :order => 'RANDOM()', - :conditions => {:id => previous_winners} - ) - - filled_in = [] - - round.mashes.each do |mash| - mash.map_a = pool.pop - mash.map_b = pool.pop - mash.save! - - filled_in << mash - end - - filled_in - end - - def assign_maps_for_round_one(round) - pool_options = { - :order => 'RANDOM()', - :limit => round.mash_count * 2 - } - @logger.info("Allocating pool with options: #{pool_options.inspect}") - pool = @map_model.all(pool_options) - - @logger.info("Populating mashes from pool: #{pool.inspect}") - - filled_in = [] - - round.mashes.each do |mash| - map_a = pool.pop - map_b = pool.pop - @logger.info("Assigning `map_a` from #{map_a.inspect}, " + - "`map_b` from #{map_b.inspect} to mash #{mash.inspect}") - - mash.map_a = map_a - mash.map_b = map_b - mash.save! - - filled_in << mash - end - - filled_in - end -end diff --git a/oldstuff/map-mash/lib/tasks/maps.rake b/oldstuff/map-mash/lib/tasks/maps.rake deleted file mode 100644 index 523187c..0000000 --- a/oldstuff/map-mash/lib/tasks/maps.rake +++ /dev/null @@ -1,25 +0,0 @@ -namespace :maps do - desc 'Seed the maps!' - task :seed => :environment do - require 'app/models/map' - - csv_filename = File.expand_path( - '../../db/capital-cities.csv', File.dirname(__FILE__) - ) - Map.import(csv_filename) do |map| - puts "Seeded map '#{map.name}'" - end - end - - desc 'Seed the maps a little bit less!' - task :miniseed => :environment do - require 'app/models/map' - - csv_filename = File.expand_path( - '../../db/top-us-cities.csv', File.dirname(__FILE__) - ) - Map.import(csv_filename) do |map| - puts "Seeded map '#{map.name}'" - end - end -end diff --git a/oldstuff/map-mash/lib/tasks/rspec.rake b/oldstuff/map-mash/lib/tasks/rspec.rake deleted file mode 100644 index dba3ffc..0000000 --- a/oldstuff/map-mash/lib/tasks/rspec.rake +++ /dev/null @@ -1,144 +0,0 @@ -gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 -rspec_gem_dir = nil -Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir| - rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb") -end -rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec') - -if rspec_gem_dir && (test ?d, rspec_plugin_dir) - raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n" -end - -if rspec_gem_dir - $LOAD_PATH.unshift("#{rspec_gem_dir}/lib") -elsif File.exist?(rspec_plugin_dir) - $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib") -end - -# Don't load rspec if running "rake gems:*" -unless ARGV.any? {|a| a =~ /^gems/} - -begin - require 'spec/rake/spectask' -rescue MissingSourceFile - module Spec - module Rake - class SpecTask - def initialize(name) - task name do - # if rspec-rails is a configured gem, this will output helpful material and exit ... - require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment")) - - # ... otherwise, do this: - raise <<-MSG - -#{"*" * 80} -* You are trying to run an rspec rake task defined in -* #{__FILE__}, -* but rspec can not be found in vendor/gems, vendor/plugins or system gems. -#{"*" * 80} -MSG - end - end - end - end - end -end - -Rake.application.instance_variable_get('@tasks').delete('default') - -spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop -task :noop do -end - -task :default => :spec -task :stats => "spec:statsetup" - -desc "Run all specs in spec directory (excluding plugin specs)" -Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList['spec/**/*_spec.rb'] -end - -namespace :spec do - desc "Run all specs in spec directory with RCov (excluding plugin specs)" - Spec::Rake::SpecTask.new(:rcov) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList['spec/**/*_spec.rb'] - t.rcov = true - t.rcov_opts = lambda do - IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten - end - end - - desc "Print Specdoc for all specs (excluding plugin specs)" - Spec::Rake::SpecTask.new(:doc) do |t| - t.spec_opts = ["--format", "specdoc", "--dry-run"] - t.spec_files = FileList['spec/**/*_spec.rb'] - end - - desc "Print Specdoc for all plugin examples" - Spec::Rake::SpecTask.new(:plugin_doc) do |t| - t.spec_opts = ["--format", "specdoc", "--dry-run"] - t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*') - end - - [:models, :controllers, :views, :helpers, :lib, :integration].each do |sub| - desc "Run the code examples in spec/#{sub}" - Spec::Rake::SpecTask.new(sub => spec_prereq) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] - end - end - - desc "Run the code examples in vendor/plugins (except RSpec's own)" - Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*") - end - - namespace :plugins do - desc "Runs the examples for rspec_on_rails" - Spec::Rake::SpecTask.new(:rspec_on_rails) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb'] - end - end - - # Setup specs for stats - task :statsetup do - require 'code_statistics' - ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models') - ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views') - ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers') - ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers') - ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib') - ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing') - ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration') - ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models') - ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views') - ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers') - ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers') - ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib') - ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing') - ::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration') - end - - namespace :db do - namespace :fixtures do - desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z." - task :load => :environment do - ActiveRecord::Base.establish_connection(Rails.env) - base_dir = File.join(Rails.root, 'spec', 'fixtures') - fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir - - require 'active_record/fixtures' - (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file| - Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*')) - end - end - end - end -end - -end diff --git a/oldstuff/map-mash/log/.gitkeep b/oldstuff/map-mash/log/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/map-mash/public/404.html b/oldstuff/map-mash/public/404.html deleted file mode 100644 index eff660b..0000000 --- a/oldstuff/map-mash/public/404.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - The page you were looking for doesn't exist (404) - - - - - -
    -

    The page you were looking for doesn't exist.

    -

    You may have mistyped the address or the page may have moved.

    -
    - - \ No newline at end of file diff --git a/oldstuff/map-mash/public/422.html b/oldstuff/map-mash/public/422.html deleted file mode 100644 index b54e4a3..0000000 --- a/oldstuff/map-mash/public/422.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - The change you wanted was rejected (422) - - - - - -
    -

    The change you wanted was rejected.

    -

    Maybe you tried to change something you didn't have access to.

    -
    - - \ No newline at end of file diff --git a/oldstuff/map-mash/public/500.html b/oldstuff/map-mash/public/500.html deleted file mode 100644 index ec3bbf0..0000000 --- a/oldstuff/map-mash/public/500.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - We're sorry, but something went wrong (500) - - - - - -
    -

    We're sorry, but something went wrong.

    -

    We've been notified about this issue and we'll take a look at it shortly.

    -
    - - diff --git a/oldstuff/map-mash/public/favicon.ico b/oldstuff/map-mash/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/map-mash/public/images/rails.png b/oldstuff/map-mash/public/images/rails.png deleted file mode 100644 index d5edc04..0000000 Binary files a/oldstuff/map-mash/public/images/rails.png and /dev/null differ diff --git a/oldstuff/map-mash/public/javascripts/application.js b/oldstuff/map-mash/public/javascripts/application.js deleted file mode 100644 index fe45776..0000000 --- a/oldstuff/map-mash/public/javascripts/application.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place your application-specific JavaScript functions and classes here -// This file is automatically included by javascript_include_tag :defaults diff --git a/oldstuff/map-mash/public/javascripts/controls.js b/oldstuff/map-mash/public/javascripts/controls.js deleted file mode 100644 index ca29aef..0000000 --- a/oldstuff/map-mash/public/javascripts/controls.js +++ /dev/null @@ -1,963 +0,0 @@ -// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan) -// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) -// Contributors: -// Richard Livsey -// Rahul Bhargava -// Rob Wills -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// Autocompleter.Base handles all the autocompletion functionality -// that's independent of the data source for autocompletion. This -// includes drawing the autocompletion menu, observing keyboard -// and mouse events, and similar. -// -// Specific autocompleters need to provide, at the very least, -// a getUpdatedChoices function that will be invoked every time -// the text inside the monitored textbox changes. This method -// should get the text for which to provide autocompletion by -// invoking this.getToken(), NOT by directly accessing -// this.element.value. This is to allow incremental tokenized -// autocompletion. Specific auto-completion logic (AJAX, etc) -// belongs in getUpdatedChoices. -// -// Tokenized incremental autocompletion is enabled automatically -// when an autocompleter is instantiated with the 'tokens' option -// in the options parameter, e.g.: -// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); -// will incrementally autocomplete with a comma as the token. -// Additionally, ',' in the above example can be replaced with -// a token array, e.g. { tokens: [',', '\n'] } which -// enables autocompletion on multiple tokens. This is most -// useful when one of the tokens is \n (a newline), as it -// allows smart autocompletion after linebreaks. - -if(typeof Effect == 'undefined') - throw("controls.js requires including script.aculo.us' effects.js library"); - -var Autocompleter = { }; -Autocompleter.Base = Class.create({ - baseInitialize: function(element, update, options) { - element = $(element); - this.element = element; - this.update = $(update); - this.hasFocus = false; - this.changed = false; - this.active = false; - this.index = 0; - this.entryCount = 0; - this.oldElementValue = this.element.value; - - if(this.setOptions) - this.setOptions(options); - else - this.options = options || { }; - - this.options.paramName = this.options.paramName || this.element.name; - this.options.tokens = this.options.tokens || []; - this.options.frequency = this.options.frequency || 0.4; - this.options.minChars = this.options.minChars || 1; - this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - Position.clone(element, update, { - setHeight: false, - offsetTop: element.offsetHeight - }); - } - Effect.Appear(update,{duration:0.15}); - }; - this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - - if(typeof(this.options.tokens) == 'string') - this.options.tokens = new Array(this.options.tokens); - // Force carriage returns as token delimiters anyway - if (!this.options.tokens.include('\n')) - this.options.tokens.push('\n'); - - this.observer = null; - - this.element.setAttribute('autocomplete','off'); - - Element.hide(this.update); - - Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); - }, - - show: function() { - if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && - (Prototype.Browser.IE) && - (Element.getStyle(this.update, 'position')=='absolute')) { - new Insertion.After(this.update, - ''); - this.iefix = $(this.update.id+'_iefix'); - } - if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); - }, - - fixIEOverlapping: function() { - Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); - this.iefix.style.zIndex = 1; - this.update.style.zIndex = 2; - Element.show(this.iefix); - }, - - hide: function() { - this.stopIndicator(); - if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); - if(this.iefix) Element.hide(this.iefix); - }, - - startIndicator: function() { - if(this.options.indicator) Element.show(this.options.indicator); - }, - - stopIndicator: function() { - if(this.options.indicator) Element.hide(this.options.indicator); - }, - - onKeyPress: function(event) { - if(this.active) - switch(event.keyCode) { - case Event.KEY_TAB: - case Event.KEY_RETURN: - this.selectEntry(); - Event.stop(event); - case Event.KEY_ESC: - this.hide(); - this.active = false; - Event.stop(event); - return; - case Event.KEY_LEFT: - case Event.KEY_RIGHT: - return; - case Event.KEY_UP: - this.markPrevious(); - this.render(); - Event.stop(event); - return; - case Event.KEY_DOWN: - this.markNext(); - this.render(); - Event.stop(event); - return; - } - else - if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || - (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; - - this.changed = true; - this.hasFocus = true; - - if(this.observer) clearTimeout(this.observer); - this.observer = - setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); - }, - - activate: function() { - this.changed = false; - this.hasFocus = true; - this.getUpdatedChoices(); - }, - - onHover: function(event) { - var element = Event.findElement(event, 'LI'); - if(this.index != element.autocompleteIndex) - { - this.index = element.autocompleteIndex; - this.render(); - } - Event.stop(event); - }, - - onClick: function(event) { - var element = Event.findElement(event, 'LI'); - this.index = element.autocompleteIndex; - this.selectEntry(); - this.hide(); - }, - - onBlur: function(event) { - // needed to make click events working - setTimeout(this.hide.bind(this), 250); - this.hasFocus = false; - this.active = false; - }, - - render: function() { - if(this.entryCount > 0) { - for (var i = 0; i < this.entryCount; i++) - this.index==i ? - Element.addClassName(this.getEntry(i),"selected") : - Element.removeClassName(this.getEntry(i),"selected"); - if(this.hasFocus) { - this.show(); - this.active = true; - } - } else { - this.active = false; - this.hide(); - } - }, - - markPrevious: function() { - if(this.index > 0) this.index--; - else this.index = this.entryCount-1; - this.getEntry(this.index).scrollIntoView(true); - }, - - markNext: function() { - if(this.index < this.entryCount-1) this.index++; - else this.index = 0; - this.getEntry(this.index).scrollIntoView(false); - }, - - getEntry: function(index) { - return this.update.firstChild.childNodes[index]; - }, - - getCurrentEntry: function() { - return this.getEntry(this.index); - }, - - selectEntry: function() { - this.active = false; - this.updateElement(this.getCurrentEntry()); - }, - - updateElement: function(selectedElement) { - if (this.options.updateElement) { - this.options.updateElement(selectedElement); - return; - } - var value = ''; - if (this.options.select) { - var nodes = $(selectedElement).select('.' + this.options.select) || []; - if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); - } else - value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); - - var bounds = this.getTokenBounds(); - if (bounds[0] != -1) { - var newValue = this.element.value.substr(0, bounds[0]); - var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); - if (whitespace) - newValue += whitespace[0]; - this.element.value = newValue + value + this.element.value.substr(bounds[1]); - } else { - this.element.value = value; - } - this.oldElementValue = this.element.value; - this.element.focus(); - - if (this.options.afterUpdateElement) - this.options.afterUpdateElement(this.element, selectedElement); - }, - - updateChoices: function(choices) { - if(!this.changed && this.hasFocus) { - this.update.innerHTML = choices; - Element.cleanWhitespace(this.update); - Element.cleanWhitespace(this.update.down()); - - if(this.update.firstChild && this.update.down().childNodes) { - this.entryCount = - this.update.down().childNodes.length; - for (var i = 0; i < this.entryCount; i++) { - var entry = this.getEntry(i); - entry.autocompleteIndex = i; - this.addObservers(entry); - } - } else { - this.entryCount = 0; - } - - this.stopIndicator(); - this.index = 0; - - if(this.entryCount==1 && this.options.autoSelect) { - this.selectEntry(); - this.hide(); - } else { - this.render(); - } - } - }, - - addObservers: function(element) { - Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); - Event.observe(element, "click", this.onClick.bindAsEventListener(this)); - }, - - onObserverEvent: function() { - this.changed = false; - this.tokenBounds = null; - if(this.getToken().length>=this.options.minChars) { - this.getUpdatedChoices(); - } else { - this.active = false; - this.hide(); - } - this.oldElementValue = this.element.value; - }, - - getToken: function() { - var bounds = this.getTokenBounds(); - return this.element.value.substring(bounds[0], bounds[1]).strip(); - }, - - getTokenBounds: function() { - if (null != this.tokenBounds) return this.tokenBounds; - var value = this.element.value; - if (value.strip().empty()) return [-1, 0]; - var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); - var offset = (diff == this.oldElementValue.length ? 1 : 0); - var prevTokenPos = -1, nextTokenPos = value.length; - var tp; - for (var index = 0, l = this.options.tokens.length; index < l; ++index) { - tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); - if (tp > prevTokenPos) prevTokenPos = tp; - tp = value.indexOf(this.options.tokens[index], diff + offset); - if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; - } - return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); - } -}); - -Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { - var boundary = Math.min(newS.length, oldS.length); - for (var index = 0; index < boundary; ++index) - if (newS[index] != oldS[index]) - return index; - return boundary; -}; - -Ajax.Autocompleter = Class.create(Autocompleter.Base, { - initialize: function(element, update, url, options) { - this.baseInitialize(element, update, options); - this.options.asynchronous = true; - this.options.onComplete = this.onComplete.bind(this); - this.options.defaultParams = this.options.parameters || null; - this.url = url; - }, - - getUpdatedChoices: function() { - this.startIndicator(); - - var entry = encodeURIComponent(this.options.paramName) + '=' + - encodeURIComponent(this.getToken()); - - this.options.parameters = this.options.callback ? - this.options.callback(this.element, entry) : entry; - - if(this.options.defaultParams) - this.options.parameters += '&' + this.options.defaultParams; - - new Ajax.Request(this.url, this.options); - }, - - onComplete: function(request) { - this.updateChoices(request.responseText); - } -}); - -// The local array autocompleter. Used when you'd prefer to -// inject an array of autocompletion options into the page, rather -// than sending out Ajax queries, which can be quite slow sometimes. -// -// The constructor takes four parameters. The first two are, as usual, -// the id of the monitored textbox, and id of the autocompletion menu. -// The third is the array you want to autocomplete from, and the fourth -// is the options block. -// -// Extra local autocompletion options: -// - choices - How many autocompletion choices to offer -// -// - partialSearch - If false, the autocompleter will match entered -// text only at the beginning of strings in the -// autocomplete array. Defaults to true, which will -// match text at the beginning of any *word* in the -// strings in the autocomplete array. If you want to -// search anywhere in the string, additionally set -// the option fullSearch to true (default: off). -// -// - fullSsearch - Search anywhere in autocomplete array strings. -// -// - partialChars - How many characters to enter before triggering -// a partial match (unlike minChars, which defines -// how many characters are required to do any match -// at all). Defaults to 2. -// -// - ignoreCase - Whether to ignore case when autocompleting. -// Defaults to true. -// -// It's possible to pass in a custom function as the 'selector' -// option, if you prefer to write your own autocompletion logic. -// In that case, the other options above will not apply unless -// you support them. - -Autocompleter.Local = Class.create(Autocompleter.Base, { - initialize: function(element, update, array, options) { - this.baseInitialize(element, update, options); - this.options.array = array; - }, - - getUpdatedChoices: function() { - this.updateChoices(this.options.selector(this)); - }, - - setOptions: function(options) { - this.options = Object.extend({ - choices: 10, - partialSearch: true, - partialChars: 2, - ignoreCase: true, - fullSearch: false, - selector: function(instance) { - var ret = []; // Beginning matches - var partial = []; // Inside matches - var entry = instance.getToken(); - var count = 0; - - for (var i = 0; i < instance.options.array.length && - ret.length < instance.options.choices ; i++) { - - var elem = instance.options.array[i]; - var foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase()) : - elem.indexOf(entry); - - while (foundPos != -1) { - if (foundPos == 0 && elem.length != entry.length) { - ret.push("
  • " + elem.substr(0, entry.length) + "" + - elem.substr(entry.length) + "
  • "); - break; - } else if (entry.length >= instance.options.partialChars && - instance.options.partialSearch && foundPos != -1) { - if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { - partial.push("
  • " + elem.substr(0, foundPos) + "" + - elem.substr(foundPos, entry.length) + "" + elem.substr( - foundPos + entry.length) + "
  • "); - break; - } - } - - foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : - elem.indexOf(entry, foundPos + 1); - - } - } - if (partial.length) - ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)); - return "
      " + ret.join('') + "
    "; - } - }, options || { }); - } -}); - -// AJAX in-place editor and collection editor -// Full rewrite by Christophe Porteneuve (April 2007). - -// Use this if you notice weird scrolling problems on some browsers, -// the DOM might be a bit confused when this gets called so do this -// waits 1 ms (with setTimeout) until it does the activation -Field.scrollFreeActivate = function(field) { - setTimeout(function() { - Field.activate(field); - }, 1); -}; - -Ajax.InPlaceEditor = Class.create({ - initialize: function(element, url, options) { - this.url = url; - this.element = element = $(element); - this.prepareOptions(); - this._controls = { }; - arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! - Object.extend(this.options, options || { }); - if (!this.options.formId && this.element.id) { - this.options.formId = this.element.id + '-inplaceeditor'; - if ($(this.options.formId)) - this.options.formId = ''; - } - if (this.options.externalControl) - this.options.externalControl = $(this.options.externalControl); - if (!this.options.externalControl) - this.options.externalControlOnly = false; - this._originalBackground = this.element.getStyle('background-color') || 'transparent'; - this.element.title = this.options.clickToEditText; - this._boundCancelHandler = this.handleFormCancellation.bind(this); - this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); - this._boundFailureHandler = this.handleAJAXFailure.bind(this); - this._boundSubmitHandler = this.handleFormSubmission.bind(this); - this._boundWrapperHandler = this.wrapUp.bind(this); - this.registerListeners(); - }, - checkForEscapeOrReturn: function(e) { - if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; - if (Event.KEY_ESC == e.keyCode) - this.handleFormCancellation(e); - else if (Event.KEY_RETURN == e.keyCode) - this.handleFormSubmission(e); - }, - createControl: function(mode, handler, extraClasses) { - var control = this.options[mode + 'Control']; - var text = this.options[mode + 'Text']; - if ('button' == control) { - var btn = document.createElement('input'); - btn.type = 'submit'; - btn.value = text; - btn.className = 'editor_' + mode + '_button'; - if ('cancel' == mode) - btn.onclick = this._boundCancelHandler; - this._form.appendChild(btn); - this._controls[mode] = btn; - } else if ('link' == control) { - var link = document.createElement('a'); - link.href = '#'; - link.appendChild(document.createTextNode(text)); - link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; - link.className = 'editor_' + mode + '_link'; - if (extraClasses) - link.className += ' ' + extraClasses; - this._form.appendChild(link); - this._controls[mode] = link; - } - }, - createEditField: function() { - var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); - var fld; - if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { - fld = document.createElement('input'); - fld.type = 'text'; - var size = this.options.size || this.options.cols || 0; - if (0 < size) fld.size = size; - } else { - fld = document.createElement('textarea'); - fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); - fld.cols = this.options.cols || 40; - } - fld.name = this.options.paramName; - fld.value = text; // No HTML breaks conversion anymore - fld.className = 'editor_field'; - if (this.options.submitOnBlur) - fld.onblur = this._boundSubmitHandler; - this._controls.editor = fld; - if (this.options.loadTextURL) - this.loadExternalText(); - this._form.appendChild(this._controls.editor); - }, - createForm: function() { - var ipe = this; - function addText(mode, condition) { - var text = ipe.options['text' + mode + 'Controls']; - if (!text || condition === false) return; - ipe._form.appendChild(document.createTextNode(text)); - }; - this._form = $(document.createElement('form')); - this._form.id = this.options.formId; - this._form.addClassName(this.options.formClassName); - this._form.onsubmit = this._boundSubmitHandler; - this.createEditField(); - if ('textarea' == this._controls.editor.tagName.toLowerCase()) - this._form.appendChild(document.createElement('br')); - if (this.options.onFormCustomization) - this.options.onFormCustomization(this, this._form); - addText('Before', this.options.okControl || this.options.cancelControl); - this.createControl('ok', this._boundSubmitHandler); - addText('Between', this.options.okControl && this.options.cancelControl); - this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); - addText('After', this.options.okControl || this.options.cancelControl); - }, - destroy: function() { - if (this._oldInnerHTML) - this.element.innerHTML = this._oldInnerHTML; - this.leaveEditMode(); - this.unregisterListeners(); - }, - enterEditMode: function(e) { - if (this._saving || this._editing) return; - this._editing = true; - this.triggerCallback('onEnterEditMode'); - if (this.options.externalControl) - this.options.externalControl.hide(); - this.element.hide(); - this.createForm(); - this.element.parentNode.insertBefore(this._form, this.element); - if (!this.options.loadTextURL) - this.postProcessEditField(); - if (e) Event.stop(e); - }, - enterHover: function(e) { - if (this.options.hoverClassName) - this.element.addClassName(this.options.hoverClassName); - if (this._saving) return; - this.triggerCallback('onEnterHover'); - }, - getText: function() { - return this.element.innerHTML.unescapeHTML(); - }, - handleAJAXFailure: function(transport) { - this.triggerCallback('onFailure', transport); - if (this._oldInnerHTML) { - this.element.innerHTML = this._oldInnerHTML; - this._oldInnerHTML = null; - } - }, - handleFormCancellation: function(e) { - this.wrapUp(); - if (e) Event.stop(e); - }, - handleFormSubmission: function(e) { - var form = this._form; - var value = $F(this._controls.editor); - this.prepareSubmission(); - var params = this.options.callback(form, value) || ''; - if (Object.isString(params)) - params = params.toQueryParams(); - params.editorId = this.element.id; - if (this.options.htmlResponse) { - var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); - Object.extend(options, { - parameters: params, - onComplete: this._boundWrapperHandler, - onFailure: this._boundFailureHandler - }); - new Ajax.Updater({ success: this.element }, this.url, options); - } else { - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: params, - onComplete: this._boundWrapperHandler, - onFailure: this._boundFailureHandler - }); - new Ajax.Request(this.url, options); - } - if (e) Event.stop(e); - }, - leaveEditMode: function() { - this.element.removeClassName(this.options.savingClassName); - this.removeForm(); - this.leaveHover(); - this.element.style.backgroundColor = this._originalBackground; - this.element.show(); - if (this.options.externalControl) - this.options.externalControl.show(); - this._saving = false; - this._editing = false; - this._oldInnerHTML = null; - this.triggerCallback('onLeaveEditMode'); - }, - leaveHover: function(e) { - if (this.options.hoverClassName) - this.element.removeClassName(this.options.hoverClassName); - if (this._saving) return; - this.triggerCallback('onLeaveHover'); - }, - loadExternalText: function() { - this._form.addClassName(this.options.loadingClassName); - this._controls.editor.disabled = true; - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - this._form.removeClassName(this.options.loadingClassName); - var text = transport.responseText; - if (this.options.stripLoadedTextTags) - text = text.stripTags(); - this._controls.editor.value = text; - this._controls.editor.disabled = false; - this.postProcessEditField(); - }.bind(this), - onFailure: this._boundFailureHandler - }); - new Ajax.Request(this.options.loadTextURL, options); - }, - postProcessEditField: function() { - var fpc = this.options.fieldPostCreation; - if (fpc) - $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); - }, - prepareOptions: function() { - this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); - Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); - [this._extraDefaultOptions].flatten().compact().each(function(defs) { - Object.extend(this.options, defs); - }.bind(this)); - }, - prepareSubmission: function() { - this._saving = true; - this.removeForm(); - this.leaveHover(); - this.showSaving(); - }, - registerListeners: function() { - this._listeners = { }; - var listener; - $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { - listener = this[pair.value].bind(this); - this._listeners[pair.key] = listener; - if (!this.options.externalControlOnly) - this.element.observe(pair.key, listener); - if (this.options.externalControl) - this.options.externalControl.observe(pair.key, listener); - }.bind(this)); - }, - removeForm: function() { - if (!this._form) return; - this._form.remove(); - this._form = null; - this._controls = { }; - }, - showSaving: function() { - this._oldInnerHTML = this.element.innerHTML; - this.element.innerHTML = this.options.savingText; - this.element.addClassName(this.options.savingClassName); - this.element.style.backgroundColor = this._originalBackground; - this.element.show(); - }, - triggerCallback: function(cbName, arg) { - if ('function' == typeof this.options[cbName]) { - this.options[cbName](this, arg); - } - }, - unregisterListeners: function() { - $H(this._listeners).each(function(pair) { - if (!this.options.externalControlOnly) - this.element.stopObserving(pair.key, pair.value); - if (this.options.externalControl) - this.options.externalControl.stopObserving(pair.key, pair.value); - }.bind(this)); - }, - wrapUp: function(transport) { - this.leaveEditMode(); - // Can't use triggerCallback due to backward compatibility: requires - // binding + direct element - this._boundComplete(transport, this.element); - } -}); - -Object.extend(Ajax.InPlaceEditor.prototype, { - dispose: Ajax.InPlaceEditor.prototype.destroy -}); - -Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { - initialize: function($super, element, url, options) { - this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; - $super(element, url, options); - }, - - createEditField: function() { - var list = document.createElement('select'); - list.name = this.options.paramName; - list.size = 1; - this._controls.editor = list; - this._collection = this.options.collection || []; - if (this.options.loadCollectionURL) - this.loadCollection(); - else - this.checkForExternalText(); - this._form.appendChild(this._controls.editor); - }, - - loadCollection: function() { - this._form.addClassName(this.options.loadingClassName); - this.showLoadingText(this.options.loadingCollectionText); - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - var js = transport.responseText.strip(); - if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check - throw('Server returned an invalid collection representation.'); - this._collection = eval(js); - this.checkForExternalText(); - }.bind(this), - onFailure: this.onFailure - }); - new Ajax.Request(this.options.loadCollectionURL, options); - }, - - showLoadingText: function(text) { - this._controls.editor.disabled = true; - var tempOption = this._controls.editor.firstChild; - if (!tempOption) { - tempOption = document.createElement('option'); - tempOption.value = ''; - this._controls.editor.appendChild(tempOption); - tempOption.selected = true; - } - tempOption.update((text || '').stripScripts().stripTags()); - }, - - checkForExternalText: function() { - this._text = this.getText(); - if (this.options.loadTextURL) - this.loadExternalText(); - else - this.buildOptionList(); - }, - - loadExternalText: function() { - this.showLoadingText(this.options.loadingText); - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - this._text = transport.responseText.strip(); - this.buildOptionList(); - }.bind(this), - onFailure: this.onFailure - }); - new Ajax.Request(this.options.loadTextURL, options); - }, - - buildOptionList: function() { - this._form.removeClassName(this.options.loadingClassName); - this._collection = this._collection.map(function(entry) { - return 2 === entry.length ? entry : [entry, entry].flatten(); - }); - var marker = ('value' in this.options) ? this.options.value : this._text; - var textFound = this._collection.any(function(entry) { - return entry[0] == marker; - }.bind(this)); - this._controls.editor.update(''); - var option; - this._collection.each(function(entry, index) { - option = document.createElement('option'); - option.value = entry[0]; - option.selected = textFound ? entry[0] == marker : 0 == index; - option.appendChild(document.createTextNode(entry[1])); - this._controls.editor.appendChild(option); - }.bind(this)); - this._controls.editor.disabled = false; - Field.scrollFreeActivate(this._controls.editor); - } -}); - -//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** -//**** This only exists for a while, in order to let **** -//**** users adapt to the new API. Read up on the new **** -//**** API and convert your code to it ASAP! **** - -Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { - if (!options) return; - function fallback(name, expr) { - if (name in options || expr === undefined) return; - options[name] = expr; - }; - fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : - options.cancelLink == options.cancelButton == false ? false : undefined))); - fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : - options.okLink == options.okButton == false ? false : undefined))); - fallback('highlightColor', options.highlightcolor); - fallback('highlightEndColor', options.highlightendcolor); -}; - -Object.extend(Ajax.InPlaceEditor, { - DefaultOptions: { - ajaxOptions: { }, - autoRows: 3, // Use when multi-line w/ rows == 1 - cancelControl: 'link', // 'link'|'button'|false - cancelText: 'cancel', - clickToEditText: 'Click to edit', - externalControl: null, // id|elt - externalControlOnly: false, - fieldPostCreation: 'activate', // 'activate'|'focus'|false - formClassName: 'inplaceeditor-form', - formId: null, // id|elt - highlightColor: '#ffff99', - highlightEndColor: '#ffffff', - hoverClassName: '', - htmlResponse: true, - loadingClassName: 'inplaceeditor-loading', - loadingText: 'Loading...', - okControl: 'button', // 'link'|'button'|false - okText: 'ok', - paramName: 'value', - rows: 1, // If 1 and multi-line, uses autoRows - savingClassName: 'inplaceeditor-saving', - savingText: 'Saving...', - size: 0, - stripLoadedTextTags: false, - submitOnBlur: false, - textAfterControls: '', - textBeforeControls: '', - textBetweenControls: '' - }, - DefaultCallbacks: { - callback: function(form) { - return Form.serialize(form); - }, - onComplete: function(transport, element) { - // For backward compatibility, this one is bound to the IPE, and passes - // the element directly. It was too often customized, so we don't break it. - new Effect.Highlight(element, { - startcolor: this.options.highlightColor, keepBackgroundImage: true }); - }, - onEnterEditMode: null, - onEnterHover: function(ipe) { - ipe.element.style.backgroundColor = ipe.options.highlightColor; - if (ipe._effect) - ipe._effect.cancel(); - }, - onFailure: function(transport, ipe) { - alert('Error communication with the server: ' + transport.responseText.stripTags()); - }, - onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. - onLeaveEditMode: null, - onLeaveHover: function(ipe) { - ipe._effect = new Effect.Highlight(ipe.element, { - startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, - restorecolor: ipe._originalBackground, keepBackgroundImage: true - }); - } - }, - Listeners: { - click: 'enterEditMode', - keydown: 'checkForEscapeOrReturn', - mouseover: 'enterHover', - mouseout: 'leaveHover' - } -}); - -Ajax.InPlaceCollectionEditor.DefaultOptions = { - loadingCollectionText: 'Loading options...' -}; - -// Delayed observer, like Form.Element.Observer, -// but waits for delay after last key input -// Ideal for live-search fields - -Form.Element.DelayedObserver = Class.create({ - initialize: function(element, delay, callback) { - this.delay = delay || 0.5; - this.element = $(element); - this.callback = callback; - this.timer = null; - this.lastValue = $F(this.element); - Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); - }, - delayedListener: function(event) { - if(this.lastValue == $F(this.element)) return; - if(this.timer) clearTimeout(this.timer); - this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); - this.lastValue = $F(this.element); - }, - onTimerEvent: function() { - this.timer = null; - this.callback(this.element, $F(this.element)); - } -}); \ No newline at end of file diff --git a/oldstuff/map-mash/public/javascripts/dragdrop.js b/oldstuff/map-mash/public/javascripts/dragdrop.js deleted file mode 100644 index 07229f9..0000000 --- a/oldstuff/map-mash/public/javascripts/dragdrop.js +++ /dev/null @@ -1,973 +0,0 @@ -// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005-2008 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -if(Object.isUndefined(Effect)) - throw("dragdrop.js requires including script.aculo.us' effects.js library"); - -var Droppables = { - drops: [], - - remove: function(element) { - this.drops = this.drops.reject(function(d) { return d.element==$(element) }); - }, - - add: function(element) { - element = $(element); - var options = Object.extend({ - greedy: true, - hoverclass: null, - tree: false - }, arguments[1] || { }); - - // cache containers - if(options.containment) { - options._containers = []; - var containment = options.containment; - if(Object.isArray(containment)) { - containment.each( function(c) { options._containers.push($(c)) }); - } else { - options._containers.push($(containment)); - } - } - - if(options.accept) options.accept = [options.accept].flatten(); - - Element.makePositioned(element); // fix IE - options.element = element; - - this.drops.push(options); - }, - - findDeepestChild: function(drops) { - deepest = drops[0]; - - for (i = 1; i < drops.length; ++i) - if (Element.isParent(drops[i].element, deepest.element)) - deepest = drops[i]; - - return deepest; - }, - - isContained: function(element, drop) { - var containmentNode; - if(drop.tree) { - containmentNode = element.treeNode; - } else { - containmentNode = element.parentNode; - } - return drop._containers.detect(function(c) { return containmentNode == c }); - }, - - isAffected: function(point, element, drop) { - return ( - (drop.element!=element) && - ((!drop._containers) || - this.isContained(element, drop)) && - ((!drop.accept) || - (Element.classNames(element).detect( - function(v) { return drop.accept.include(v) } ) )) && - Position.within(drop.element, point[0], point[1]) ); - }, - - deactivate: function(drop) { - if(drop.hoverclass) - Element.removeClassName(drop.element, drop.hoverclass); - this.last_active = null; - }, - - activate: function(drop) { - if(drop.hoverclass) - Element.addClassName(drop.element, drop.hoverclass); - this.last_active = drop; - }, - - show: function(point, element) { - if(!this.drops.length) return; - var drop, affected = []; - - this.drops.each( function(drop) { - if(Droppables.isAffected(point, element, drop)) - affected.push(drop); - }); - - if(affected.length>0) - drop = Droppables.findDeepestChild(affected); - - if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); - if (drop) { - Position.within(drop.element, point[0], point[1]); - if(drop.onHover) - drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); - - if (drop != this.last_active) Droppables.activate(drop); - } - }, - - fire: function(event, element) { - if(!this.last_active) return; - Position.prepare(); - - if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) - if (this.last_active.onDrop) { - this.last_active.onDrop(element, this.last_active.element, event); - return true; - } - }, - - reset: function() { - if(this.last_active) - this.deactivate(this.last_active); - } -}; - -var Draggables = { - drags: [], - observers: [], - - register: function(draggable) { - if(this.drags.length == 0) { - this.eventMouseUp = this.endDrag.bindAsEventListener(this); - this.eventMouseMove = this.updateDrag.bindAsEventListener(this); - this.eventKeypress = this.keyPress.bindAsEventListener(this); - - Event.observe(document, "mouseup", this.eventMouseUp); - Event.observe(document, "mousemove", this.eventMouseMove); - Event.observe(document, "keypress", this.eventKeypress); - } - this.drags.push(draggable); - }, - - unregister: function(draggable) { - this.drags = this.drags.reject(function(d) { return d==draggable }); - if(this.drags.length == 0) { - Event.stopObserving(document, "mouseup", this.eventMouseUp); - Event.stopObserving(document, "mousemove", this.eventMouseMove); - Event.stopObserving(document, "keypress", this.eventKeypress); - } - }, - - activate: function(draggable) { - if(draggable.options.delay) { - this._timeout = setTimeout(function() { - Draggables._timeout = null; - window.focus(); - Draggables.activeDraggable = draggable; - }.bind(this), draggable.options.delay); - } else { - window.focus(); // allows keypress events if window isn't currently focused, fails for Safari - this.activeDraggable = draggable; - } - }, - - deactivate: function() { - this.activeDraggable = null; - }, - - updateDrag: function(event) { - if(!this.activeDraggable) return; - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - // Mozilla-based browsers fire successive mousemove events with - // the same coordinates, prevent needless redrawing (moz bug?) - if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; - this._lastPointer = pointer; - - this.activeDraggable.updateDrag(event, pointer); - }, - - endDrag: function(event) { - if(this._timeout) { - clearTimeout(this._timeout); - this._timeout = null; - } - if(!this.activeDraggable) return; - this._lastPointer = null; - this.activeDraggable.endDrag(event); - this.activeDraggable = null; - }, - - keyPress: function(event) { - if(this.activeDraggable) - this.activeDraggable.keyPress(event); - }, - - addObserver: function(observer) { - this.observers.push(observer); - this._cacheObserverCallbacks(); - }, - - removeObserver: function(element) { // element instead of observer fixes mem leaks - this.observers = this.observers.reject( function(o) { return o.element==element }); - this._cacheObserverCallbacks(); - }, - - notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' - if(this[eventName+'Count'] > 0) - this.observers.each( function(o) { - if(o[eventName]) o[eventName](eventName, draggable, event); - }); - if(draggable.options[eventName]) draggable.options[eventName](draggable, event); - }, - - _cacheObserverCallbacks: function() { - ['onStart','onEnd','onDrag'].each( function(eventName) { - Draggables[eventName+'Count'] = Draggables.observers.select( - function(o) { return o[eventName]; } - ).length; - }); - } -}; - -/*--------------------------------------------------------------------------*/ - -var Draggable = Class.create({ - initialize: function(element) { - var defaults = { - handle: false, - reverteffect: function(element, top_offset, left_offset) { - var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; - new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, - queue: {scope:'_draggable', position:'end'} - }); - }, - endeffect: function(element) { - var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; - new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, - queue: {scope:'_draggable', position:'end'}, - afterFinish: function(){ - Draggable._dragging[element] = false - } - }); - }, - zindex: 1000, - revert: false, - quiet: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } - delay: 0 - }; - - if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) - Object.extend(defaults, { - starteffect: function(element) { - element._opacity = Element.getOpacity(element); - Draggable._dragging[element] = true; - new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); - } - }); - - var options = Object.extend(defaults, arguments[1] || { }); - - this.element = $(element); - - if(options.handle && Object.isString(options.handle)) - this.handle = this.element.down('.'+options.handle, 0); - - if(!this.handle) this.handle = $(options.handle); - if(!this.handle) this.handle = this.element; - - if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { - options.scroll = $(options.scroll); - this._isScrollChild = Element.childOf(this.element, options.scroll); - } - - Element.makePositioned(this.element); // fix IE - - this.options = options; - this.dragging = false; - - this.eventMouseDown = this.initDrag.bindAsEventListener(this); - Event.observe(this.handle, "mousedown", this.eventMouseDown); - - Draggables.register(this); - }, - - destroy: function() { - Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); - Draggables.unregister(this); - }, - - currentDelta: function() { - return([ - parseInt(Element.getStyle(this.element,'left') || '0'), - parseInt(Element.getStyle(this.element,'top') || '0')]); - }, - - initDrag: function(event) { - if(!Object.isUndefined(Draggable._dragging[this.element]) && - Draggable._dragging[this.element]) return; - if(Event.isLeftClick(event)) { - // abort on form elements, fixes a Firefox issue - var src = Event.element(event); - if((tag_name = src.tagName.toUpperCase()) && ( - tag_name=='INPUT' || - tag_name=='SELECT' || - tag_name=='OPTION' || - tag_name=='BUTTON' || - tag_name=='TEXTAREA')) return; - - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - var pos = Position.cumulativeOffset(this.element); - this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); - - Draggables.activate(this); - Event.stop(event); - } - }, - - startDrag: function(event) { - this.dragging = true; - if(!this.delta) - this.delta = this.currentDelta(); - - if(this.options.zindex) { - this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); - this.element.style.zIndex = this.options.zindex; - } - - if(this.options.ghosting) { - this._clone = this.element.cloneNode(true); - this._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); - if (!this._originallyAbsolute) - Position.absolutize(this.element); - this.element.parentNode.insertBefore(this._clone, this.element); - } - - if(this.options.scroll) { - if (this.options.scroll == window) { - var where = this._getWindowScroll(this.options.scroll); - this.originalScrollLeft = where.left; - this.originalScrollTop = where.top; - } else { - this.originalScrollLeft = this.options.scroll.scrollLeft; - this.originalScrollTop = this.options.scroll.scrollTop; - } - } - - Draggables.notify('onStart', this, event); - - if(this.options.starteffect) this.options.starteffect(this.element); - }, - - updateDrag: function(event, pointer) { - if(!this.dragging) this.startDrag(event); - - if(!this.options.quiet){ - Position.prepare(); - Droppables.show(pointer, this.element); - } - - Draggables.notify('onDrag', this, event); - - this.draw(pointer); - if(this.options.change) this.options.change(this); - - if(this.options.scroll) { - this.stopScrolling(); - - var p; - if (this.options.scroll == window) { - with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } - } else { - p = Position.page(this.options.scroll); - p[0] += this.options.scroll.scrollLeft + Position.deltaX; - p[1] += this.options.scroll.scrollTop + Position.deltaY; - p.push(p[0]+this.options.scroll.offsetWidth); - p.push(p[1]+this.options.scroll.offsetHeight); - } - var speed = [0,0]; - if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); - if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); - if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); - if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); - this.startScrolling(speed); - } - - // fix AppleWebKit rendering - if(Prototype.Browser.WebKit) window.scrollBy(0,0); - - Event.stop(event); - }, - - finishDrag: function(event, success) { - this.dragging = false; - - if(this.options.quiet){ - Position.prepare(); - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - Droppables.show(pointer, this.element); - } - - if(this.options.ghosting) { - if (!this._originallyAbsolute) - Position.relativize(this.element); - delete this._originallyAbsolute; - Element.remove(this._clone); - this._clone = null; - } - - var dropped = false; - if(success) { - dropped = Droppables.fire(event, this.element); - if (!dropped) dropped = false; - } - if(dropped && this.options.onDropped) this.options.onDropped(this.element); - Draggables.notify('onEnd', this, event); - - var revert = this.options.revert; - if(revert && Object.isFunction(revert)) revert = revert(this.element); - - var d = this.currentDelta(); - if(revert && this.options.reverteffect) { - if (dropped == 0 || revert != 'failure') - this.options.reverteffect(this.element, - d[1]-this.delta[1], d[0]-this.delta[0]); - } else { - this.delta = d; - } - - if(this.options.zindex) - this.element.style.zIndex = this.originalZ; - - if(this.options.endeffect) - this.options.endeffect(this.element); - - Draggables.deactivate(this); - Droppables.reset(); - }, - - keyPress: function(event) { - if(event.keyCode!=Event.KEY_ESC) return; - this.finishDrag(event, false); - Event.stop(event); - }, - - endDrag: function(event) { - if(!this.dragging) return; - this.stopScrolling(); - this.finishDrag(event, true); - Event.stop(event); - }, - - draw: function(point) { - var pos = Position.cumulativeOffset(this.element); - if(this.options.ghosting) { - var r = Position.realOffset(this.element); - pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; - } - - var d = this.currentDelta(); - pos[0] -= d[0]; pos[1] -= d[1]; - - if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { - pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; - pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; - } - - var p = [0,1].map(function(i){ - return (point[i]-pos[i]-this.offset[i]) - }.bind(this)); - - if(this.options.snap) { - if(Object.isFunction(this.options.snap)) { - p = this.options.snap(p[0],p[1],this); - } else { - if(Object.isArray(this.options.snap)) { - p = p.map( function(v, i) { - return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)); - } else { - p = p.map( function(v) { - return (v/this.options.snap).round()*this.options.snap }.bind(this)); - } - }} - - var style = this.element.style; - if((!this.options.constraint) || (this.options.constraint=='horizontal')) - style.left = p[0] + "px"; - if((!this.options.constraint) || (this.options.constraint=='vertical')) - style.top = p[1] + "px"; - - if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering - }, - - stopScrolling: function() { - if(this.scrollInterval) { - clearInterval(this.scrollInterval); - this.scrollInterval = null; - Draggables._lastScrollPointer = null; - } - }, - - startScrolling: function(speed) { - if(!(speed[0] || speed[1])) return; - this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; - this.lastScrolled = new Date(); - this.scrollInterval = setInterval(this.scroll.bind(this), 10); - }, - - scroll: function() { - var current = new Date(); - var delta = current - this.lastScrolled; - this.lastScrolled = current; - if(this.options.scroll == window) { - with (this._getWindowScroll(this.options.scroll)) { - if (this.scrollSpeed[0] || this.scrollSpeed[1]) { - var d = delta / 1000; - this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); - } - } - } else { - this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; - this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; - } - - Position.prepare(); - Droppables.show(Draggables._lastPointer, this.element); - Draggables.notify('onDrag', this); - if (this._isScrollChild) { - Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); - Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; - Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; - if (Draggables._lastScrollPointer[0] < 0) - Draggables._lastScrollPointer[0] = 0; - if (Draggables._lastScrollPointer[1] < 0) - Draggables._lastScrollPointer[1] = 0; - this.draw(Draggables._lastScrollPointer); - } - - if(this.options.change) this.options.change(this); - }, - - _getWindowScroll: function(w) { - var T, L, W, H; - with (w.document) { - if (w.document.documentElement && documentElement.scrollTop) { - T = documentElement.scrollTop; - L = documentElement.scrollLeft; - } else if (w.document.body) { - T = body.scrollTop; - L = body.scrollLeft; - } - if (w.innerWidth) { - W = w.innerWidth; - H = w.innerHeight; - } else if (w.document.documentElement && documentElement.clientWidth) { - W = documentElement.clientWidth; - H = documentElement.clientHeight; - } else { - W = body.offsetWidth; - H = body.offsetHeight; - } - } - return { top: T, left: L, width: W, height: H }; - } -}); - -Draggable._dragging = { }; - -/*--------------------------------------------------------------------------*/ - -var SortableObserver = Class.create({ - initialize: function(element, observer) { - this.element = $(element); - this.observer = observer; - this.lastValue = Sortable.serialize(this.element); - }, - - onStart: function() { - this.lastValue = Sortable.serialize(this.element); - }, - - onEnd: function() { - Sortable.unmark(); - if(this.lastValue != Sortable.serialize(this.element)) - this.observer(this.element) - } -}); - -var Sortable = { - SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, - - sortables: { }, - - _findRootElement: function(element) { - while (element.tagName.toUpperCase() != "BODY") { - if(element.id && Sortable.sortables[element.id]) return element; - element = element.parentNode; - } - }, - - options: function(element) { - element = Sortable._findRootElement($(element)); - if(!element) return; - return Sortable.sortables[element.id]; - }, - - destroy: function(element){ - element = $(element); - var s = Sortable.sortables[element.id]; - - if(s) { - Draggables.removeObserver(s.element); - s.droppables.each(function(d){ Droppables.remove(d) }); - s.draggables.invoke('destroy'); - - delete Sortable.sortables[s.element.id]; - } - }, - - create: function(element) { - element = $(element); - var options = Object.extend({ - element: element, - tag: 'li', // assumes li children, override with tag: 'tagname' - dropOnEmpty: false, - tree: false, - treeTag: 'ul', - overlap: 'vertical', // one of 'vertical', 'horizontal' - constraint: 'vertical', // one of 'vertical', 'horizontal', false - containment: element, // also takes array of elements (or id's); or false - handle: false, // or a CSS class - only: false, - delay: 0, - hoverclass: null, - ghosting: false, - quiet: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - format: this.SERIALIZE_RULE, - - // these take arrays of elements or ids and can be - // used for better initialization performance - elements: false, - handles: false, - - onChange: Prototype.emptyFunction, - onUpdate: Prototype.emptyFunction - }, arguments[1] || { }); - - // clear any old sortable with same element - this.destroy(element); - - // build options for the draggables - var options_for_draggable = { - revert: true, - quiet: options.quiet, - scroll: options.scroll, - scrollSpeed: options.scrollSpeed, - scrollSensitivity: options.scrollSensitivity, - delay: options.delay, - ghosting: options.ghosting, - constraint: options.constraint, - handle: options.handle }; - - if(options.starteffect) - options_for_draggable.starteffect = options.starteffect; - - if(options.reverteffect) - options_for_draggable.reverteffect = options.reverteffect; - else - if(options.ghosting) options_for_draggable.reverteffect = function(element) { - element.style.top = 0; - element.style.left = 0; - }; - - if(options.endeffect) - options_for_draggable.endeffect = options.endeffect; - - if(options.zindex) - options_for_draggable.zindex = options.zindex; - - // build options for the droppables - var options_for_droppable = { - overlap: options.overlap, - containment: options.containment, - tree: options.tree, - hoverclass: options.hoverclass, - onHover: Sortable.onHover - }; - - var options_for_tree = { - onHover: Sortable.onEmptyHover, - overlap: options.overlap, - containment: options.containment, - hoverclass: options.hoverclass - }; - - // fix for gecko engine - Element.cleanWhitespace(element); - - options.draggables = []; - options.droppables = []; - - // drop on empty handling - if(options.dropOnEmpty || options.tree) { - Droppables.add(element, options_for_tree); - options.droppables.push(element); - } - - (options.elements || this.findElements(element, options) || []).each( function(e,i) { - var handle = options.handles ? $(options.handles[i]) : - (options.handle ? $(e).select('.' + options.handle)[0] : e); - options.draggables.push( - new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); - Droppables.add(e, options_for_droppable); - if(options.tree) e.treeNode = element; - options.droppables.push(e); - }); - - if(options.tree) { - (Sortable.findTreeElements(element, options) || []).each( function(e) { - Droppables.add(e, options_for_tree); - e.treeNode = element; - options.droppables.push(e); - }); - } - - // keep reference - this.sortables[element.id] = options; - - // for onupdate - Draggables.addObserver(new SortableObserver(element, options.onUpdate)); - - }, - - // return all suitable-for-sortable elements in a guaranteed order - findElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.tag); - }, - - findTreeElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.treeTag); - }, - - onHover: function(element, dropon, overlap) { - if(Element.isParent(dropon, element)) return; - - if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { - return; - } else if(overlap>0.5) { - Sortable.mark(dropon, 'before'); - if(dropon.previousSibling != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, dropon); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } else { - Sortable.mark(dropon, 'after'); - var nextElement = dropon.nextSibling || null; - if(nextElement != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, nextElement); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } - }, - - onEmptyHover: function(element, dropon, overlap) { - var oldParentNode = element.parentNode; - var droponOptions = Sortable.options(dropon); - - if(!Element.isParent(dropon, element)) { - var index; - - var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); - var child = null; - - if(children) { - var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); - - for (index = 0; index < children.length; index += 1) { - if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { - offset -= Element.offsetSize (children[index], droponOptions.overlap); - } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { - child = index + 1 < children.length ? children[index + 1] : null; - break; - } else { - child = children[index]; - break; - } - } - } - - dropon.insertBefore(element, child); - - Sortable.options(oldParentNode).onChange(element); - droponOptions.onChange(element); - } - }, - - unmark: function() { - if(Sortable._marker) Sortable._marker.hide(); - }, - - mark: function(dropon, position) { - // mark on ghosting only - var sortable = Sortable.options(dropon.parentNode); - if(sortable && !sortable.ghosting) return; - - if(!Sortable._marker) { - Sortable._marker = - ($('dropmarker') || Element.extend(document.createElement('DIV'))). - hide().addClassName('dropmarker').setStyle({position:'absolute'}); - document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); - } - var offsets = Position.cumulativeOffset(dropon); - Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); - - if(position=='after') - if(sortable.overlap == 'horizontal') - Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); - else - Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); - - Sortable._marker.show(); - }, - - _tree: function(element, options, parent) { - var children = Sortable.findElements(element, options) || []; - - for (var i = 0; i < children.length; ++i) { - var match = children[i].id.match(options.format); - - if (!match) continue; - - var child = { - id: encodeURIComponent(match ? match[1] : null), - element: element, - parent: parent, - children: [], - position: parent.children.length, - container: $(children[i]).down(options.treeTag) - }; - - /* Get the element containing the children and recurse over it */ - if (child.container) - this._tree(child.container, options, child); - - parent.children.push (child); - } - - return parent; - }, - - tree: function(element) { - element = $(element); - var sortableOptions = this.options(element); - var options = Object.extend({ - tag: sortableOptions.tag, - treeTag: sortableOptions.treeTag, - only: sortableOptions.only, - name: element.id, - format: sortableOptions.format - }, arguments[1] || { }); - - var root = { - id: null, - parent: null, - children: [], - container: element, - position: 0 - }; - - return Sortable._tree(element, options, root); - }, - - /* Construct a [i] index for a particular node */ - _constructIndex: function(node) { - var index = ''; - do { - if (node.id) index = '[' + node.position + ']' + index; - } while ((node = node.parent) != null); - return index; - }, - - sequence: function(element) { - element = $(element); - var options = Object.extend(this.options(element), arguments[1] || { }); - - return $(this.findElements(element, options) || []).map( function(item) { - return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; - }); - }, - - setSequence: function(element, new_sequence) { - element = $(element); - var options = Object.extend(this.options(element), arguments[2] || { }); - - var nodeMap = { }; - this.findElements(element, options).each( function(n) { - if (n.id.match(options.format)) - nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; - n.parentNode.removeChild(n); - }); - - new_sequence.each(function(ident) { - var n = nodeMap[ident]; - if (n) { - n[1].appendChild(n[0]); - delete nodeMap[ident]; - } - }); - }, - - serialize: function(element) { - element = $(element); - var options = Object.extend(Sortable.options(element), arguments[1] || { }); - var name = encodeURIComponent( - (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); - - if (options.tree) { - return Sortable.tree(element, arguments[1]).children.map( function (item) { - return [name + Sortable._constructIndex(item) + "[id]=" + - encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); - }).flatten().join('&'); - } else { - return Sortable.sequence(element, arguments[1]).map( function(item) { - return name + "[]=" + encodeURIComponent(item); - }).join('&'); - } - } -}; - -// Returns true if child is contained within element -Element.isParent = function(child, element) { - if (!child.parentNode || child == element) return false; - if (child.parentNode == element) return true; - return Element.isParent(child.parentNode, element); -}; - -Element.findChildren = function(element, only, recursive, tagName) { - if(!element.hasChildNodes()) return null; - tagName = tagName.toUpperCase(); - if(only) only = [only].flatten(); - var elements = []; - $A(element.childNodes).each( function(e) { - if(e.tagName && e.tagName.toUpperCase()==tagName && - (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) - elements.push(e); - if(recursive) { - var grandchildren = Element.findChildren(e, only, recursive, tagName); - if(grandchildren) elements.push(grandchildren); - } - }); - - return (elements.length>0 ? elements.flatten() : []); -}; - -Element.offsetSize = function (element, type) { - return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; -}; \ No newline at end of file diff --git a/oldstuff/map-mash/public/javascripts/effects.js b/oldstuff/map-mash/public/javascripts/effects.js deleted file mode 100644 index 5a639d2..0000000 --- a/oldstuff/map-mash/public/javascripts/effects.js +++ /dev/null @@ -1,1128 +0,0 @@ -// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// Contributors: -// Justin Palmer (http://encytemedia.com/) -// Mark Pilgrim (http://diveintomark.org/) -// Martin Bialasinki -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// converts rgb() and #xxx to #xxxxxx format, -// returns self (or first argument) if not convertable -String.prototype.parseColor = function() { - var color = '#'; - if (this.slice(0,4) == 'rgb(') { - var cols = this.slice(4,this.length-1).split(','); - var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); - } else { - if (this.slice(0,1) == '#') { - if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); - if (this.length==7) color = this.toLowerCase(); - } - } - return (color.length==7 ? color : (arguments[0] || this)); -}; - -/*--------------------------------------------------------------------------*/ - -Element.collectTextNodes = function(element) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); - }).flatten().join(''); -}; - -Element.collectTextNodesIgnoreClass = function(element, className) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? - Element.collectTextNodesIgnoreClass(node, className) : '')); - }).flatten().join(''); -}; - -Element.setContentZoom = function(element, percent) { - element = $(element); - element.setStyle({fontSize: (percent/100) + 'em'}); - if (Prototype.Browser.WebKit) window.scrollBy(0,0); - return element; -}; - -Element.getInlineOpacity = function(element){ - return $(element).style.opacity || ''; -}; - -Element.forceRerendering = function(element) { - try { - element = $(element); - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch(e) { } -}; - -/*--------------------------------------------------------------------------*/ - -var Effect = { - _elementDoesNotExistError: { - name: 'ElementDoesNotExistError', - message: 'The specified DOM element does not exist, but is required for this effect to operate' - }, - Transitions: { - linear: Prototype.K, - sinoidal: function(pos) { - return (-Math.cos(pos*Math.PI)/2) + .5; - }, - reverse: function(pos) { - return 1-pos; - }, - flicker: function(pos) { - var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4; - return pos > 1 ? 1 : pos; - }, - wobble: function(pos) { - return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5; - }, - pulse: function(pos, pulses) { - return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5; - }, - spring: function(pos) { - return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); - }, - none: function(pos) { - return 0; - }, - full: function(pos) { - return 1; - } - }, - DefaultOptions: { - duration: 1.0, // seconds - fps: 100, // 100= assume 66fps max. - sync: false, // true for combining - from: 0.0, - to: 1.0, - delay: 0.0, - queue: 'parallel' - }, - tagifyText: function(element) { - var tagifyStyle = 'position:relative'; - if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; - - element = $(element); - $A(element.childNodes).each( function(child) { - if (child.nodeType==3) { - child.nodeValue.toArray().each( function(character) { - element.insertBefore( - new Element('span', {style: tagifyStyle}).update( - character == ' ' ? String.fromCharCode(160) : character), - child); - }); - Element.remove(child); - } - }); - }, - multiple: function(element, effect) { - var elements; - if (((typeof element == 'object') || - Object.isFunction(element)) && - (element.length)) - elements = element; - else - elements = $(element).childNodes; - - var options = Object.extend({ - speed: 0.1, - delay: 0.0 - }, arguments[2] || { }); - var masterDelay = options.delay; - - $A(elements).each( function(element, index) { - new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); - }); - }, - PAIRS: { - 'slide': ['SlideDown','SlideUp'], - 'blind': ['BlindDown','BlindUp'], - 'appear': ['Appear','Fade'] - }, - toggle: function(element, effect) { - element = $(element); - effect = (effect || 'appear').toLowerCase(); - var options = Object.extend({ - queue: { position:'end', scope:(element.id || 'global'), limit: 1 } - }, arguments[2] || { }); - Effect[element.visible() ? - Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); - } -}; - -Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; - -/* ------------- core effects ------------- */ - -Effect.ScopedQueue = Class.create(Enumerable, { - initialize: function() { - this.effects = []; - this.interval = null; - }, - _each: function(iterator) { - this.effects._each(iterator); - }, - add: function(effect) { - var timestamp = new Date().getTime(); - - var position = Object.isString(effect.options.queue) ? - effect.options.queue : effect.options.queue.position; - - switch(position) { - case 'front': - // move unstarted effects after this effect - this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { - e.startOn += effect.finishOn; - e.finishOn += effect.finishOn; - }); - break; - case 'with-last': - timestamp = this.effects.pluck('startOn').max() || timestamp; - break; - case 'end': - // start effect after last queued effect has finished - timestamp = this.effects.pluck('finishOn').max() || timestamp; - break; - } - - effect.startOn += timestamp; - effect.finishOn += timestamp; - - if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) - this.effects.push(effect); - - if (!this.interval) - this.interval = setInterval(this.loop.bind(this), 15); - }, - remove: function(effect) { - this.effects = this.effects.reject(function(e) { return e==effect }); - if (this.effects.length == 0) { - clearInterval(this.interval); - this.interval = null; - } - }, - loop: function() { - var timePos = new Date().getTime(); - for(var i=0, len=this.effects.length;i= this.startOn) { - if (timePos >= this.finishOn) { - this.render(1.0); - this.cancel(); - this.event('beforeFinish'); - if (this.finish) this.finish(); - this.event('afterFinish'); - return; - } - var pos = (timePos - this.startOn) / this.totalTime, - frame = (pos * this.totalFrames).round(); - if (frame > this.currentFrame) { - this.render(pos); - this.currentFrame = frame; - } - } - }, - cancel: function() { - if (!this.options.sync) - Effect.Queues.get(Object.isString(this.options.queue) ? - 'global' : this.options.queue.scope).remove(this); - this.state = 'finished'; - }, - event: function(eventName) { - if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); - if (this.options[eventName]) this.options[eventName](this); - }, - inspect: function() { - var data = $H(); - for(property in this) - if (!Object.isFunction(this[property])) data.set(property, this[property]); - return '#'; - } -}); - -Effect.Parallel = Class.create(Effect.Base, { - initialize: function(effects) { - this.effects = effects || []; - this.start(arguments[1]); - }, - update: function(position) { - this.effects.invoke('render', position); - }, - finish: function(position) { - this.effects.each( function(effect) { - effect.render(1.0); - effect.cancel(); - effect.event('beforeFinish'); - if (effect.finish) effect.finish(position); - effect.event('afterFinish'); - }); - } -}); - -Effect.Tween = Class.create(Effect.Base, { - initialize: function(object, from, to) { - object = Object.isString(object) ? $(object) : object; - var args = $A(arguments), method = args.last(), - options = args.length == 5 ? args[3] : null; - this.method = Object.isFunction(method) ? method.bind(object) : - Object.isFunction(object[method]) ? object[method].bind(object) : - function(value) { object[method] = value }; - this.start(Object.extend({ from: from, to: to }, options || { })); - }, - update: function(position) { - this.method(position); - } -}); - -Effect.Event = Class.create(Effect.Base, { - initialize: function() { - this.start(Object.extend({ duration: 0 }, arguments[0] || { })); - }, - update: Prototype.emptyFunction -}); - -Effect.Opacity = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - // make this work on IE on elements without 'layout' - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - var options = Object.extend({ - from: this.element.getOpacity() || 0.0, - to: 1.0 - }, arguments[1] || { }); - this.start(options); - }, - update: function(position) { - this.element.setOpacity(position); - } -}); - -Effect.Move = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - x: 0, - y: 0, - mode: 'relative' - }, arguments[1] || { }); - this.start(options); - }, - setup: function() { - this.element.makePositioned(); - this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); - this.originalTop = parseFloat(this.element.getStyle('top') || '0'); - if (this.options.mode == 'absolute') { - this.options.x = this.options.x - this.originalLeft; - this.options.y = this.options.y - this.originalTop; - } - }, - update: function(position) { - this.element.setStyle({ - left: (this.options.x * position + this.originalLeft).round() + 'px', - top: (this.options.y * position + this.originalTop).round() + 'px' - }); - } -}); - -// for backwards compatibility -Effect.MoveBy = function(element, toTop, toLeft) { - return new Effect.Move(element, - Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); -}; - -Effect.Scale = Class.create(Effect.Base, { - initialize: function(element, percent) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - scaleX: true, - scaleY: true, - scaleContent: true, - scaleFromCenter: false, - scaleMode: 'box', // 'box' or 'contents' or { } with provided values - scaleFrom: 100.0, - scaleTo: percent - }, arguments[2] || { }); - this.start(options); - }, - setup: function() { - this.restoreAfterFinish = this.options.restoreAfterFinish || false; - this.elementPositioning = this.element.getStyle('position'); - - this.originalStyle = { }; - ['top','left','width','height','fontSize'].each( function(k) { - this.originalStyle[k] = this.element.style[k]; - }.bind(this)); - - this.originalTop = this.element.offsetTop; - this.originalLeft = this.element.offsetLeft; - - var fontSize = this.element.getStyle('font-size') || '100%'; - ['em','px','%','pt'].each( function(fontSizeType) { - if (fontSize.indexOf(fontSizeType)>0) { - this.fontSize = parseFloat(fontSize); - this.fontSizeType = fontSizeType; - } - }.bind(this)); - - this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; - - this.dims = null; - if (this.options.scaleMode=='box') - this.dims = [this.element.offsetHeight, this.element.offsetWidth]; - if (/^content/.test(this.options.scaleMode)) - this.dims = [this.element.scrollHeight, this.element.scrollWidth]; - if (!this.dims) - this.dims = [this.options.scaleMode.originalHeight, - this.options.scaleMode.originalWidth]; - }, - update: function(position) { - var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); - if (this.options.scaleContent && this.fontSize) - this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); - this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); - }, - finish: function(position) { - if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); - }, - setDimensions: function(height, width) { - var d = { }; - if (this.options.scaleX) d.width = width.round() + 'px'; - if (this.options.scaleY) d.height = height.round() + 'px'; - if (this.options.scaleFromCenter) { - var topd = (height - this.dims[0])/2; - var leftd = (width - this.dims[1])/2; - if (this.elementPositioning == 'absolute') { - if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; - if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; - } else { - if (this.options.scaleY) d.top = -topd + 'px'; - if (this.options.scaleX) d.left = -leftd + 'px'; - } - } - this.element.setStyle(d); - } -}); - -Effect.Highlight = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); - this.start(options); - }, - setup: function() { - // Prevent executing on elements not in the layout flow - if (this.element.getStyle('display')=='none') { this.cancel(); return; } - // Disable background image during the effect - this.oldStyle = { }; - if (!this.options.keepBackgroundImage) { - this.oldStyle.backgroundImage = this.element.getStyle('background-image'); - this.element.setStyle({backgroundImage: 'none'}); - } - if (!this.options.endcolor) - this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); - if (!this.options.restorecolor) - this.options.restorecolor = this.element.getStyle('background-color'); - // init color calculations - this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); - this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); - }, - update: function(position) { - this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ - return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); - }, - finish: function() { - this.element.setStyle(Object.extend(this.oldStyle, { - backgroundColor: this.options.restorecolor - })); - } -}); - -Effect.ScrollTo = function(element) { - var options = arguments[1] || { }, - scrollOffsets = document.viewport.getScrollOffsets(), - elementOffsets = $(element).cumulativeOffset(); - - if (options.offset) elementOffsets[1] += options.offset; - - return new Effect.Tween(null, - scrollOffsets.top, - elementOffsets[1], - options, - function(p){ scrollTo(scrollOffsets.left, p.round()); } - ); -}; - -/* ------------- combination effects ------------- */ - -Effect.Fade = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - var options = Object.extend({ - from: element.getOpacity() || 1.0, - to: 0.0, - afterFinishInternal: function(effect) { - if (effect.options.to!=0) return; - effect.element.hide().setStyle({opacity: oldOpacity}); - } - }, arguments[1] || { }); - return new Effect.Opacity(element,options); -}; - -Effect.Appear = function(element) { - element = $(element); - var options = Object.extend({ - from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), - to: 1.0, - // force Safari to render floated elements properly - afterFinishInternal: function(effect) { - effect.element.forceRerendering(); - }, - beforeSetup: function(effect) { - effect.element.setOpacity(effect.options.from).show(); - }}, arguments[1] || { }); - return new Effect.Opacity(element,options); -}; - -Effect.Puff = function(element) { - element = $(element); - var oldStyle = { - opacity: element.getInlineOpacity(), - position: element.getStyle('position'), - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height - }; - return new Effect.Parallel( - [ new Effect.Scale(element, 200, - { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], - Object.extend({ duration: 1.0, - beforeSetupInternal: function(effect) { - Position.absolutize(effect.effects[0].element); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().setStyle(oldStyle); } - }, arguments[1] || { }) - ); -}; - -Effect.BlindUp = function(element) { - element = $(element); - element.makeClipping(); - return new Effect.Scale(element, 0, - Object.extend({ scaleContent: false, - scaleX: false, - restoreAfterFinish: true, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }, arguments[1] || { }) - ); -}; - -Effect.BlindDown = function(element) { - element = $(element); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: 0, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping(); - } - }, arguments[1] || { })); -}; - -Effect.SwitchOff = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - return new Effect.Appear(element, Object.extend({ - duration: 0.4, - from: 0, - transition: Effect.Transitions.flicker, - afterFinishInternal: function(effect) { - new Effect.Scale(effect.element, 1, { - duration: 0.3, scaleFromCenter: true, - scaleX: false, scaleContent: false, restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); - } - }); - } - }, arguments[1] || { })); -}; - -Effect.DropOut = function(element) { - element = $(element); - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left'), - opacity: element.getInlineOpacity() }; - return new Effect.Parallel( - [ new Effect.Move(element, {x: 0, y: 100, sync: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 }) ], - Object.extend( - { duration: 0.5, - beforeSetup: function(effect) { - effect.effects[0].element.makePositioned(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); - } - }, arguments[1] || { })); -}; - -Effect.Shake = function(element) { - element = $(element); - var options = Object.extend({ - distance: 20, - duration: 0.5 - }, arguments[1] || {}); - var distance = parseFloat(options.distance); - var split = parseFloat(options.duration) / 10.0; - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left') }; - return new Effect.Move(element, - { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { - effect.element.undoPositioned().setStyle(oldStyle); - }}); }}); }}); }}); }}); }}); -}; - -Effect.SlideDown = function(element) { - element = $(element).cleanWhitespace(); - // SlideDown need to have the content of the element wrapped in a container element with fixed height! - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: window.opera ? 0 : 1, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } - }, arguments[1] || { }) - ); -}; - -Effect.SlideUp = function(element) { - element = $(element).cleanWhitespace(); - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, window.opera ? 0 : 1, - Object.extend({ scaleContent: false, - scaleX: false, - scaleMode: 'box', - scaleFrom: 100, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); - } - }, arguments[1] || { }) - ); -}; - -// Bug in opera makes the TD containing this element expand for a instance after finish -Effect.Squish = function(element) { - return new Effect.Scale(element, window.opera ? 1 : 0, { - restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }); -}; - -Effect.Grow = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.full - }, arguments[1] || { }); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var initialMoveX, initialMoveY; - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - initialMoveX = initialMoveY = moveX = moveY = 0; - break; - case 'top-right': - initialMoveX = dims.width; - initialMoveY = moveY = 0; - moveX = -dims.width; - break; - case 'bottom-left': - initialMoveX = moveX = 0; - initialMoveY = dims.height; - moveY = -dims.height; - break; - case 'bottom-right': - initialMoveX = dims.width; - initialMoveY = dims.height; - moveX = -dims.width; - moveY = -dims.height; - break; - case 'center': - initialMoveX = dims.width / 2; - initialMoveY = dims.height / 2; - moveX = -dims.width / 2; - moveY = -dims.height / 2; - break; - } - - return new Effect.Move(element, { - x: initialMoveX, - y: initialMoveY, - duration: 0.01, - beforeSetup: function(effect) { - effect.element.hide().makeClipping().makePositioned(); - }, - afterFinishInternal: function(effect) { - new Effect.Parallel( - [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), - new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), - new Effect.Scale(effect.element, 100, { - scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, - sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) - ], Object.extend({ - beforeSetup: function(effect) { - effect.effects[0].element.setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); - } - }, options) - ); - } - }); -}; - -Effect.Shrink = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.none - }, arguments[1] || { }); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - moveX = moveY = 0; - break; - case 'top-right': - moveX = dims.width; - moveY = 0; - break; - case 'bottom-left': - moveX = 0; - moveY = dims.height; - break; - case 'bottom-right': - moveX = dims.width; - moveY = dims.height; - break; - case 'center': - moveX = dims.width / 2; - moveY = dims.height / 2; - break; - } - - return new Effect.Parallel( - [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), - new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), - new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) - ], Object.extend({ - beforeStartInternal: function(effect) { - effect.effects[0].element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } - }, options) - ); -}; - -Effect.Pulsate = function(element) { - element = $(element); - var options = arguments[1] || { }, - oldOpacity = element.getInlineOpacity(), - transition = options.transition || Effect.Transitions.linear, - reverser = function(pos){ - return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5); - }; - - return new Effect.Opacity(element, - Object.extend(Object.extend({ duration: 2.0, from: 0, - afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } - }, options), {transition: reverser})); -}; - -Effect.Fold = function(element) { - element = $(element); - var oldStyle = { - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height }; - element.makeClipping(); - return new Effect.Scale(element, 5, Object.extend({ - scaleContent: false, - scaleX: false, - afterFinishInternal: function(effect) { - new Effect.Scale(element, 1, { - scaleContent: false, - scaleY: false, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().setStyle(oldStyle); - } }); - }}, arguments[1] || { })); -}; - -Effect.Morph = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - style: { } - }, arguments[1] || { }); - - if (!Object.isString(options.style)) this.style = $H(options.style); - else { - if (options.style.include(':')) - this.style = options.style.parseStyle(); - else { - this.element.addClassName(options.style); - this.style = $H(this.element.getStyles()); - this.element.removeClassName(options.style); - var css = this.element.getStyles(); - this.style = this.style.reject(function(style) { - return style.value == css[style.key]; - }); - options.afterFinishInternal = function(effect) { - effect.element.addClassName(effect.options.style); - effect.transforms.each(function(transform) { - effect.element.style[transform.style] = ''; - }); - }; - } - } - this.start(options); - }, - - setup: function(){ - function parseColor(color){ - if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; - color = color.parseColor(); - return $R(0,2).map(function(i){ - return parseInt( color.slice(i*2+1,i*2+3), 16 ); - }); - } - this.transforms = this.style.map(function(pair){ - var property = pair[0], value = pair[1], unit = null; - - if (value.parseColor('#zzzzzz') != '#zzzzzz') { - value = value.parseColor(); - unit = 'color'; - } else if (property == 'opacity') { - value = parseFloat(value); - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - } else if (Element.CSS_LENGTH.test(value)) { - var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); - value = parseFloat(components[1]); - unit = (components.length == 3) ? components[2] : null; - } - - var originalValue = this.element.getStyle(property); - return { - style: property.camelize(), - originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), - targetValue: unit=='color' ? parseColor(value) : value, - unit: unit - }; - }.bind(this)).reject(function(transform){ - return ( - (transform.originalValue == transform.targetValue) || - ( - transform.unit != 'color' && - (isNaN(transform.originalValue) || isNaN(transform.targetValue)) - ) - ); - }); - }, - update: function(position) { - var style = { }, transform, i = this.transforms.length; - while(i--) - style[(transform = this.transforms[i]).style] = - transform.unit=='color' ? '#'+ - (Math.round(transform.originalValue[0]+ - (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + - (Math.round(transform.originalValue[1]+ - (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + - (Math.round(transform.originalValue[2]+ - (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : - (transform.originalValue + - (transform.targetValue - transform.originalValue) * position).toFixed(3) + - (transform.unit === null ? '' : transform.unit); - this.element.setStyle(style, true); - } -}); - -Effect.Transform = Class.create({ - initialize: function(tracks){ - this.tracks = []; - this.options = arguments[1] || { }; - this.addTracks(tracks); - }, - addTracks: function(tracks){ - tracks.each(function(track){ - track = $H(track); - var data = track.values().first(); - this.tracks.push($H({ - ids: track.keys().first(), - effect: Effect.Morph, - options: { style: data } - })); - }.bind(this)); - return this; - }, - play: function(){ - return new Effect.Parallel( - this.tracks.map(function(track){ - var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); - var elements = [$(ids) || $$(ids)].flatten(); - return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); - }).flatten(), - this.options - ); - } -}); - -Element.CSS_PROPERTIES = $w( - 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + - 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + - 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + - 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + - 'fontSize fontWeight height left letterSpacing lineHeight ' + - 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ - 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + - 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + - 'right textIndent top width wordSpacing zIndex'); - -Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; - -String.__parseStyleElement = document.createElement('div'); -String.prototype.parseStyle = function(){ - var style, styleRules = $H(); - if (Prototype.Browser.WebKit) - style = new Element('div',{style:this}).style; - else { - String.__parseStyleElement.innerHTML = '
    '; - style = String.__parseStyleElement.childNodes[0].style; - } - - Element.CSS_PROPERTIES.each(function(property){ - if (style[property]) styleRules.set(property, style[property]); - }); - - if (Prototype.Browser.IE && this.include('opacity')) - styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); - - return styleRules; -}; - -if (document.defaultView && document.defaultView.getComputedStyle) { - Element.getStyles = function(element) { - var css = document.defaultView.getComputedStyle($(element), null); - return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { - styles[property] = css[property]; - return styles; - }); - }; -} else { - Element.getStyles = function(element) { - element = $(element); - var css = element.currentStyle, styles; - styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { - results[property] = css[property]; - return results; - }); - if (!styles.opacity) styles.opacity = element.getOpacity(); - return styles; - }; -} - -Effect.Methods = { - morph: function(element, style) { - element = $(element); - new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); - return element; - }, - visualEffect: function(element, effect, options) { - element = $(element); - var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); - new Effect[klass](element, options); - return element; - }, - highlight: function(element, options) { - element = $(element); - new Effect.Highlight(element, options); - return element; - } -}; - -$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ - 'pulsate shake puff squish switchOff dropOut').each( - function(effect) { - Effect.Methods[effect] = function(element, options){ - element = $(element); - Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); - return element; - }; - } -); - -$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( - function(f) { Effect.Methods[f] = Element[f]; } -); - -Element.addMethods(Effect.Methods); \ No newline at end of file diff --git a/oldstuff/map-mash/public/javascripts/jquery.js b/oldstuff/map-mash/public/javascripts/jquery.js deleted file mode 100644 index 8ccd0ea..0000000 --- a/oldstuff/map-mash/public/javascripts/jquery.js +++ /dev/null @@ -1,9266 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Nov 21 21:11:03 2011 -0500 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.1", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!memory; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - marginDiv, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
    a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = marginDiv = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - conMarginTop, ptlm, vb, style, html, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; - vb = "visibility:hidden;border:0;"; - style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; - html = "
    " + - "" + - "
    "; - - container = document.createElement("div"); - container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
    t
    "; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Figure out if the W3C box model works as expected - div.innerHTML = ""; - div.style.width = div.style.paddingLeft = "1px"; - jQuery.boxModel = support.boxModel = div.offsetWidth === 2; - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
    "; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.style.cssText = ptlm + vb; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - body.removeChild( container ); - div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, attr, name, - data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { - attr = this[0].attributes; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - jQuery._data( this[0], "parsedAttrs", true ); - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var self = jQuery( this ), - args = [ parts[0], value ]; - - self.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - - // See #9699 for explanation of this approach (setting first, then removal) - jQuery.attr( elem, name, "" ); - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /\bhover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Determine handlers that should run if there are delegated events - // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on.call( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

    "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
    "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /", "" ], - legend: [ 1, "
    ", "
    " ], - thead: [ 1, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - col: [ 2, "", "
    " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - diff --git a/oldstuff/mdn-breakout/script.js b/oldstuff/mdn-breakout/script.js deleted file mode 100644 index 1414a91..0000000 --- a/oldstuff/mdn-breakout/script.js +++ /dev/null @@ -1,220 +0,0 @@ -(function() { - var canvas = document.getElementById("myCanvas"), - ctx = canvas.getContext("2d"), - ballRadius = 10, - ballColor = '#0095DD', - paddleHeight = 7, - paddleWidth = 119, - paddleX = (canvas.width-paddleWidth)/2, - paddleSpeed = 7, - rightPressed = false, - leftPressed = false, - x = canvas.width/2, - y = canvas.height-randInt(10, 50), - dx = 2, - dy = -2, - score = 0, - scoreStep = 1, - lives = 3, - isPaused = false, - isOver = false, - brickRowCount = 3, - brickColumnCount = 5, - brickWidth = 75, - brickHeight = 20, - brickPadding = 10, - brickOffsetTop = 30, - brickOffsetLeft = 30, - bricks = []; - - (function() { - for(var c=0; c b.x && x < b.x+brickWidth && y > b.y && y < b.y+brickHeight) { - dy = -dy; - b.status = 0; - score += scoreStep; - // scoreStep++; - if(score >= (brickRowCount*brickColumnCount*scoreStep)) { - isOver = true; - pauseWithMessage("YOU WIN! FINAL SCORE "+score+"!"); - // document.location.reload(); - } - } - } - } - } - - function drawScore() { - ctx.font = "16px Arial"; - ctx.fillStyle = "#0095DD"; - ctx.fillText("Score: "+score, 8, 20); - } - - function drawLives() { - ctx.font = "16px Arial"; - ctx.fillStyle = "#0095DD"; - ctx.fillText("Lives: "+lives, canvas.width-65, 20); - } - - function draw() { - if(isPaused || isOver) { - return; - } - ctx.clearRect(0, 0, canvas.width, canvas.height); - drawBricks(); - drawBall(); - drawPaddle(); - drawScore(); - drawLives(); - collisionDetection(); - - if(x + dx > canvas.width-ballRadius || x + dx < ballRadius) { - dx = -dx; - ballColor = randColor(); - } - if(y + dy < ballRadius) { - dy = -dy; - ballColor = randColor(); - } - else if(y + dy > canvas.height-ballRadius) { - if(x > paddleX && x < paddleX + paddleWidth) { - dy = -dy; - dx *= 1.01; - dy *= 1.01; - } - else { - lives--; - if(!lives) { - isOver = true; - pauseWithMessage("GAME OVER"); - } - else { - x = canvas.width/2; - y = canvas.height-randInt(10, 50); - dx = 2; - dy = -2; - paddleX = (canvas.width-paddleWidth)/2; - } - } - } - - if(rightPressed && paddleX < canvas.width-paddleWidth) { - paddleX += paddleSpeed; - } - else if(leftPressed && paddleX > 0) { - paddleX -= paddleSpeed; - } - - x += dx; - y += dy; - requestAnimationFrame(draw); - } - - function pauseWithMessage(msg) { - isPaused = true; - ctx.font = "16px Arial"; - ctx.fillStyle = "#FF3333"; - ctx.fillText(msg, 150, 200); - } - - function keyDownHandler(e) { - if(e.keyCode == 39) { - rightPressed = true; - } - else if(e.keyCode == 37) { - leftPressed = true; - } - } - - function keyUpHandler(e) { - if(e.keyCode == 39) { - rightPressed = false; - } - else if(e.keyCode == 37) { - leftPressed = false; - } - else if(e.keyCode == 27 && !isOver) { - if(isPaused) { - isPaused = false; - } else { - pauseWithMessage("PAUSE (ESC)"); - } - } - } - - function mouseMoveHandler(e) { - var relativeX = e.clientX - canvas.offsetLeft; - if(relativeX > paddleWidth/2 && - relativeX < (canvas.width-(paddleWidth/2))) { - paddleX = relativeX - paddleWidth/2; - } - } - - document.addEventListener("keydown", keyDownHandler, false); - document.addEventListener("keyup", keyUpHandler, false); - document.addEventListener("mousemove", mouseMoveHandler, false); - draw(); -})(); diff --git a/oldstuff/mdn-breakout/style.css b/oldstuff/mdn-breakout/style.css deleted file mode 100644 index 312ee38..0000000 --- a/oldstuff/mdn-breakout/style.css +++ /dev/null @@ -1,14 +0,0 @@ -* { - padding: 0; - margin: 0; -} -canvas { - background: #eee; - display: block; - margin: 0 auto; -} -footer { - margin: 32px auto; - font-family: Arial, sans-serif; - font-size: 12px; -} diff --git a/oldstuff/mdn-css-layout/grids/0-starting-point.html b/oldstuff/mdn-css-layout/grids/0-starting-point.html deleted file mode 100644 index ddd3acc..0000000 --- a/oldstuff/mdn-css-layout/grids/0-starting-point.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - CSS Grid starting point - - - - -

    Simple grid example

    - -
    -
    One
    -
    Two
    -
    Three
    -
    Four
    -
    Five
    -
    Six
    -
    Seven
    -
    - - - diff --git a/oldstuff/memcached/ruby/plain.rb b/oldstuff/memcached/ruby/plain.rb deleted file mode 100644 index 8fa88b4..0000000 --- a/oldstuff/memcached/ruby/plain.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'socket' - -def main - @client = TCPSocket.new('localhost', 11211) - @client.puts ARGV.first - - while line = @client.gets - puts line - case line.chomp - when 'END' - break - when 'ERROR' - return 1 - end - end - - return 0 -ensure - @client.close if @client -end - -if $0 == __FILE__ - exit main -end diff --git a/oldstuff/mods/forge/.gitignore b/oldstuff/mods/forge/.gitignore deleted file mode 100644 index c6f4783..0000000 --- a/oldstuff/mods/forge/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -.metadata/ -CREDITS-fml.txt -LICENSE-fml.txt -MinecraftForge-Credits.txt -MinecraftForge-License.txt -README.txt -build.gradle -eclipse -forge-1.8-11.14.3.1498-changelog.txt -forge-1.8-11.14.3.1498-src.zip -gradle -gradlew -gradlew.bat -src -.gradle/ diff --git a/oldstuff/mods/forge/Makefile b/oldstuff/mods/forge/Makefile deleted file mode 100644 index 4038059..0000000 --- a/oldstuff/mods/forge/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -forge-1.8-11.14.3.1498-changelog.txt: forge-1.8-11.14.3.1498-src.zip - unzip $< - -forge-1.8-11.14.3.1498-src.zip: - curl -sSLO http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.8-11.14.3.1498/forge-1.8-11.14.3.1498-src.zip diff --git a/oldstuff/opsschool/Vagrantfile b/oldstuff/opsschool/Vagrantfile deleted file mode 100644 index 2b04c9e..0000000 --- a/oldstuff/opsschool/Vagrantfile +++ /dev/null @@ -1,70 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# All Vagrant configuration is done below. The "2" in Vagrant.configure -# configures the configuration version (we support older styles for -# backwards compatibility). Please don't change it unless you know what -# you're doing. -Vagrant.configure("2") do |config| - # The most common configuration options are documented and commented below. - # For a complete reference, please see the online documentation at - # https://docs.vagrantup.com. - - # Every Vagrant development environment requires a box. You can search for - # boxes at https://vagrantcloud.com/search. - config.vm.box = "ubuntu/xenial64" - - # Disable automatic box update checking. If you disable this, then - # boxes will only be checked for updates when the user runs - # `vagrant box outdated`. This is not recommended. - # config.vm.box_check_update = false - - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine. In the example below, - # accessing "localhost:8080" will access port 80 on the guest machine. - # NOTE: This will enable public access to the opened port - # config.vm.network "forwarded_port", guest: 80, host: 8080 - - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine and only allow access - # via 127.0.0.1 to disable public access - # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" - - # Create a private network, which allows host-only access to the machine - # using a specific IP. - # config.vm.network "private_network", ip: "192.168.33.10" - - # Create a public network, which generally matched to bridged network. - # Bridged networks make the machine appear as another physical device on - # your network. - # config.vm.network "public_network" - - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - # config.vm.synced_folder "../data", "/vagrant_data" - - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # - # config.vm.provider "virtualbox" do |vb| - # # Display the VirtualBox GUI when booting the machine - # vb.gui = true - # - # # Customize the amount of memory on the VM: - # vb.memory = "1024" - # end - # - # View the documentation for the provider you are using for more - # information on available options. - - # Enable provisioning with a shell script. Additional provisioners such as - # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the - # documentation for more information about their specific syntax and use. - # config.vm.provision "shell", inline: <<-SHELL - # apt-get update - # apt-get install -y apache2 - # SHELL -end diff --git a/oldstuff/opsschool/coffee.txt b/oldstuff/opsschool/coffee.txt deleted file mode 100644 index f604c1a..0000000 --- a/oldstuff/opsschool/coffee.txt +++ /dev/null @@ -1,4 +0,0 @@ -Mocha -Cappuccino -Espresso -Americano diff --git a/oldstuff/opsschool/helloworld.txt b/oldstuff/opsschool/helloworld.txt deleted file mode 100644 index 8ab686e..0000000 --- a/oldstuff/opsschool/helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, World! diff --git a/oldstuff/opsschool/ops.txt b/oldstuff/opsschool/ops.txt deleted file mode 100644 index 78f11b3..0000000 --- a/oldstuff/opsschool/ops.txt +++ /dev/null @@ -1,7 +0,0 @@ -OpsSchool -Ops School -opsschool -ops school -ops School -ops School -Ops school diff --git a/oldstuff/opsschool/orders.txt b/oldstuff/opsschool/orders.txt deleted file mode 100644 index 03acd10..0000000 --- a/oldstuff/opsschool/orders.txt +++ /dev/null @@ -1,4 +0,0 @@ -100 Mocha -25 Cappuccino -63 Espresso -1003 Americano diff --git a/oldstuff/opsschool/students.txt b/oldstuff/opsschool/students.txt deleted file mode 100644 index acadefe..0000000 --- a/oldstuff/opsschool/students.txt +++ /dev/null @@ -1,3 +0,0 @@ -John Doe 25 john@example.com -Jack Smith 26 jack@example.com -Jane Doe 24 jane@example.com diff --git a/oldstuff/opsschool/students2.txt b/oldstuff/opsschool/students2.txt deleted file mode 100644 index 8392ae2..0000000 --- a/oldstuff/opsschool/students2.txt +++ /dev/null @@ -1,3 +0,0 @@ -John Doe|25|john@example.com -Jack Smith|26|jack@example.com -Jane Doe|24|jane@example.com diff --git a/oldstuff/opsschool/students3.txt b/oldstuff/opsschool/students3.txt deleted file mode 100644 index 532d9e2..0000000 --- a/oldstuff/opsschool/students3.txt +++ /dev/null @@ -1,3 +0,0 @@ -John Doe 25 john@example.com -Jack Smith 26 jack@example.com -Jane Doe 24 jane@example.com diff --git a/oldstuff/opsschool/students4.txt b/oldstuff/opsschool/students4.txt deleted file mode 100644 index d2227ef..0000000 --- a/oldstuff/opsschool/students4.txt +++ /dev/null @@ -1,3 +0,0 @@ -John Doe - 25 - john@example.com -Jack Smith - 26 - jack@example.com -Jane Doe - 24 - jane@example.com diff --git a/oldstuff/opsschool/ubuntu.crontab b/oldstuff/opsschool/ubuntu.crontab deleted file mode 100644 index b7e04d8..0000000 --- a/oldstuff/opsschool/ubuntu.crontab +++ /dev/null @@ -1,3 +0,0 @@ -# vim:filetype=crontab -0 * * * * date -0-5 * * * * (date -u && df -h) >/var/tmp/disk_space.txt diff --git a/oldstuff/postgresql/.gitignore b/oldstuff/postgresql/.gitignore deleted file mode 100644 index f10862a..0000000 --- a/oldstuff/postgresql/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.env diff --git a/oldstuff/postgresql/installation/.gitignore b/oldstuff/postgresql/installation/.gitignore deleted file mode 100644 index bd9a169..0000000 --- a/oldstuff/postgresql/installation/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/bin/ -/data/ -/include/ -/lib/ -/postgresql-9.1.4.tar.bz2 -/postgresql-9.1.4/ -/share/ -/log/ diff --git a/oldstuff/postgresql/installation/Makefile b/oldstuff/postgresql/installation/Makefile deleted file mode 100644 index 5b27a86..0000000 --- a/oldstuff/postgresql/installation/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -HERE := $(PWD) -DOWNLOAD_ROOT := http://ftp.postgresql.org/pub/source/ -PG_PORT := 25432 -PG_VERSION := 9.1.4 -PYTHON3 := $(shell which python3) -TARBALL_BASENAME := postgresql-$(PG_VERSION) -TARBALL_URL := $(DOWNLOAD_ROOT)/v$(PG_VERSION)/$(TARBALL_BASENAME).tar.bz2 - -all: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log $(HERE)/data/postgresql.conf - -start: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log - $(HERE)/bin/pg_ctl start -D $(HERE)/data -l $(HERE)/log/postgres.log - -stop: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log - $(HERE)/bin/pg_ctl stop -D $(HERE)/data - -# pg_ctl restart isn't quite what I want... -restart: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log - $(MAKE) stop && $(MAKE) start - -$(TARBALL_BASENAME).tar.bz2: - curl -L -O $(TARBALL_URL) - -$(TARBALL_BASENAME)/configure: $(TARBALL_BASENAME).tar.bz2 - tar xjvf $< && touch $@ - -$(HERE)/bin/pg_ctl: $(TARBALL_BASENAME)/configure - cd $(TARBALL_BASENAME) && \ - PYTHON=$(PYTHON3) ./configure \ - --prefix=$(HERE) \ - --with-python \ - --with-perl \ - --with-tcl \ - --with-tclconfig=/usr/lib/tcl8.5 \ - --with-openssl \ - --with-libxml \ - --with-libxslt \ - --with-pgport=$(PG_PORT) && \ - make && \ - make install - -$(HERE)/data: - mkdir -p $@ - -$(HERE)/log: - mkdir -p $@ - -$(HERE)/data/postgresql.conf: $(HERE)/postgresql.conf $(HERE)/data - cp -v $< $@ diff --git a/oldstuff/postgresql/installation/postgresql.conf b/oldstuff/postgresql/installation/postgresql.conf deleted file mode 100644 index a5f18fd..0000000 --- a/oldstuff/postgresql/installation/postgresql.conf +++ /dev/null @@ -1,556 +0,0 @@ -# ----------------------------- -# PostgreSQL configuration file -# ----------------------------- -# -# This file consists of lines of the form: -# -# name = value -# -# (The "=" is optional.) Whitespace may be used. Comments are introduced with -# "#" anywhere on a line. The complete list of parameter names and allowed -# values can be found in the PostgreSQL documentation. -# -# The commented-out settings shown in this file represent the default values. -# Re-commenting a setting is NOT sufficient to revert it to the default value; -# you need to reload the server. -# -# This file is read on server startup and when the server receives a SIGHUP -# signal. If you edit the file on a running system, you have to SIGHUP the -# server for the changes to take effect, or use "pg_ctl reload". Some -# parameters, which are marked below, require a server shutdown and restart to -# take effect. -# -# Any parameter can also be given as a command-line option to the server, e.g., -# "postgres -c log_connections=on". Some parameters can be changed at run time -# with the "SET" SQL command. -# -# Memory units: kB = kilobytes Time units: ms = milliseconds -# MB = megabytes s = seconds -# GB = gigabytes min = minutes -# h = hours -# d = days - - -#------------------------------------------------------------------------------ -# FILE LOCATIONS -#------------------------------------------------------------------------------ - -# The default values of these variables are driven from the -D command-line -# option or PGDATA environment variable, represented here as ConfigDir. - -#data_directory = 'ConfigDir' # use data in another directory - # (change requires restart) -#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file - # (change requires restart) -#ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file - # (change requires restart) - -# If external_pid_file is not explicitly set, no extra PID file is written. -#external_pid_file = '(none)' # write an extra PID file - # (change requires restart) - - -#------------------------------------------------------------------------------ -# CONNECTIONS AND AUTHENTICATION -#------------------------------------------------------------------------------ - -# - Connection Settings - - -#listen_addresses = 'localhost' # what IP address(es) to listen on; - # comma-separated list of addresses; - # defaults to 'localhost', '*' = all - # (change requires restart) -port = 25432 # (change requires restart) -max_connections = 100 # (change requires restart) -# Note: Increasing max_connections costs ~400 bytes of shared memory per -# connection slot, plus lock space (see max_locks_per_transaction). -#superuser_reserved_connections = 3 # (change requires restart) -#unix_socket_directory = '' # (change requires restart) -#unix_socket_group = '' # (change requires restart) -#unix_socket_permissions = 0777 # begin with 0 to use octal notation - # (change requires restart) -#bonjour = off # advertise server via Bonjour - # (change requires restart) -#bonjour_name = '' # defaults to the computer name - # (change requires restart) - -# - Security and Authentication - - -#authentication_timeout = 1min # 1s-600s -#ssl = off # (change requires restart) -#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers - # (change requires restart) -#ssl_renegotiation_limit = 512MB # amount of data between renegotiations -#password_encryption = on -#db_user_namespace = off - -# Kerberos and GSSAPI -#krb_server_keyfile = '' -#krb_srvname = 'postgres' # (Kerberos only) -#krb_caseins_users = off - -# - TCP Keepalives - -# see "man 7 tcp" for details - -#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; - # 0 selects the system default -#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; - # 0 selects the system default -#tcp_keepalives_count = 0 # TCP_KEEPCNT; - # 0 selects the system default - - -#------------------------------------------------------------------------------ -# RESOURCE USAGE (except WAL) -#------------------------------------------------------------------------------ - -# - Memory - - -shared_buffers = 24MB # min 128kB - # (change requires restart) -#temp_buffers = 8MB # min 800kB -#max_prepared_transactions = 0 # zero disables the feature - # (change requires restart) -# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory -# per transaction slot, plus lock space (see max_locks_per_transaction). -# It is not advisable to set max_prepared_transactions nonzero unless you -# actively intend to use prepared transactions. -#work_mem = 1MB # min 64kB -#maintenance_work_mem = 16MB # min 1MB -#max_stack_depth = 2MB # min 100kB - -# - Kernel Resource Usage - - -#max_files_per_process = 1000 # min 25 - # (change requires restart) -#shared_preload_libraries = '' # (change requires restart) - -# - Cost-Based Vacuum Delay - - -#vacuum_cost_delay = 0ms # 0-100 milliseconds -#vacuum_cost_page_hit = 1 # 0-10000 credits -#vacuum_cost_page_miss = 10 # 0-10000 credits -#vacuum_cost_page_dirty = 20 # 0-10000 credits -#vacuum_cost_limit = 200 # 1-10000 credits - -# - Background Writer - - -#bgwriter_delay = 200ms # 10-10000ms between rounds -#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round -#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round - -# - Asynchronous Behavior - - -#effective_io_concurrency = 1 # 1-1000. 0 disables prefetching - - -#------------------------------------------------------------------------------ -# WRITE AHEAD LOG -#------------------------------------------------------------------------------ - -# - Settings - - -wal_level = hot_standby # minimal, archive, or hot_standby - # (change requires restart) -#fsync = on # turns forced synchronization on or off -#synchronous_commit = on # synchronization level; on, off, or local -#wal_sync_method = fsync # the default is the first option - # supported by the operating system: - # open_datasync - # fdatasync (default on Linux) - # fsync - # fsync_writethrough - # open_sync -#full_page_writes = on # recover from partial page writes -#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers - # (change requires restart) -#wal_writer_delay = 200ms # 1-10000 milliseconds - -#commit_delay = 0 # range 0-100000, in microseconds -#commit_siblings = 5 # range 1-1000 - -# - Checkpoints - - -#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each -#checkpoint_timeout = 5min # range 30s-1h -#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 -#checkpoint_warning = 30s # 0 disables - -# - Archiving - - -#archive_mode = off # allows archiving to be done - # (change requires restart) -#archive_command = '' # command to use to archive a logfile segment -#archive_timeout = 0 # force a logfile segment switch after this - # number of seconds; 0 disables - - -#------------------------------------------------------------------------------ -# REPLICATION -#------------------------------------------------------------------------------ - -# - Master Server - - -# These settings are ignored on a standby server - -#max_wal_senders = 0 # max number of walsender processes - # (change requires restart) -#wal_sender_delay = 1s # walsender cycle time, 1-10000 milliseconds -#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables -#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed -#replication_timeout = 60s # in milliseconds; 0 disables -#synchronous_standby_names = '' # standby servers that provide sync rep - # comma-separated list of application_name - # from standby(s); '*' = all - -# - Standby Servers - - -# These settings are ignored on a master server - -#hot_standby = off # "on" allows queries during recovery - # (change requires restart) -#max_standby_archive_delay = 30s # max delay before canceling queries - # when reading WAL from archive; - # -1 allows indefinite delay -#max_standby_streaming_delay = 30s # max delay before canceling queries - # when reading streaming WAL; - # -1 allows indefinite delay -#wal_receiver_status_interval = 10s # send replies at least this often - # 0 disables -#hot_standby_feedback = off # send info from standby to prevent - # query conflicts - - -#------------------------------------------------------------------------------ -# QUERY TUNING -#------------------------------------------------------------------------------ - -# - Planner Method Configuration - - -#enable_bitmapscan = on -#enable_hashagg = on -#enable_hashjoin = on -#enable_indexscan = on -#enable_material = on -#enable_mergejoin = on -#enable_nestloop = on -#enable_seqscan = on -#enable_sort = on -#enable_tidscan = on - -# - Planner Cost Constants - - -#seq_page_cost = 1.0 # measured on an arbitrary scale -#random_page_cost = 4.0 # same scale as above -#cpu_tuple_cost = 0.01 # same scale as above -#cpu_index_tuple_cost = 0.005 # same scale as above -#cpu_operator_cost = 0.0025 # same scale as above -#effective_cache_size = 128MB - -# - Genetic Query Optimizer - - -#geqo = on -#geqo_threshold = 12 -#geqo_effort = 5 # range 1-10 -#geqo_pool_size = 0 # selects default based on effort -#geqo_generations = 0 # selects default based on effort -#geqo_selection_bias = 2.0 # range 1.5-2.0 -#geqo_seed = 0.0 # range 0.0-1.0 - -# - Other Planner Options - - -#default_statistics_target = 100 # range 1-10000 -#constraint_exclusion = partition # on, off, or partition -#cursor_tuple_fraction = 0.1 # range 0.0-1.0 -#from_collapse_limit = 8 -#join_collapse_limit = 8 # 1 disables collapsing of explicit - # JOIN clauses - - -#------------------------------------------------------------------------------ -# ERROR REPORTING AND LOGGING -#------------------------------------------------------------------------------ - -# - Where to Log - - -#log_destination = 'stderr' # Valid values are combinations of - # stderr, csvlog, syslog, and eventlog, - # depending on platform. csvlog - # requires logging_collector to be on. - -# This is used when logging to stderr: -#logging_collector = off # Enable capturing of stderr and csvlog - # into log files. Required to be on for - # csvlogs. - # (change requires restart) - -# These are only used if logging_collector is on: -#log_directory = 'pg_log' # directory where log files are written, - # can be absolute or relative to PGDATA -#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, - # can include strftime() escapes -#log_file_mode = 0600 # creation mode for log files, - # begin with 0 to use octal notation -#log_truncate_on_rotation = off # If on, an existing log file with the - # same name as the new log file will be - # truncated rather than appended to. - # But such truncation only occurs on - # time-driven rotation, not on restarts - # or size-driven rotation. Default is - # off, meaning append to existing files - # in all cases. -#log_rotation_age = 1d # Automatic rotation of logfiles will - # happen after that time. 0 disables. -#log_rotation_size = 10MB # Automatic rotation of logfiles will - # happen after that much log output. - # 0 disables. - -# These are relevant when logging to syslog: -#syslog_facility = 'LOCAL0' -#syslog_ident = 'postgres' - -#silent_mode = off # Run server silently. - # DO NOT USE without syslog or - # logging_collector - # (change requires restart) - - -# - When to Log - - -client_min_messages = warning # values in order of decreasing detail: - # debug5 - # debug4 - # debug3 - # debug2 - # debug1 - # log - # notice - # warning - # error - -log_min_messages = debug1 # values in order of decreasing detail: - # debug5 - # debug4 - # debug3 - # debug2 - # debug1 - # info - # notice - # warning - # error - # log - # fatal - # panic - -log_min_error_statement = debug1 # values in order of decreasing detail: - # debug5 - # debug4 - # debug3 - # debug2 - # debug1 - # info - # notice - # warning - # error - # log - # fatal - # panic (effectively off) - -log_min_duration_statement = 0 # -1 is disabled, 0 logs all statements - # and their durations, > 0 logs only - # statements running at least this number - # of milliseconds - - -# - What to Log - - -debug_print_parse = off -debug_print_rewritten = off -debug_print_plan = off -debug_pretty_print = off -log_checkpoints = on -log_connections = on -log_disconnections = on -log_duration = on -log_error_verbosity = verbose # terse, default, or verbose messages -log_hostname = on -#log_line_prefix = '' # special values: - # %a = application name - # %u = user name - # %d = database name - # %r = remote host and port - # %h = remote host - # %p = process ID - # %t = timestamp without milliseconds - # %m = timestamp with milliseconds - # %i = command tag - # %e = SQL state - # %c = session ID - # %l = session line number - # %s = session start timestamp - # %v = virtual transaction ID - # %x = transaction ID (0 if none) - # %q = stop here in non-session - # processes - # %% = '%' - # e.g. '<%u%%%d> ' -#log_lock_waits = off # log lock waits >= deadlock_timeout -log_statement = all # none, ddl, mod, all -#log_temp_files = -1 # log temporary files equal or larger - # than the specified size in kilobytes; - # -1 disables, 0 logs all temp files -#log_timezone = '(defaults to server environment setting)' - - -#------------------------------------------------------------------------------ -# RUNTIME STATISTICS -#------------------------------------------------------------------------------ - -# - Query/Index Statistics Collector - - -track_activities = on -track_counts = on -track_functions = all # none, pl, all -#track_activity_query_size = 1024 # (change requires restart) -#update_process_title = on -#stats_temp_directory = 'pg_stat_tmp' - - -# - Statistics Monitoring - - -log_parser_stats = off -log_planner_stats = off -log_executor_stats = off -log_statement_stats = on - - -#------------------------------------------------------------------------------ -# AUTOVACUUM PARAMETERS -#------------------------------------------------------------------------------ - -autovacuum = on # Enable autovacuum subprocess? 'on' - # requires track_counts to also be on. -#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and - # their durations, > 0 logs only - # actions running at least this number - # of milliseconds. -#autovacuum_max_workers = 3 # max number of autovacuum subprocesses - # (change requires restart) -#autovacuum_naptime = 1min # time between autovacuum runs -#autovacuum_vacuum_threshold = 50 # min number of row updates before - # vacuum -#autovacuum_analyze_threshold = 50 # min number of row updates before - # analyze -#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum -#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze -#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum - # (change requires restart) -#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for - # autovacuum, in milliseconds; - # -1 means use vacuum_cost_delay -#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for - # autovacuum, -1 means use - # vacuum_cost_limit - - -#------------------------------------------------------------------------------ -# CLIENT CONNECTION DEFAULTS -#------------------------------------------------------------------------------ - -# - Statement Behavior - - -#search_path = '"$user",public' # schema names -#default_tablespace = '' # a tablespace name, '' uses the default -#temp_tablespaces = '' # a list of tablespace names, '' uses - # only default tablespace -#check_function_bodies = on -#default_transaction_isolation = 'read committed' -#default_transaction_read_only = off -#default_transaction_deferrable = off -#session_replication_role = 'origin' -#statement_timeout = 0 # in milliseconds, 0 is disabled -#vacuum_freeze_min_age = 50000000 -#vacuum_freeze_table_age = 150000000 -#bytea_output = 'hex' # hex, escape -#xmlbinary = 'base64' -#xmloption = 'content' - -# - Locale and Formatting - - -datestyle = 'iso, mdy' -#intervalstyle = 'postgres' -#timezone = '(defaults to server environment setting)' -#timezone_abbreviations = 'Default' # Select the set of available time zone - # abbreviations. Currently, there are - # Default - # Australia - # India - # You can create your own file in - # share/timezonesets/. -#extra_float_digits = 0 # min -15, max 3 -#client_encoding = sql_ascii # actually, defaults to database - # encoding - -# These settings are initialized by initdb, but they can be changed. -lc_messages = 'en_US.UTF-8' # locale for system error message - # strings -lc_monetary = 'en_US.UTF-8' # locale for monetary formatting -lc_numeric = 'en_US.UTF-8' # locale for number formatting -lc_time = 'en_US.UTF-8' # locale for time formatting - -# default configuration for text search -default_text_search_config = 'pg_catalog.english' - -# - Other Defaults - - -#dynamic_library_path = '$libdir' -#local_preload_libraries = '' - - -#------------------------------------------------------------------------------ -# LOCK MANAGEMENT -#------------------------------------------------------------------------------ - -#deadlock_timeout = 1s -#max_locks_per_transaction = 64 # min 10 - # (change requires restart) -# Note: Each lock table slot uses ~270 bytes of shared memory, and there are -# max_locks_per_transaction * (max_connections + max_prepared_transactions) -# lock table slots. -#max_pred_locks_per_transaction = 64 # min 10 - # (change requires restart) - -#------------------------------------------------------------------------------ -# VERSION/PLATFORM COMPATIBILITY -#------------------------------------------------------------------------------ - -# - Previous PostgreSQL Versions - - -#array_nulls = on -#backslash_quote = safe_encoding # on, off, or safe_encoding -#default_with_oids = off -#escape_string_warning = on -#lo_compat_privileges = off -#quote_all_identifiers = off -#sql_inheritance = on -#standard_conforming_strings = on -#synchronize_seqscans = on - -# - Other Platforms and Clients - - -#transform_null_equals = off - - -#------------------------------------------------------------------------------ -# ERROR HANDLING -#------------------------------------------------------------------------------ - -#exit_on_error = off # terminate session on any error? -#restart_after_crash = on # reinitialize after backend crash? - - -#------------------------------------------------------------------------------ -# CUSTOMIZED OPTIONS -#------------------------------------------------------------------------------ - -#custom_variable_classes = '' # list of custom variable class names diff --git a/oldstuff/postgresql/tutorial/weather/Gemfile b/oldstuff/postgresql/tutorial/weather/Gemfile deleted file mode 100644 index 0b1bb15..0000000 --- a/oldstuff/postgresql/tutorial/weather/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source :rubygems - -gem 'archive-tar-minitar' -gem 'progressbar' -gem 'typhoeus' diff --git a/oldstuff/postgresql/tutorial/weather/Gemfile.lock b/oldstuff/postgresql/tutorial/weather/Gemfile.lock deleted file mode 100644 index deb5ea3..0000000 --- a/oldstuff/postgresql/tutorial/weather/Gemfile.lock +++ /dev/null @@ -1,18 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - archive-tar-minitar (0.5.2) - ffi (1.1.0) - mime-types (1.19) - progressbar (0.9.0) - typhoeus (0.4.2) - ffi (~> 1.0) - mime-types (~> 1.18) - -PLATFORMS - ruby - -DEPENDENCIES - archive-tar-minitar - progressbar - typhoeus diff --git a/oldstuff/postgresql/tutorial/weather/data/.gitkeep b/oldstuff/postgresql/tutorial/weather/data/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/postgresql/tutorial/weather/import-data b/oldstuff/postgresql/tutorial/weather/import-data deleted file mode 100755 index a1db080..0000000 --- a/oldstuff/postgresql/tutorial/weather/import-data +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - -require 'bundler/setup' -require 'archive/tar/minitar' -require 'progressbar' -require 'typhoeus' - -FTP_BASE = 'ftp://ftp.ncdc.noaa.gov/pub/data/gsod' -YEARS = %w(1950 1960 1970 1980 1990 2000 2010) - -def main - include Archive::Tar - dest_dir = File.expand_path('../data', __FILE__) - Dir.chdir(dest_dir) - - download_here_maybe?("#{FTP_BASE}/ish-history.csv") - - YEARS.each do |year| - tarname = "gsod_#{year}.tar" - url = "#{FTP_BASE}/#{year}/#{tarname}" - dest = "#{dest_dir}/#{tarname}" - download_here_maybe?(url) - to_unpack = Minitar.open(dest, 'r').collect(&:full_name).select do |f| - f =~ /\.gz$/ && !File.exist?(f) - end - if !to_unpack.empty? - @progress = ProgressBar.new(File.basename(dest), to_unpack.length) - Minitar.unpack(dest, dest_dir, to_unpack) do |action,name,stats| - if action == :file_done - @progress.inc(1) - end - end - puts - end - end -end - -def download_here_maybe?(url) - outfile = File.basename(url) - if !File.exist?(outfile) - File.open(outfile, 'w') do |f| - puts "Writing #{url} to #{outfile}" - f.write(Typhoeus::Request.get(url).body) - end - end -end - -if $0 == __FILE__ - main -end diff --git a/oldstuff/postgresql/tutorial/weather/init.sql b/oldstuff/postgresql/tutorial/weather/init.sql deleted file mode 100644 index 4d8c2d1..0000000 --- a/oldstuff/postgresql/tutorial/weather/init.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE weather ( - city varchar(80), - temp_lo int, - temp_hi int, - prcp real, - date date -); - -CREATE TABLE cities ( - name varchar(80), - location point -); diff --git a/oldstuff/postgresql/tutorial/weather/wipe.sql b/oldstuff/postgresql/tutorial/weather/wipe.sql deleted file mode 100644 index 8ec9fcb..0000000 --- a/oldstuff/postgresql/tutorial/weather/wipe.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP TABLE IF EXISTS weather; -DROP TABLE IF EXISTS cities; diff --git a/oldstuff/practicing-processing/.gitignore b/oldstuff/practicing-processing/.gitignore deleted file mode 100644 index 3df404d..0000000 --- a/oldstuff/practicing-processing/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.class -lib/* -lib/preferences.txt diff --git a/oldstuff/practicing-processing/bin/processing-commander b/oldstuff/practicing-processing/bin/processing-commander deleted file mode 100755 index 89b50d8..0000000 --- a/oldstuff/practicing-processing/bin/processing-commander +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -e - -TOP="$(dirname $(dirname $(readlink -f -- "$0")))" -$TOP/bin/prochome-check >/dev/null - -if [ ! -f "$TOP/lib/preferences.txt" ]; then - cp "$TOP/lib/preferences.txt.stub" "$TOP/lib/preferences.txt" -fi - -CP="$CLASSPATH" -CP="$TOP/lib/mbh-processing-practice.jar:$CP" -for procjar in "lib/core" "lib/pde" "java/lib/tools" "java/lib/rt" -do - CP="$PROCESSING_HOME/$procjar.jar:$CP" -done - -test -n "$DEBUG" && echo "DEBUG:CP=$CP" - -java -cp "$CP" com.meatballhat.processing.ProcessingRunner "$@" diff --git a/oldstuff/practicing-processing/bin/prochome-check b/oldstuff/practicing-processing/bin/prochome-check deleted file mode 100755 index bb39dc2..0000000 --- a/oldstuff/practicing-processing/bin/prochome-check +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -if [ -z "$PROCESSING_HOME" ]; then - cat >&2 < - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/oldstuff/practicing-processing/build/.gitkeep b/oldstuff/practicing-processing/build/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/practicing-processing/lib/preferences.txt.stub b/oldstuff/practicing-processing/lib/preferences.txt.stub deleted file mode 100644 index 4522bc5..0000000 --- a/oldstuff/practicing-processing/lib/preferences.txt.stub +++ /dev/null @@ -1,67 +0,0 @@ -console.auto_clear=true -console.font.macosx=Monaco,plain,10 -console.font=Monospaced,plain,11 -console.length=500 -console.lines=4 -contribution.backup.on_install=true -contribution.backup.on_remove=true -editor.antialias.linux=true -editor.antialias=true -editor.divider.size=0 -editor.divider.size.windows=2 -editor.external=false -editor.font.macosx=Monaco,plain,10 -editor.font=Monospaced,plain,12 -editor.indent=true -editor.keys.alternative_cut_copy_paste.macosx=false -editor.keys.alternative_cut_copy_paste=true -editor.keys.home_and_end_travel_far=false -editor.keys.home_and_end_travel_far.macosx=true -editor.keys.home_and_end_travel_smart=true -editor.keys.shift_backspace_is_delete=true -editor.tabs.expand=true -editor.tabs.size=2 -editor.untitled.prefix=sketch_ -editor.window.height.default=600 -editor.window.height.min=500 -editor.window.height.min.macosx=450 -editor.window.height.min.windows=530 -editor.window.width.default=500 -editor.window.width.min=400 -export.applet.separate_jar_files=false -export.application.fullscreen=false -export.application.platform.linux=true -export.application.platform.macosx=true -export.application.platform=true -export.application.platform.windows=true -export.application.stop=true -export.delete_target_folder=true -instance_server.key=0.3877576097235004 -instance_server.port=38596 -last.sketch.count=0 -last.sketch.restore=true -launcher=xdg-open -platform.auto_file_type_associations=true -preproc.color_datatype=true -preproc.enhanced_casting=true -preproc.imports.list=java.applet.*,java.awt.Dimension,java.awt.Frame,java.awt.event.MouseEvent,java.awt.event.KeyEvent,java.awt.event.FocusEvent,java.awt.Image,java.io.*,java.net.*,java.text.*,java.util.*,java.util.zip.*,java.util.regex.* -preproc.output_parse_tree=false -preproc.save_build_files=false -preproc.substitute_floats=true -preproc.substitute_unicode=true -preproc.web_colors=true -run.display=1 -run.options= -run.options.bits.macosx=32 -run.options.memory=false -run.options.memory.initial=64 -run.options.memory.maximum=256 -run.present.bgcolor=#666666 -run.present.exclusive=false -run.present.exclusive.macosx=true -run.present.stop.color=#cccccc -run.window.bgcolor=#DFDFDF -sketchbook.path=/home/me/repos/practicing-processing.git/sketchbook -update.check=true -update.id=-5920873896785929326 -update.last=1325434363680 diff --git a/oldstuff/practicing-processing/sketchbook/WaveGradient/WaveGradient.pde b/oldstuff/practicing-processing/sketchbook/WaveGradient/WaveGradient.pde deleted file mode 100644 index 67b728a..0000000 --- a/oldstuff/practicing-processing/sketchbook/WaveGradient/WaveGradient.pde +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Wave Gradient - * by Ira Greenberg. - * - * Generate a gradient along a sin() wave. - */ - -float angle = 0; -float px = 0, py = 0; -float amplitude = 30; -float frequency = 0; -float fillGap = 2.5; -color c; - -int colorRange = 255; -int ncycles = 500; - -void setup() { - size(640, 360); - background(200); - noLoop(); -} - -void draw() { - for (int i =- ncycles; i < height+ncycles; i++){ - // Reset angle to 0, so waves stack properly - angle = 0; - // Increasing frequency causes more gaps - frequency+=.01; - for (float j = 0; j < width+ncycles; j++){ - py = i + sin(radians(angle)) * amplitude; - angle += frequency; - c = color(abs(py-i)*colorRange/amplitude, colorRange-abs(py-i)*colorRange/amplitude, j*((colorRange * 1.0)/(width+(int)(ncycles * 0.66)))); - // Hack to fill gaps. Raise value of fillGap if you increase frequency - for (int filler = 0; filler < fillGap; filler++){ - set(int(j-filler), int(py)-filler, c); - set(int(j), int(py), c); - set(int(j+filler), int(py)+filler, c); - } - } - } -} diff --git a/oldstuff/practicing-processing/sketchbook/libraries/.gitkeep b/oldstuff/practicing-processing/sketchbook/libraries/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/practicing-processing/sketchbook/modes/.gitkeep b/oldstuff/practicing-processing/sketchbook/modes/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/practicing-processing/sketchbook/tools/.gitkeep b/oldstuff/practicing-processing/sketchbook/tools/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/practicing-processing/src/com/meatballhat/processing/ProcessingRunner.java b/oldstuff/practicing-processing/src/com/meatballhat/processing/ProcessingRunner.java deleted file mode 100644 index 981afc9..0000000 --- a/oldstuff/practicing-processing/src/com/meatballhat/processing/ProcessingRunner.java +++ /dev/null @@ -1,272 +0,0 @@ -package com.meatballhat.processing; - - -import java.io.File; -import java.io.IOException; -import java.io.PrintStream; - -import processing.app.Base; -import processing.app.Preferences; -import processing.app.SketchException; -import processing.app.RunnerListener; -import processing.app.Sketch; -import processing.core.PApplet; -import processing.mode.java.runner.*; - - -public class ProcessingRunner implements processing.app.RunnerListener { - static final String helpArg = "--help"; - static final String preprocArg = "--preprocess"; - static final String buildArg = "--build"; - static final String runArg = "--run"; - static final String presentArg = "--present"; - static final String sketchArg = "--sketch="; - static final String outputArg = "--output="; - static final String exportAppletArg = "--export-applet"; - static final String exportApplicationArg = "--export-application"; - static final String platformArg = "--platform="; - static final String bitsArg = "--bits="; - static final String preferencesArg = "--preferences="; - - static final int HELP = -1; - static final int PREPROCESS = 0; - static final int BUILD = 1; - static final int RUN = 2; - static final int PRESENT = 3; - static final int EXPORT_APPLET = 4; - static final int EXPORT_APPLICATION = 5; - - Sketch sketch; - - static public void main(String[] args) { - // Do this early so that error messages go to the console - Base.setCommandLine(); - // init the platform so that prefs and other native code is ready to go - Base.initPlatform(); - // make sure a full JDK is installed - Base.initRequirements(); - // run static initialization that grabs all the prefs - //Preferences.init(null); - // launch command line handler - new ProcessingRunner(args); - } - - public ProcessingRunner(String[] args) { - String sketchFolder = null; - String pdePath = null; // path to the .pde file - String outputPath = null; - String preferencesPath = null; - int platformIndex = PApplet.platform; // default to this platform - int platformBits = 0; - int mode = HELP; - - for (String arg : args) { - if (arg.length() == 0) { - // ignore it, just the crappy shell script - - } else if (arg.equals(helpArg)) { - // mode already set to HELP - - } else if (arg.equals(buildArg)) { - mode = BUILD; - - } else if (arg.equals(runArg)) { - mode = RUN; - - } else if (arg.equals(presentArg)) { - mode = PRESENT; - - } else if (arg.equals(preprocArg)) { - mode = PREPROCESS; - - } else if (arg.equals(exportAppletArg)) { - mode = EXPORT_APPLET; - - } else if (arg.equals(exportApplicationArg)) { - mode = EXPORT_APPLICATION; - - } else if (arg.startsWith(platformArg)) { - String platformStr = arg.substring(platformArg.length()); - platformIndex = Base.getPlatformIndex(platformStr); - if (platformIndex == -1) { - complainAndQuit(platformStr + " should instead be " + - "'windows', 'macosx', or 'linux'."); - } - } else if (arg.startsWith(sketchArg)) { - sketchFolder = arg.substring(sketchArg.length()); - File sketchy = new File(sketchFolder); - File pdeFile = new File(sketchy, sketchy.getName() + ".pde"); - pdePath = pdeFile.getAbsolutePath(); - - } else if (arg.startsWith(preferencesArg)) { - preferencesPath = arg.substring(preferencesArg.length()); - - } else if (arg.startsWith(outputArg)) { - outputPath = arg.substring(outputArg.length()); - - } else { - complainAndQuit("I don't know anything about " + arg + "."); - } - } - - if ((outputPath == null) && - (mode == PREPROCESS || mode == BUILD || - mode == RUN || mode == PRESENT)) { - complainAndQuit("An output path must be specified when using " + - preprocArg + ", " + buildArg + ", " + - runArg + ", or " + presentArg + "."); - } - - if (mode == HELP) { - printCommandLine(System.out); - System.exit(0); - } - - // --present --platform=windows "--sketch=/Applications/Processing 0148/examples/Basics/Arrays/Array" --output=test-build - - File outputFolder = new File(outputPath); - if (!outputFolder.exists()) { - if (!outputFolder.mkdirs()) { - complainAndQuit("Could not create the output folder."); - } - } - - // run static initialization that grabs all the prefs - // (also pass in a prefs path if that was specified) - Preferences.init(preferencesPath); - - if (sketchFolder == null) { - complainAndQuit("No sketch path specified."); - - } else if (outputPath.equals(pdePath)) { - complainAndQuit("The sketch path and output path cannot be identical."); - - } else if (!pdePath.toLowerCase().endsWith(".pde")) { - complainAndQuit("Sketch path must point to the main .pde file."); - - } else { - //Sketch sketch = null; - boolean success = false; - - try { - sketch = new Sketch(null, pdePath); - if (mode == PREPROCESS) { - success = true; // FIXME sketch.preprocess(new File(outputPath)) != null; - - } else if (mode == BUILD) { - success = true; // FIXME sketch.build(outputPath) != null; - - } else if (mode == RUN || mode == PRESENT) { - String className = "BUSTED"; // FIXME sketch.build(outputPath); - if (className != null) { - success = true; - Runner runner = new Runner(null, null); // FIXME new Runner(this, sketch); - runner.launch(true); // FIXME runner.launch(className, mode == PRESENT); - - } else { - success = false; - } - - } else if (mode == EXPORT_APPLET) { - if (outputPath != null) { - success = true; // FIXME sketch.exportApplet(outputPath); - } else { - String target = sketchFolder + File.separatorChar + "applet"; - success = true; // FIXME sketch.exportApplet(target); - } - } else if (mode == EXPORT_APPLICATION) { - if (outputPath != null) { - success = true; // FIXME sketch.exportApplication(outputPath, platformIndex, platformBits); - } else { - //String sketchFolder = - // pdePath.substring(0, pdePath.lastIndexOf(File.separatorChar)); - outputPath = - sketchFolder + File.separatorChar + - "application." + Base.getPlatformName(platformIndex); - success = true; // FIXME sketch.exportApplication(outputPath, platformIndex, platformBits); - } - } - System.exit(success ? 0 : 1); - - } catch (SketchException re) { - statusError(re); - - } catch (IOException e) { - e.printStackTrace(); - System.exit(1); - } - } - } - - public void statusNotice(String message) { - System.err.println(message); - } - - public void statusError(String message) { - System.err.println(message); - } - - public void statusError(Exception exception) { - if (exception instanceof SketchException) { - SketchException re = (SketchException) exception; - - // format the runner exception like emacs - //blah.java:2:10:2:13: Syntax Error: This is a big error message - String filename = sketch.getCode(re.getCodeIndex()).getFileName(); - int line = re.getCodeLine(); - int column = re.getCodeColumn(); - if (column == -1) column = 0; - // TODO if column not specified, should just select the whole line. - System.err.println(filename + ":" + - line + ":" + column + ":" + - line + ":" + column + ":" + " " + re.getMessage()); - } else { - exception.printStackTrace(); - } - } - - static void complainAndQuit(String lastWords) { - printCommandLine(System.err); - System.err.println(lastWords); - System.exit(1); - } - - static void printCommandLine(PrintStream out) { - out.println("Processing " + Base.VERSION_NAME + " rocks the console."); - out.println(); - out.println("--help Show this help text."); - out.println(); - out.println("--sketch= Specify the sketch folder (required)"); - out.println("--output= Specify the output folder (required and"); - out.println(" cannot be the same as the sketch folder.)"); - out.println(); - out.println("--preprocess Preprocess a sketch into .java files."); - out.println("--build Preprocess and compile a sketch into .class files."); - out.println("--run Preprocess, compile, and run a sketch."); - out.println("--present Preprocess, compile, and run a sketch full screen."); - out.println(); - out.println("--export-applet Export an applet."); - out.println("--export-application Export an application."); - out.println("--platform Specify the platform (export to application only)."); - out.println(" Should be one of 'windows', 'macosx', or 'linux'."); - out.println("--bits Must be specified if libraries are used that are"); - out.println(" 32- or 64-bit specific such as the OpenGL library."); - out.println(" Otherwise specify 0 or leave it out."); - out.println(); - out.println("--preferences= Specify a preferences file to use. Required if the"); - out.println(" sketch uses libraries found in your sketchbook folder."); - } - - public void startIndeterminate() { - } - - public void stopIndeterminate() { - } - - public void statusHalt() { - } - - public boolean isHalted() { - return false; - } -} diff --git a/oldstuff/protobuf/.gitignore b/oldstuff/protobuf/.gitignore deleted file mode 100644 index d055e9a..0000000 --- a/oldstuff/protobuf/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/bin/protoc -/include/ -/lib/ -/tmp/ diff --git a/oldstuff/protobuf/Makefile b/oldstuff/protobuf/Makefile deleted file mode 100644 index 958b6e0..0000000 --- a/oldstuff/protobuf/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -PROTOC := $(PWD)/bin/protoc -PROTO_FILES := $(shell find src -name '*.proto') -TARGETS := $(patsubst src/%.proto,gen/cc/%.pb.cc,$(PROTO_FILES)) -TARGETS += $(patsubst src/%.proto,gen/py/%_pb2.py,$(PROTO_FILES)) -TARGETS += $(patsubst src/%.proto,gen/java/%.java,$(PROTO_FILES)) - - -gen/cc/%.pb.cc:src/%.proto - mkdir -p $(dir $@) - $(PROTOC) -I=$(shell dirname $^) --cpp_out=$(shell dirname $@) $^ - - -gen/py/%_pb2.py:src/%.proto - mkdir -p $(dir $@) - $(PROTOC) -I=$(shell dirname $^) --python_out=$(shell dirname $@) $^ - - -gen/java/%.java:src/%.proto - mkdir -p $(dir $@) - $(PROTOC) -I=$(shell dirname $^) --java_out=$(shell dirname $(shell dirname $@)) $^ - find $(shell dirname $@) -iname $(notdir $@) -exec mv -v {} $@ \; - - -all: $(TARGETS) diff --git a/oldstuff/protobuf/setup b/oldstuff/protobuf/setup deleted file mode 100755 index e18f996..0000000 --- a/oldstuff/protobuf/setup +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -set -e -set -x - -TOP=$PWD -mkdir -p tmp -pushd tmp -test -f protobuf-2.4.1.tar.bz2 || curl -O http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2 -test -d protobuf-2.4.1 || tar xjvf protobuf-2.4.1.tar.bz2 -pushd protobuf-2.4.1 -./configure --prefix=$TOP -make -make install diff --git a/oldstuff/protobuf/src/tutorial/addressbook.proto b/oldstuff/protobuf/src/tutorial/addressbook.proto deleted file mode 100644 index bb7bd3f..0000000 --- a/oldstuff/protobuf/src/tutorial/addressbook.proto +++ /dev/null @@ -1,32 +0,0 @@ -package tutorial; - -enum Gender { - NONE = 0; - MALE = 1; - FEMALE = 2; - OTHER = 3; -} - -message Person { - required string name = 1; - required int32 id = 2; - optional string email = 3; - optional Gender type = 4 [default = NONE]; - - enum PhoneType { - MOBILE = 0; - HOME = 1; - WORK = 2; - } - - message PhoneNumber { - required string number = 1; - optional PhoneType type = 2 [default = HOME]; - } - - repeated PhoneNumber phone = 5; -} - -message AddressBook { - repeated Person person = 1; -} diff --git a/oldstuff/qt/src/notepad/.gitignore b/oldstuff/qt/src/notepad/.gitignore deleted file mode 100644 index afe2d09..0000000 --- a/oldstuff/qt/src/notepad/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/notepad -/*.o diff --git a/oldstuff/qt/src/notepad/Makefile b/oldstuff/qt/src/notepad/Makefile deleted file mode 100644 index 2ae535b..0000000 --- a/oldstuff/qt/src/notepad/Makefile +++ /dev/null @@ -1,214 +0,0 @@ -############################################################################# -# Makefile for building: notepad -# Generated by qmake (2.01a) (Qt 4.8.3) on: Fri Dec 14 20:27:57 2012 -# Project: notepad.pro -# Template: app -# Command: /usr/bin/qmake -o Makefile notepad.pro -############################################################################# - -####### Compiler, tools and options - -CC = gcc -CXX = g++ -DEFINES = -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) -CXXFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) -INCPATH = -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -LINK = g++ -LFLAGS = -m64 -Wl,-O1 -LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lQtGui -lQtCore -lpthread -AR = ar cqs -RANLIB = -QMAKE = /usr/bin/qmake -TAR = tar -cf -COMPRESS = gzip -9f -COPY = cp -f -SED = sed -COPY_FILE = $(COPY) -COPY_DIR = $(COPY) -r -STRIP = strip -INSTALL_FILE = install -m 644 -p -INSTALL_DIR = $(COPY_DIR) -INSTALL_PROGRAM = install -m 755 -p -DEL_FILE = rm -f -SYMLINK = ln -f -s -DEL_DIR = rmdir -MOVE = mv -f -CHK_DIR_EXISTS= test -d -MKDIR = mkdir -p - -####### Output directory - -OBJECTS_DIR = ./ - -####### Files - -SOURCES = main.cpp -OBJECTS = main.o -DIST = /usr/share/qt4/mkspecs/common/unix.conf \ - /usr/share/qt4/mkspecs/common/linux.conf \ - /usr/share/qt4/mkspecs/common/gcc-base.conf \ - /usr/share/qt4/mkspecs/common/gcc-base-unix.conf \ - /usr/share/qt4/mkspecs/common/g++-base.conf \ - /usr/share/qt4/mkspecs/common/g++-unix.conf \ - /usr/share/qt4/mkspecs/qconfig.pri \ - /usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ - /usr/share/qt4/mkspecs/features/qt_functions.prf \ - /usr/share/qt4/mkspecs/features/qt_config.prf \ - /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ - /usr/share/qt4/mkspecs/features/default_pre.prf \ - /usr/share/qt4/mkspecs/features/release.prf \ - /usr/share/qt4/mkspecs/features/default_post.prf \ - /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ - /usr/share/qt4/mkspecs/features/warn_on.prf \ - /usr/share/qt4/mkspecs/features/qt.prf \ - /usr/share/qt4/mkspecs/features/unix/thread.prf \ - /usr/share/qt4/mkspecs/features/moc.prf \ - /usr/share/qt4/mkspecs/features/resources.prf \ - /usr/share/qt4/mkspecs/features/uic.prf \ - /usr/share/qt4/mkspecs/features/yacc.prf \ - /usr/share/qt4/mkspecs/features/lex.prf \ - /usr/share/qt4/mkspecs/features/include_source_dir.prf \ - notepad.pro -QMAKE_TARGET = notepad -DESTDIR = -TARGET = notepad - -first: all -####### Implicit rules - -.SUFFIXES: .o .c .cpp .cc .cxx .C - -.cpp.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" - -.cc.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" - -.cxx.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" - -.C.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" - -.c.o: - $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" - -####### Build rules - -all: Makefile $(TARGET) - -$(TARGET): $(OBJECTS) - $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) - -Makefile: notepad.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \ - /usr/share/qt4/mkspecs/common/linux.conf \ - /usr/share/qt4/mkspecs/common/gcc-base.conf \ - /usr/share/qt4/mkspecs/common/gcc-base-unix.conf \ - /usr/share/qt4/mkspecs/common/g++-base.conf \ - /usr/share/qt4/mkspecs/common/g++-unix.conf \ - /usr/share/qt4/mkspecs/qconfig.pri \ - /usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \ - /usr/share/qt4/mkspecs/features/qt_functions.prf \ - /usr/share/qt4/mkspecs/features/qt_config.prf \ - /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ - /usr/share/qt4/mkspecs/features/default_pre.prf \ - /usr/share/qt4/mkspecs/features/release.prf \ - /usr/share/qt4/mkspecs/features/default_post.prf \ - /usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ - /usr/share/qt4/mkspecs/features/warn_on.prf \ - /usr/share/qt4/mkspecs/features/qt.prf \ - /usr/share/qt4/mkspecs/features/unix/thread.prf \ - /usr/share/qt4/mkspecs/features/moc.prf \ - /usr/share/qt4/mkspecs/features/resources.prf \ - /usr/share/qt4/mkspecs/features/uic.prf \ - /usr/share/qt4/mkspecs/features/yacc.prf \ - /usr/share/qt4/mkspecs/features/lex.prf \ - /usr/share/qt4/mkspecs/features/include_source_dir.prf \ - /usr/lib/x86_64-linux-gnu/libQtGui.prl \ - /usr/lib/x86_64-linux-gnu/libQtCore.prl - $(QMAKE) -o Makefile notepad.pro -/usr/share/qt4/mkspecs/common/unix.conf: -/usr/share/qt4/mkspecs/common/linux.conf: -/usr/share/qt4/mkspecs/common/gcc-base.conf: -/usr/share/qt4/mkspecs/common/gcc-base-unix.conf: -/usr/share/qt4/mkspecs/common/g++-base.conf: -/usr/share/qt4/mkspecs/common/g++-unix.conf: -/usr/share/qt4/mkspecs/qconfig.pri: -/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri: -/usr/share/qt4/mkspecs/features/qt_functions.prf: -/usr/share/qt4/mkspecs/features/qt_config.prf: -/usr/share/qt4/mkspecs/features/exclusive_builds.prf: -/usr/share/qt4/mkspecs/features/default_pre.prf: -/usr/share/qt4/mkspecs/features/release.prf: -/usr/share/qt4/mkspecs/features/default_post.prf: -/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: -/usr/share/qt4/mkspecs/features/warn_on.prf: -/usr/share/qt4/mkspecs/features/qt.prf: -/usr/share/qt4/mkspecs/features/unix/thread.prf: -/usr/share/qt4/mkspecs/features/moc.prf: -/usr/share/qt4/mkspecs/features/resources.prf: -/usr/share/qt4/mkspecs/features/uic.prf: -/usr/share/qt4/mkspecs/features/yacc.prf: -/usr/share/qt4/mkspecs/features/lex.prf: -/usr/share/qt4/mkspecs/features/include_source_dir.prf: -/usr/lib/x86_64-linux-gnu/libQtGui.prl: -/usr/lib/x86_64-linux-gnu/libQtCore.prl: -qmake: FORCE - @$(QMAKE) -o Makefile notepad.pro - -dist: - @$(CHK_DIR_EXISTS) .tmp/notepad1.0.0 || $(MKDIR) .tmp/notepad1.0.0 - $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/notepad1.0.0/ && $(COPY_FILE) --parents main.cpp .tmp/notepad1.0.0/ && (cd `dirname .tmp/notepad1.0.0` && $(TAR) notepad1.0.0.tar notepad1.0.0 && $(COMPRESS) notepad1.0.0.tar) && $(MOVE) `dirname .tmp/notepad1.0.0`/notepad1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/notepad1.0.0 - - -clean:compiler_clean - -$(DEL_FILE) $(OBJECTS) - -$(DEL_FILE) *~ core *.core - - -####### Sub-libraries - -distclean: clean - -$(DEL_FILE) $(TARGET) - -$(DEL_FILE) Makefile - - -check: first - -mocclean: compiler_moc_header_clean compiler_moc_source_clean - -mocables: compiler_moc_header_make_all compiler_moc_source_make_all - -compiler_moc_header_make_all: -compiler_moc_header_clean: -compiler_rcc_make_all: -compiler_rcc_clean: -compiler_image_collection_make_all: qmake_image_collection.cpp -compiler_image_collection_clean: - -$(DEL_FILE) qmake_image_collection.cpp -compiler_moc_source_make_all: -compiler_moc_source_clean: -compiler_uic_make_all: -compiler_uic_clean: -compiler_yacc_decl_make_all: -compiler_yacc_decl_clean: -compiler_yacc_impl_make_all: -compiler_yacc_impl_clean: -compiler_lex_make_all: -compiler_lex_clean: -compiler_clean: - -####### Compile - -main.o: main.cpp - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp - -####### Install - -install: FORCE - -uninstall: FORCE - -FORCE: - diff --git a/oldstuff/qt/src/notepad/main.cpp b/oldstuff/qt/src/notepad/main.cpp deleted file mode 100644 index 4610471..0000000 --- a/oldstuff/qt/src/notepad/main.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int main(int argv, char **args) -{ - QApplication app(argv, args); - - QTextEdit textEdit; - QPushButton quitButton("Quit"); - - QObject::connect(&quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); - - QVBoxLayout layout; - layout.addWidget(&textEdit); - layout.addWidget(&quitButton); - - QWidget window; - window.setLayout(&layout); - - window.show(); - - return app.exec(); -} diff --git a/oldstuff/qt/src/notepad/notepad.pro b/oldstuff/qt/src/notepad/notepad.pro deleted file mode 100644 index 0bb7991..0000000 --- a/oldstuff/qt/src/notepad/notepad.pro +++ /dev/null @@ -1,11 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Fri Dec 14 20:27:52 2012 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/oldstuff/redis/.gitignore b/oldstuff/redis/.gitignore deleted file mode 100644 index 58c2a9d..0000000 --- a/oldstuff/redis/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.rdb diff --git a/oldstuff/redis/Gemfile b/oldstuff/redis/Gemfile deleted file mode 100644 index 568a50b..0000000 --- a/oldstuff/redis/Gemfile +++ /dev/null @@ -1,7 +0,0 @@ -source :rubygems - -gem 'fastercsv' -gem 'hiredis' -gem 'rake' -gem 'redis' -gem 'slop' diff --git a/oldstuff/redis/Gemfile.lock b/oldstuff/redis/Gemfile.lock deleted file mode 100644 index 985ef31..0000000 --- a/oldstuff/redis/Gemfile.lock +++ /dev/null @@ -1,18 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - fastercsv (1.5.4) - hiredis (0.4.4) - rake (0.9.2.2) - redis (2.2.2) - slop (3.0.4) - -PLATFORMS - ruby - -DEPENDENCIES - fastercsv - hiredis - rake - redis - slop diff --git a/oldstuff/redis/Rakefile b/oldstuff/redis/Rakefile deleted file mode 100644 index b114140..0000000 --- a/oldstuff/redis/Rakefile +++ /dev/null @@ -1,21 +0,0 @@ -desc 'drop all of the earthquake data' -task :drop do - get_earthquakes.drop_all -end - - -desc 'load all of the earthquake data' -task :load do - get_earthquakes.load_data -end - - -desc 'drop, then load all of the earthquake data' -task :reload => [:drop, :load] -task :default => :load - - -def get_earthquakes - require File.expand_path('../earthquakes', __FILE__) - Earthquakes.new -end diff --git a/oldstuff/redis/earthquakes.rb b/oldstuff/redis/earthquakes.rb deleted file mode 100644 index b1fc41f..0000000 --- a/oldstuff/redis/earthquakes.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'csv' -require 'redis/connection/hiredis' -require 'redis' - -require 'logger' -require 'open-uri' - - -class Earthquakes - attr_accessor :id_set, :region_set, :magnitude_set - attr_accessor :magnitude_scores_set, :data_url - - def initialize - @redis = Redis.new - @id_set = 'earthquake-ids' - @region_set = 'earthquake-regions' - @magnitude_set = 'earthquake-magnitudes' - @magnitude_scores_set = 'earthquakes-magnitudes-scores' - @data_url = - 'http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M1.txt' - - @logger = Logger.new(STDOUT) - @logger.formatter = proc do |severity, datetime, progname, msg| - "#{datetime}: #{msg}\n" - end - end - - def get_info(earthquake_id) - @redis.hgetall(with_prefix(earthquake_id, 'eqid')) - end - - def in_region(region) - @redis.smembers(with_prefix(region, 'eqregion')) - end - - def with_magnitude_in_range(min_magnitude, max_magnitude) - min_mag, max_mag = - magnitude_as_int(min_magnitude), magnitude_as_int(max_magnitude) - @logger.debug( - "Fetching magnitudes with scores in range #{min_mag}-#{max_mag}") - @redis.zrange(@magnitude_scores_set, min_mag, max_mag) - end - - def all_ids - @redis.smembers(@id_set).map { |i| sans_prefix(i, 'eqid') } - end - - def all_regions - @redis.smembers(@region_set).map { |r| sans_prefix(r, 'eqregion') } - end - - def all_magnitudes - @redis.smembers(@magnitude_set).map { |m| sans_prefix(m, 'eqmagnitude') } - end - - def drop_all - @logger.info('Removing data for each earthquake') - all_ids.each do |i| - @logger.info("Removing data for earthquake #{sans_prefix(i, 'eqid')}") - @redis.del(i) - end - - @logger.info('Removing earthquake id set') - @redis.del(@id_set) - - @logger.info('Removing earthquake region set') - @redis.del(@region_set) - - @logger.info('Removing earthquake magnitude set') - @redis.del(@magnitude_set) - - @logger.info('Removing earthquake magnitude scores set') - @redis.del(@magnitude_scores_set) - end - - def load_data - data = CSV.parse( - open(@data_url).read, :headers => true, :header_converters => [:symbol] - ) - - data.each do |row| - @logger.info("Adding earthquake #{row[:eqid]}") - load_one_row(row) - end - end - - private - def load_one_row(row) - @redis.multi do |redis_multi| - id_key = with_prefix(row[:eqid].downcase, 'eqid') - load_id_and_attrs_for_row(row, id_key, redis_multi) - load_region_for_row(row, id_key, redis_multi) - load_magnitude_for_row(row, id_key, redis_multi) - end - end - - def load_id_and_attrs_for_row(row, id_key, redis_multi) - redis_multi.sadd(@id_set, id_key) - row.headers.each do |header| - redis_multi.hset(id_key, header.downcase, row[header].downcase) - end - end - - def load_region_for_row(row, id_key, redis_multi) - region_key = with_prefix(row[:region].downcase, 'eqregion') - redis_multi.sadd(region_key, id_key) - redis_multi.sadd(@region_set, region_key) - end - - def load_magnitude_for_row(row, id_key, redis_multi) - magnitude_key = with_prefix(row[:magnitude], 'eqmagnitude') - redis_multi.sadd(magnitude_key, id_key) - redis_multi.sadd(@magnitude_set, magnitude_key) - score = magnitude_as_int(row[:magnitude]) - @logger.info("Setting score of #{score} for row #{row.inspect}") - redis_multi.zadd(@magnitude_scores_set, score, id_key) - end - - def with_prefix(key, prefix) - if not /^#{prefix}:/.match(key) - return "#{prefix}:#{key}" - end - - key - end - - def sans_prefix(key, prefix) - key.gsub(/^#{prefix}:/, '') - end - - def magnitude_as_int(magnitude) - magnitude.to_s.gsub(/\./, '').to_i - end -end - - -if $0 == __FILE__ - Earthquakes.new.send(ARGV.first) -end diff --git a/oldstuff/redis/eq-info.rb b/oldstuff/redis/eq-info.rb deleted file mode 100755 index 21281c0..0000000 --- a/oldstuff/redis/eq-info.rb +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env ruby - -require 'json' -require 'slop' - -require File.expand_path('../earthquakes', __FILE__) - - -def main - opts = Slop.parse(:help => true, :strict => true) do - banner "#{File.basename(__FILE__)} [options]" - on :L, :listall, 'List all available earthquake ids.' - on :R, :listall_regions, 'List available earthquake regions.' - on :M, :listall_magnitudes, 'List available earthquakes magnitudes.' - on :r, :region=, 'Show earthquakes for region.' - on :m, :magnitude_range=, 'Show earthquakes of magnitude in range, e.g. "1.1-2.9".' - on :i, :eqid=, 'Show all available info for earthquake with id.' - end - - if ARGV.length < 1 - puts opts - return 2 - end - - earthquakes = Earthquakes.new - - if opts.listall? - earthquakes.all_ids.each { |i| puts i } - return 0 - end - - if opts.listall_regions? - earthquakes.all_regions.sort.each { |r| puts r } - return 0 - end - - if opts.listall_magnitudes? - earthquakes.all_magnitudes.sort.each { |m| puts m } - return 0 - end - - if opts[:region] - puts "/* Earthquakes in region #{opts[:region]} */" - - results = [] - earthquakes.in_region(opts[:region]).each do |i| - results << earthquakes.get_info(i) - end - - puts JSON.pretty_generate(results) - return 0 - end - - if opts[:magnitude_range] - puts "/* Earthquakes with magnitude #{opts[:magnitude]} */" - - min_mag, max_mag = opts[:magnitude_range].split('-') - - results = [] - earthquakes.with_magnitude_in_range(min_mag, max_mag).each do |i| - results << earthquakes.get_info(i) - end - - puts JSON.pretty_generate(results) - return 0 - end - - if opts[:eqid] - puts "/* Earthquake with id of #{opts[:eqid]} */" - puts JSON.pretty_generate(earthquakes.get_info(opts[:eqid])) - return 0 - end - - return 1 -end - - -if $0 == __FILE__ - exit(main) -end diff --git a/oldstuff/redis/in-and-out.rb b/oldstuff/redis/in-and-out.rb deleted file mode 100644 index 19838ac..0000000 --- a/oldstuff/redis/in-and-out.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'redis/connection/hiredis' -require 'redis' - -require 'pp' -require 'yaml' - - -class Fancy - attr_accessor :has_pants, :likes_to_dance - - def initialize(has_pants) - @has_pants = has_pants - @likes_to_dance = true - end -end - - -def main - redis = Redis.new - - inst = Fancy.new('yup!') - - ['foo', 'derp', 'hamsters'].each { |k| redis.del(k) } - - puts redis.set('foo', 'bar') - puts redis.set('derp', inst.to_yaml) - puts redis.sadd('hamsters', 'albert') - puts redis.sadd('hamsters', 'walter') - - puts redis.get('foo') - pp YAML.load_documents(redis.get('derp'))[0] - puts redis.smembers('hamsters') -end - - -if $0 == __FILE__ - main -end diff --git a/oldstuff/ruby-sockets/line-protocol/client.rb b/oldstuff/ruby-sockets/line-protocol/client.rb deleted file mode 100644 index 460116b..0000000 --- a/oldstuff/ruby-sockets/line-protocol/client.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'date' -require 'time' -require 'socket' - -DATEFMT = '%Y%m%d%H%M%S' - -def recordify(msg) - code = '%-31s' % 'DERP' - num = '%-12d' % (rand.to_s.tr('.', '0')[0,5]).to_i - timestamp = Time.now.strftime(DATEFMT) - len = '%-6d' % msg.length - "#{code}#{num}#{len}#{timestamp}#{msg.gsub(/\r/, '\r').gsub(/\n/, '\n')}\r\n" -end - -def main - print "What to say?: " - msg = gets - TCPSocket.open('127.0.0.1', 15778) do |sock| - sock.send(recordify(msg), 0) - response = sock.recv(66) - sock.close - - puts "raw response --> #{response.inspect}" - code = response[0,31].to_s.strip - num = response[31,12].to_s.strip - raw_timestamp = response[49,14].to_s.strip - timestamp = DateTime.strptime(raw_timestamp, DATEFMT) - - puts "code: '#{code}'" - puts "num: '#{num}'" - puts "timestamp: '#{timestamp}'" - end -end - -if __FILE__ == $0 - main -end diff --git a/oldstuff/ruby-sockets/line-protocol/server.rb b/oldstuff/ruby-sockets/line-protocol/server.rb deleted file mode 100644 index 0b47598..0000000 --- a/oldstuff/ruby-sockets/line-protocol/server.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'date' -require 'time' -require 'eventmachine' - -DATEFMT = '%Y%m%d%H%M%S' - -def generic_response - code = '%-31s' % 'SNARF' - num = '%-12d' % (rand.to_s.tr('.', '0')[0,5]).to_i - filler = (' ' * 7) - timestamp = Time.now.strftime(DATEFMT) - "#{code}#{num}#{filler}#{timestamp}\r\n" -end - -module LineProtocolServer - def post_init - puts "# BEGIN CONN #{Time.now}" - end - - def receive_data(request) - code = request[0,31].to_s.strip - num = request[31,12].to_s.strip - len = request[43,6].to_s.strip - puts "raw date --> '#{request[49,14]}'" - timestamp = DateTime.strptime(request[49,14].strip, DATEFMT) - msg = request[63,len.to_i+1].strip - - puts "code: '#{code}'" - puts "num: '#{num}'" - puts "len: '#{len}'" - puts "timestamp: '#{timestamp}'" - puts "msg: '#{msg}'" - - send_data(generic_response) - end - - def unbind - puts "# END CONN #{Time.now}" - end -end - -EventMachine.run do - EventMachine.start_server('0.0.0.0', 15778, LineProtocolServer) - puts 'Listening on 0.0.0.0:15778' -end diff --git a/oldstuff/ruby-sockets/marco-polo/.gitignore b/oldstuff/ruby-sockets/marco-polo/.gitignore deleted file mode 100644 index e2186fa..0000000 --- a/oldstuff/ruby-sockets/marco-polo/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.sqlite3* diff --git a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/.gitignore b/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/.gitignore deleted file mode 100644 index 2d8b925..0000000 --- a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.userprefs -*.pidb -/MarcoPoloClient/bin/ diff --git a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/Makefile b/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/Makefile deleted file mode 100644 index 5daac93..0000000 --- a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -MarcoPoloClient/bin/Debug/MarcoPoloClient.exe: $(wildcard MarcoPoloClient/*.cs) - mdtool build --f --buildfile:MarcoPoloClient.sln diff --git a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient.sln b/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient.sln deleted file mode 100644 index 7e0fe01..0000000 --- a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarcoPoloClient", "MarcoPoloClient\MarcoPoloClient.csproj", "{6728C605-D295-48C7-8634-C9D06A3325F0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6728C605-D295-48C7-8634-C9D06A3325F0}.Debug|x86.ActiveCfg = Debug|x86 - {6728C605-D295-48C7-8634-C9D06A3325F0}.Debug|x86.Build.0 = Debug|x86 - {6728C605-D295-48C7-8634-C9D06A3325F0}.Release|x86.ActiveCfg = Release|x86 - {6728C605-D295-48C7-8634-C9D06A3325F0}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = MarcoPoloClient\MarcoPoloClient.csproj - EndGlobalSection -EndGlobal diff --git a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/AssemblyInfo.cs b/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/AssemblyInfo.cs deleted file mode 100644 index 543896a..0000000 --- a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("MarcoPoloClient")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("me")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.0.*")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - diff --git a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/Main.cs b/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/Main.cs deleted file mode 100644 index 41b2c65..0000000 --- a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/Main.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Net.Sockets; -using System.Net; -using System.Threading; -using System.Text; - -namespace MarcoPoloClient -{ - class MainClass - { - const int MARCO_POLO_PORT = 22000; - const string MARCO_POLO_SERVER = "127.0.0.1"; - - public static void Main (string[] args) - { - while (true) - { - SocketClient client = new SocketClient(); - - string result = client.Connect(MARCO_POLO_SERVER, MARCO_POLO_PORT); - result = client.Send("polo doreen 25 75\n"); - Console.WriteLine(String.Format("'polo' got back: '{0}'", result)); - string response = client.Receive(); - Console.WriteLine(String.Format("'polo' response: '{0}'", response)); - client.Close(); - - Console.WriteLine("sleeping for half a second..."); - Thread.Sleep(500); - } - } - } -} diff --git a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/MarcoPoloClient.csproj b/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/MarcoPoloClient.csproj deleted file mode 100644 index 458c3f2..0000000 --- a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/MarcoPoloClient.csproj +++ /dev/null @@ -1,43 +0,0 @@ - - - - Debug - x86 - 10.0.0 - 2.0 - {6728C605-D295-48C7-8634-C9D06A3325F0} - Exe - MarcoPoloClient - MarcoPoloClient - v4.0 - - - true - full - false - bin\Debug - DEBUG - prompt - 4 - x86 - true - - - none - false - bin\Release - prompt - 4 - x86 - true - - - - - - - - - - - \ No newline at end of file diff --git a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/SocketClient.cs b/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/SocketClient.cs deleted file mode 100644 index a29ebe1..0000000 --- a/oldstuff/ruby-sockets/marco-polo/MarcoPoloClient/MarcoPoloClient/SocketClient.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Net.Sockets; -using System.Net; -using System.Threading; -using System.Text; - -namespace MarcoPoloClient -{ - public class SocketClient - { - Socket _socket = null; - static ManualResetEvent _clientDone = new ManualResetEvent (false); - const int TIMEOUT_MILLISECONDS = 5000; - const int MAX_BUFFER_SIZE = 2048; - - public SocketClient () - { - } - - public string Connect (string hostName, int portNumber) - { - string result = string.Empty; - DnsEndPoint hostEntry = new DnsEndPoint (hostName, portNumber); - _socket = new Socket ( - AddressFamily.InterNetwork, - SocketType.Stream, - ProtocolType.Tcp - ); - SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs (); - socketEventArg.RemoteEndPoint = hostEntry; - - socketEventArg.Completed += new EventHandler (delegate(object s, SocketAsyncEventArgs e) - { - result = e.SocketError.ToString (); - _clientDone.Set (); - } - ); - - _clientDone.Reset (); - _socket.ConnectAsync (socketEventArg); - _clientDone.WaitOne (TIMEOUT_MILLISECONDS); - - return result; - } - - public string Send (string data) - { - string response = "Operation Timeout"; - - if (_socket != null) { - SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs (); - socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint; - socketEventArg.UserToken = null; - - socketEventArg.Completed += new EventHandler (delegate(object s, SocketAsyncEventArgs e) - { - response = e.SocketError.ToString (); - _clientDone.Set (); - } - ); - - byte[] payload = Encoding.UTF8.GetBytes (data); - socketEventArg.SetBuffer (payload, 0, payload.Length); - - _clientDone.Reset (); - _socket.SendAsync (socketEventArg); - _clientDone.WaitOne (TIMEOUT_MILLISECONDS); - } else { - response = "Socket is not initialized"; - } - return response; - } - - public string Receive () - { - string response = "Operation Timeout"; - - if (_socket != null) { - SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs (); - socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint; - - socketEventArg.SetBuffer (new Byte[MAX_BUFFER_SIZE], 0, MAX_BUFFER_SIZE); - socketEventArg.Completed += new EventHandler (delegate(object s, SocketAsyncEventArgs e) - { - if (e.SocketError == SocketError.Success) { - response = Encoding.UTF8.GetString (e.Buffer, e.Offset, e.BytesTransferred); - response = response.Trim ('\0'); - } else { - response = e.SocketError.ToString (); - } - _clientDone.Set (); - } - ); - - _clientDone.Reset (); - _socket.ReceiveAsync (socketEventArg); - _clientDone.WaitOne (TIMEOUT_MILLISECONDS); - } else { - response = "Socket is not initialized"; - } - - return response; - } - - public void Close () - { - if (_socket != null) { - _socket.Close (); - } - } - } -} diff --git a/oldstuff/ruby-sockets/marco-polo/client.rb b/oldstuff/ruby-sockets/marco-polo/client.rb deleted file mode 100644 index e42102b..0000000 --- a/oldstuff/ruby-sockets/marco-polo/client.rb +++ /dev/null @@ -1,79 +0,0 @@ -require 'optparse' -require 'socket' - -def main(args = ARGV) - options = { - :type => :write, - :sleep_interval => 1.0, - :name => 'sally', - :port => 22000 - } - - OptionParser.new do |opts| - opts.banner = "Usage: ruby #{File.basename($0)} [options]" - opts.on('-t [TYPE]', '--type [TYPE]', [:read, :write], - "Client type (read/write), default=#{options[:type].to_s}") do |t| - options[:type] = t - end - opts.on('-n [NAME]', '--name [NAME]', - "Client (player) name, default='#{options[:name]}'") do |n| - options[:name] = n - end - opts.on('-s [SLEEP_INTERVAL]', '--sleep [SLEEP_INTERVAL]', - "Sleep interval between requests, " << - "default=#{options[:sleep_interval]}") do |s| - options[:sleep_interval] = s.to_f - end - opts.on('-p [PORT]', '--port [PORT]', Integer, - "Server port, default=#{options[:port]}") do |p| - options[:port] = p - end - end.parse!(args) - - run_client(options) -end - -def run_client(options) - client_type = options.fetch(:type, :read) - client_name = options.fetch(:name, 'sally') - sleep_interval = options.fetch(:sleep_interval, 1.0) - port = options.fetch(:port, 22000) - - puts "Starting #{client_type} client for '#{client_name}', " << - "interval=#{sleep_interval}, port=#{port}" - - successes = 0 - backoff = 0.5 - nextloc = [rand(0..99), rand(0..99)] - loop do - begin - TCPSocket.open('127.0.0.1', port) do |sock| - case client_type - when :read - sock.send("marco #{client_name}\n", 0) - location = sock.recv(100).to_s.split[2,4].map(&:to_i) - puts "marco #{client_name} -> #{location.first} #{location.last}" - when :write - sock.send("polo #{client_name} #{nextloc.first} #{nextloc.last}\n", 0) - recv_loc = sock.recv(100).to_s.split.map(&:to_i) - puts "polo #{client_name} #{nextloc.first} #{nextloc.last} " << - "-> #{recv_loc.first} #{recv_loc.last}" - nextloc = recv_loc - end - sock.close - end - successes += 1 - backoff = 0.5 - sleep sleep_interval - rescue - puts "made it #{successes} times. sleeping #{backoff} secs" - successes = 0 - sleep backoff - backoff *= 2 - end - end -end - -if $0 == __FILE__ - main -end diff --git a/oldstuff/ruby-sockets/marco-polo/server.rb b/oldstuff/ruby-sockets/marco-polo/server.rb deleted file mode 100644 index d7f491e..0000000 --- a/oldstuff/ruby-sockets/marco-polo/server.rb +++ /dev/null @@ -1,102 +0,0 @@ -require 'eventmachine' -require 'sequel' - -class MarcoPolo - attr_reader :locations, :db - - def initialize - @pool_range = 0..99 - # I'm not using this (yet?) ... but don't want to forget how I did it - # @pool = [].tap do |board| - # @pool_range.each do |y| - # board << [].tap do |row| - # @pool_range.each do |x| - # row << "#{y}-#{x}" - # end - # end - # end - # end - @db = Sequel.connect("postgres://#{ENV['USER']}@localhost/marco_polo", - :max_connections => 10) - unless @db.table_exists?(:locations) - @db.create_table :locations do - primary_key :id - String :client - DateTime :timestamp - Integer :x - Integer :y - constraint(:in_the_pool, 'x > -1 and x < 100 and y > -1 and y < 100') - end - end - @locations = @db[:locations] - puts "LET GAME BEGIN NOW" - end - - def polo(client, x, y) - @locations.insert(:client => client, :x => x, :y => y, - :timestamp => Time.now) - nextloc(x, y) - end - - def marco(client = nil) - if client - @locations.where(:client => client).order_by(:timestamp.desc).first - else - @locations.order_by(:timestamp.desc).first - end - end - - private - def nextloc(x, y) - # we allow exiting the pool as long as you get back in on the opposite side - # a la pac man - move_x, move_y = rand(-2..2), rand(-2..2) - new_x = x + move_x - new_x = 100 + new_x if new_x <= -1 - new_y = y + move_y - new_y = 100 + new_y if new_y <= -1 - [ - new_x > 99 ? new_x % 100 : new_x, - new_y > 99 ? new_y % 100 : new_y - ] - end -end - -class MarcoPoloServer < EventMachine::Connection - class << self - attr_accessor :game - end - - def receive_data(data) - parts = data.to_s.split - case parts.first - when 'polo' - client, x, y = parts[1,4] - newloc = self.class.game.polo(client, x.to_i, y.to_i) - send_data("#{newloc.first} #{newloc.last}\n") - when 'marco' - if loc = self.class.game.marco(parts[1]) - send_data("polo #{loc[:client]} #{loc[:x]} #{loc[:y]}\n") - else - send_data("polo NULL 0 0\n") - end - else - send_data("#{parts.first}???\n") - end - rescue => e - STDERR.puts("#{e.class.name} #{e.message}: #{e.backtrace.join("\n")}") - end -end - -def main - MarcoPoloServer.game = MarcoPolo.new - EventMachine.run do - host, port = '0.0.0.0', 22000 - EventMachine.start_server(host, port, MarcoPoloServer) - puts "Listening on #{host}:#{port}" - end -end - -if $0 == __FILE__ - main -end diff --git a/oldstuff/ruby-sockets/ping-pong/client.py b/oldstuff/ruby-sockets/ping-pong/client.py deleted file mode 100644 index 39170a0..0000000 --- a/oldstuff/ruby-sockets/ping-pong/client.py +++ /dev/null @@ -1,11 +0,0 @@ -import socket -import sys -import time - - -while True: - client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - client.connect(('localhost', 24000)) - client.send('PING\n') - sys.stdout.write('client: RECV {}'.format(client.recv(100))) - time.sleep(0.5) diff --git a/oldstuff/ruby-sockets/ping-pong/client.rb b/oldstuff/ruby-sockets/ping-pong/client.rb deleted file mode 100644 index 1cecdb1..0000000 --- a/oldstuff/ruby-sockets/ping-pong/client.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'socket' - -loop do - TCPSocket.open('127.0.0.1', 24000) do |sock| - sock.send("PING\n", 0) - pong = sock.recv(100) - puts "client: RECV PONG" - sock.close - end - sleep 0.5 -end diff --git a/oldstuff/ruby-sockets/ping-pong/em-server.rb b/oldstuff/ruby-sockets/ping-pong/em-server.rb deleted file mode 100644 index f6101f5..0000000 --- a/oldstuff/ruby-sockets/ping-pong/em-server.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'eventmachine' - -module PongServer - def post_init - puts "server: Got me a client!" - end - - def receive_data(data) - if data =~ /PING/ - puts 'server: RECV PING' - send_data("PONG\n") - else - puts "server: RECV #{data}" - send_data("NOPE\n") - end - end - - def unbind - puts "server: So long, client!" - end -end - -EventMachine.run do - EventMachine.start_server('0.0.0.0', 24000, PongServer) - puts 'Listening on 0.0.0.0:24000' -end diff --git a/oldstuff/ruby-sockets/ping-pong/server.rb b/oldstuff/ruby-sockets/ping-pong/server.rb deleted file mode 100644 index fc33c93..0000000 --- a/oldstuff/ruby-sockets/ping-pong/server.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'socket' - -server = TCPServer.new('0.0.0.0', 24000) -loop do - Thread.start(server.accept) do |client| - if (ping = client.gets) =~ /PING/ - puts 'server: RECV PING' - client.puts("PONG\n") - else - puts "server: RECV #{ping}" - client.puts("NOPE\n") - end - client.close - end -end diff --git a/oldstuff/rustbook/.gitignore b/oldstuff/rustbook/.gitignore deleted file mode 100644 index 50a623b..0000000 --- a/oldstuff/rustbook/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*/target/ -*/Cargo.lock diff --git a/oldstuff/rustbook/branches/Cargo.toml b/oldstuff/rustbook/branches/Cargo.toml deleted file mode 100644 index 0aa4dcf..0000000 --- a/oldstuff/rustbook/branches/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "branches" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/rustbook/branches/src/main.rs b/oldstuff/rustbook/branches/src/main.rs deleted file mode 100644 index e7286a8..0000000 --- a/oldstuff/rustbook/branches/src/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - for number in (1..4).rev() { - println!("{}!", number); - } - println!("LIFTOFF!!!"); -} diff --git a/oldstuff/rustbook/communicator/Cargo.toml b/oldstuff/rustbook/communicator/Cargo.toml deleted file mode 100644 index 7b8f343..0000000 --- a/oldstuff/rustbook/communicator/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "communicator" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/rustbook/communicator/src/client.rs b/oldstuff/rustbook/communicator/src/client.rs deleted file mode 100644 index 713529d..0000000 --- a/oldstuff/rustbook/communicator/src/client.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub fn connect() { -} diff --git a/oldstuff/rustbook/communicator/src/lib.rs b/oldstuff/rustbook/communicator/src/lib.rs deleted file mode 100644 index 2a226f8..0000000 --- a/oldstuff/rustbook/communicator/src/lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub mod client; - -pub mod network; - -#[cfg(test)] -mod tests { - use super::client; - - #[test] - fn it_works() { - client::connect(); - } -} diff --git a/oldstuff/rustbook/communicator/src/main.rs b/oldstuff/rustbook/communicator/src/main.rs deleted file mode 100644 index bb9a64b..0000000 --- a/oldstuff/rustbook/communicator/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate communicator; - -fn main() { - communicator::client::connect(); -} diff --git a/oldstuff/rustbook/communicator/src/network/mod.rs b/oldstuff/rustbook/communicator/src/network/mod.rs deleted file mode 100644 index 1322b67..0000000 --- a/oldstuff/rustbook/communicator/src/network/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub fn connect() { -} - -pub mod server; diff --git a/oldstuff/rustbook/communicator/src/network/server.rs b/oldstuff/rustbook/communicator/src/network/server.rs deleted file mode 100644 index 713529d..0000000 --- a/oldstuff/rustbook/communicator/src/network/server.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub fn connect() { -} diff --git a/oldstuff/rustbook/functions/Cargo.toml b/oldstuff/rustbook/functions/Cargo.toml deleted file mode 100644 index 25689da..0000000 --- a/oldstuff/rustbook/functions/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "functions" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/rustbook/functions/src/main.rs b/oldstuff/rustbook/functions/src/main.rs deleted file mode 100644 index b4c8443..0000000 --- a/oldstuff/rustbook/functions/src/main.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - let x = plus_one(5); - - println!("The value of x is: {}", x); -} - -fn plus_one(x: i32) -> i32 { - x + 1 -} diff --git a/oldstuff/rustbook/guessing_game/.gitignore b/oldstuff/rustbook/guessing_game/.gitignore deleted file mode 100644 index 2c96eb1..0000000 --- a/oldstuff/rustbook/guessing_game/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -target/ -Cargo.lock diff --git a/oldstuff/rustbook/guessing_game/Cargo.toml b/oldstuff/rustbook/guessing_game/Cargo.toml deleted file mode 100644 index f00d395..0000000 --- a/oldstuff/rustbook/guessing_game/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "guessing_game" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] -rand = "0.4.0" diff --git a/oldstuff/rustbook/guessing_game/src/main.rs b/oldstuff/rustbook/guessing_game/src/main.rs deleted file mode 100644 index 2c1aa68..0000000 --- a/oldstuff/rustbook/guessing_game/src/main.rs +++ /dev/null @@ -1,37 +0,0 @@ -extern crate rand; - -use std::cmp::Ordering; -use std::io; -use rand::Rng; - -fn main() { - println!("Guess the number!"); - - let secret_number = rand::thread_rng().gen_range(1, 101); - - loop { - println!("Please input your guess."); - - let mut guess = String::new(); - - io::stdin() - .read_line(&mut guess) - .expect("Failed to read line"); - - let guess: u32 = match guess.trim().parse() { - Ok(num) => num, - Err(_) => continue, - }; - - println!("You guessed: {}", guess); - - match guess.cmp(&secret_number) { - Ordering::Less => println!("Too small!"), - Ordering::Greater => println!("Too big!"), - Ordering::Equal => { - println!("You win!"); - break; - } - } - } -} diff --git a/oldstuff/rustbook/hello_cargo/.gitignore b/oldstuff/rustbook/hello_cargo/.gitignore deleted file mode 100644 index ca98cd9..0000000 --- a/oldstuff/rustbook/hello_cargo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target/ -Cargo.lock diff --git a/oldstuff/rustbook/hello_cargo/Cargo.toml b/oldstuff/rustbook/hello_cargo/Cargo.toml deleted file mode 100644 index f2be613..0000000 --- a/oldstuff/rustbook/hello_cargo/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "hello_cargo" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/rustbook/hello_cargo/src/main.rs b/oldstuff/rustbook/hello_cargo/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/oldstuff/rustbook/hello_cargo/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/oldstuff/rustbook/hello_world/main b/oldstuff/rustbook/hello_world/main deleted file mode 100755 index 1455e4c..0000000 Binary files a/oldstuff/rustbook/hello_world/main and /dev/null differ diff --git a/oldstuff/rustbook/hello_world/main.rs b/oldstuff/rustbook/hello_world/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/oldstuff/rustbook/hello_world/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/oldstuff/rustbook/ownership/Cargo.toml b/oldstuff/rustbook/ownership/Cargo.toml deleted file mode 100644 index 8c37b94..0000000 --- a/oldstuff/rustbook/ownership/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "ownership" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/rustbook/ownership/src/main.rs b/oldstuff/rustbook/ownership/src/main.rs deleted file mode 100644 index 97a7b0f..0000000 --- a/oldstuff/rustbook/ownership/src/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -fn main() { - let s = String::from("hello world"); - - let word = first_word(&s[..]); - println!("word={}", word); - - let l = "hello world"; - - let word = first_word(&l[..]); - println!("word={}", word); - - let word = first_word(l); - println!("word={}", word); -} - -fn first_word(s: &str) -> &str { - let bytes = s.as_bytes(); - - for (i, &item) in bytes.iter().enumerate() { - if item == b' ' { - return &s[0..i]; - } - } - - &s[..] -} diff --git a/oldstuff/rustbook/panic/Cargo.toml b/oldstuff/rustbook/panic/Cargo.toml deleted file mode 100644 index 0afc37f..0000000 --- a/oldstuff/rustbook/panic/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "panic" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/rustbook/panic/src/main.rs b/oldstuff/rustbook/panic/src/main.rs deleted file mode 100644 index dfc6789..0000000 --- a/oldstuff/rustbook/panic/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let v = vec![1, 2, 3]; - - v[100]; -} diff --git a/oldstuff/rustbook/rectangles/Cargo.toml b/oldstuff/rustbook/rectangles/Cargo.toml deleted file mode 100644 index d4d4479..0000000 --- a/oldstuff/rustbook/rectangles/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "rectangles" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/rustbook/rectangles/src/main.rs b/oldstuff/rustbook/rectangles/src/main.rs deleted file mode 100644 index b991119..0000000 --- a/oldstuff/rustbook/rectangles/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -#[derive(Debug)] -struct Rectangle { - width: u32, - height: u32, -} - -impl Rectangle { - fn area(&self) -> u32 { - self.width * self.height - } - - fn can_hold(&self, other: &Rectangle) -> bool { - self.width > other.width && self.height > other.height - } - - fn square(size: u32) -> Rectangle { - Rectangle { width: size, height: size } - } -} - -fn main() { - let rect1 = Rectangle { width: 30, height: 50 }; - let rect2 = Rectangle { width: 10, height: 40 }; - let rect3 = Rectangle { width: 60, height: 45 }; - let rect4 = Rectangle::square(3); - - println!("Can rect1 hold rect2? {}", rect1.can_hold(&rect2)); - println!("Can rect1 hold rect3? {}", rect1.can_hold(&rect3)); - - for (i, rect) in [rect1, rect2, rect3, rect4].iter().enumerate() { - println!("rect{} has area {}", i+1, rect.area()); - } -} diff --git a/oldstuff/rustbook/variables/Cargo.toml b/oldstuff/rustbook/variables/Cargo.toml deleted file mode 100644 index 587f771..0000000 --- a/oldstuff/rustbook/variables/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "variables" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/rustbook/variables/src/main.rs b/oldstuff/rustbook/variables/src/main.rs deleted file mode 100644 index d325180..0000000 --- a/oldstuff/rustbook/variables/src/main.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - let x = 5; - - let x = x + 1; - - let x = x * 2; - - println!("The value of x is: {}", x); -} diff --git a/oldstuff/scala/official-by-example/.env b/oldstuff/scala/official-by-example/.env deleted file mode 100644 index 580223b..0000000 --- a/oldstuff/scala/official-by-example/.env +++ /dev/null @@ -1,2 +0,0 @@ -HERE=$(dirname "$1") -(echo "$PATH" | grep "$HERE/bin" >/dev/null 2>&1) || export PATH="$HERE/bin:$PATH" diff --git a/oldstuff/scala/official-by-example/.gitignore b/oldstuff/scala/official-by-example/.gitignore deleted file mode 100644 index f984205..0000000 --- a/oldstuff/scala/official-by-example/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/bin/ -target/ diff --git a/oldstuff/scala/official-by-example/byx/build.sbt b/oldstuff/scala/official-by-example/byx/build.sbt deleted file mode 100644 index d92a28b..0000000 --- a/oldstuff/scala/official-by-example/byx/build.sbt +++ /dev/null @@ -1,3 +0,0 @@ -name := "byx" - -version := "0.1.0" diff --git a/oldstuff/scala/official-by-example/byx/src/main/scala/sort.scala b/oldstuff/scala/official-by-example/byx/src/main/scala/sort.scala deleted file mode 100644 index a33daa0..0000000 --- a/oldstuff/scala/official-by-example/byx/src/main/scala/sort.scala +++ /dev/null @@ -1,12 +0,0 @@ -object sort { - def sort(xs: Array[Int]): Array[Int] = { - if (xs.length <= 1) xs - else { - val pivot = xs(xs.length / 2) - Array.concat( - sort(xs filter (pivot >)), - xs filter (pivot ==), - sort(xs filter (pivot <))) - } - } -} diff --git a/oldstuff/scala/official-by-example/setup b/oldstuff/scala/official-by-example/setup deleted file mode 100755 index 4032ce5..0000000 --- a/oldstuff/scala/official-by-example/setup +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -e - -mkdir -p ./bin -pushd ./bin -curl -O 'https://raw.github.com/paulp/sbt-extras/master/sbt' -chmod +x sbt -popd -./bin/sbt -sbt-create about diff --git a/oldstuff/scala/official-tutorial/FrenchDate.scala b/oldstuff/scala/official-tutorial/FrenchDate.scala deleted file mode 100644 index f7da805..0000000 --- a/oldstuff/scala/official-tutorial/FrenchDate.scala +++ /dev/null @@ -1,13 +0,0 @@ -import java.util.{Date, Locale} -import java.text.DateFormat -import java.text.DateFormat._ - -object FrenchDate { - def main(args: Array[String]) { - val now = new Date - val df = getDateInstance(LONG, Locale.FRANCE) - println(df format now) - } -} - -// vim: set ts=4 sw=4 et: diff --git a/oldstuff/scala/official-tutorial/HelloWorld.scala b/oldstuff/scala/official-tutorial/HelloWorld.scala deleted file mode 100644 index e54fe04..0000000 --- a/oldstuff/scala/official-tutorial/HelloWorld.scala +++ /dev/null @@ -1,7 +0,0 @@ -object HelloWorld { - def main(args: Array[String]) { - println("Hello, World!") - } -} - -// vim: set ts=4 sw=4 et: diff --git a/oldstuff/scala/official-tutorial/README b/oldstuff/scala/official-tutorial/README deleted file mode 100644 index 5d01bf8..0000000 --- a/oldstuff/scala/official-tutorial/README +++ /dev/null @@ -1 +0,0 @@ -Working through http://www.scala-lang.org/docu/files/ScalaTutorial.pdf diff --git a/oldstuff/scala/official-tutorial/Timer.scala b/oldstuff/scala/official-tutorial/Timer.scala deleted file mode 100644 index cb672f7..0000000 --- a/oldstuff/scala/official-tutorial/Timer.scala +++ /dev/null @@ -1,15 +0,0 @@ -object Timer { - def oncePerSecond(callback: () => Unit) { - while (true) { callback(); Thread sleep 1000 } - } - - def timeFlies() { - println("time flies like an arrow...") - } - - def main(args: Array[String]) { - oncePerSecond(timeFlies) - } -} - -// vim: set ts=4 sw=4 et: diff --git a/oldstuff/scala/sbt-guide/.env b/oldstuff/scala/sbt-guide/.env deleted file mode 100644 index 0bcb851..0000000 --- a/oldstuff/scala/sbt-guide/.env +++ /dev/null @@ -1 +0,0 @@ -PATH="$PWD/bin:$PATH" diff --git a/oldstuff/scala/sbt-guide/.gitignore b/oldstuff/scala/sbt-guide/.gitignore deleted file mode 100644 index f984205..0000000 --- a/oldstuff/scala/sbt-guide/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/bin/ -target/ diff --git a/oldstuff/scala/sbt-guide/hello/build.sbt b/oldstuff/scala/sbt-guide/hello/build.sbt deleted file mode 100644 index 4377055..0000000 --- a/oldstuff/scala/sbt-guide/hello/build.sbt +++ /dev/null @@ -1,5 +0,0 @@ -name := "hello" - -version := "1.0" - -scalaVersion := "2.9.1" diff --git a/oldstuff/scala/sbt-guide/hello/src/main/scala/hw.scala b/oldstuff/scala/sbt-guide/hello/src/main/scala/hw.scala deleted file mode 100644 index eff9213..0000000 --- a/oldstuff/scala/sbt-guide/hello/src/main/scala/hw.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Hi { - def main(args: Array[String]) = println("Hi") -} diff --git a/oldstuff/scala/sbt-guide/lib/.gitkeep b/oldstuff/scala/sbt-guide/lib/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/scala/sbt-guide/setup b/oldstuff/scala/sbt-guide/setup deleted file mode 100755 index 4032ce5..0000000 --- a/oldstuff/scala/sbt-guide/setup +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -e - -mkdir -p ./bin -pushd ./bin -curl -O 'https://raw.github.com/paulp/sbt-extras/master/sbt' -chmod +x sbt -popd -./bin/sbt -sbt-create about diff --git a/oldstuff/sclang-play/misc.sc b/oldstuff/sclang-play/misc.sc deleted file mode 100644 index 42d2d44..0000000 --- a/oldstuff/sclang-play/misc.sc +++ /dev/null @@ -1,41 +0,0 @@ -( - s.boot; -) - -( - s.stop; -) - -// modulate a sine frequency and a noise amplitude with another sine -// whose frequency depends on the horizontal mouse pointer position -( - { - var x = SinOsc.ar(MouseX.kr(1, 100)); - SinOsc.ar(300 * x + 800, 0, 0.1) + PinkNoise.ar(0.1 * x + 0.1) - }.play; -) - -// simple synth definition using the Atari2600 UGen: -( - SynthDef( - \atari2600, { - |out=0, gate=1, tone0=5, tone1=8, freq0=10, freq1=20, amp=1, pan=0| - var e, z; - e = EnvGen.kr(Env.asr(0.01, amp, 0.05), gate, doneAction: 2); - z = Atari2600.ar(tone0, tone1, freq0, freq1, 15, 15); - Out.ar(out, Pan2.ar(z * e, pan)); - }).add -) - -// and a pattern to play it: -( - Pbind( - \instrument, \atari2600, - \dur, Pseq([0.25, 0.25, 0.25, 0.45], inf), - \amp, 0.8, - \tone0, Pseq([Pseq([2, 5], 32), Pseq([3, 5], 32)], inf), - \tone1, 14, - \freq0, Pseq([Pbrown(28, 31, 1, 32), Pbrown(23, 26, 3, 32)], inf), - \freq1, Pseq([Pn(10, 16), Pn(11, 16)], inf) - ).play -) diff --git a/oldstuff/sclang-play/noisy.sc b/oldstuff/sclang-play/noisy.sc deleted file mode 100644 index 26cfefd..0000000 --- a/oldstuff/sclang-play/noisy.sc +++ /dev/null @@ -1,15 +0,0 @@ -( - s.boot; -) - -( - { - var freqCutoff = MouseX.kr(400, 2000); - var ampl = MouseY.kr(0.1, 1.5); - var out = LPF.ar( - WhiteNoise.ar(mul: ampl), - freq: freqCutoff - ); - [out, out] - }.scope -) diff --git a/oldstuff/sclang-play/oscfun.go b/oldstuff/sclang-play/oscfun.go deleted file mode 100644 index d0df19d..0000000 --- a/oldstuff/sclang-play/oscfun.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "fmt" - "net" - - "github.com/hypebeast/go-osc/osc" -) - -func main() { - // client := osc.NewClient("localhost", 9949) - msg := osc.NewMessage("/osc/address") - msg.Append(int32(111)) - msg.Append(true) - msg.Append("hello") - - fmt.Printf("Sending: %#v\n", msg) - // err := client.Send(msg) - err := sendTCP(msg) - if err != nil { - fmt.Printf("ERROR: %#v\n", err) - } -} - -func sendTCP(packet osc.Packet) error { - conn, err := net.Dial("tcp", "127.0.0.1:9949") - if err != nil { - return err - } - defer conn.Close() - - data, err := packet.ToByteArray() - if err != nil { - return err - } - - _, err = conn.Write(data) - if err != nil { - return err - } - - return nil -} diff --git a/oldstuff/sclang-play/oscfun.sc b/oldstuff/sclang-play/oscfun.sc deleted file mode 100644 index 4d7c5b8..0000000 --- a/oldstuff/sclang-play/oscfun.sc +++ /dev/null @@ -1,40 +0,0 @@ -( - n = NetAddr("127.0.0.1", 8765); - n.sendMsg("/good/news", "haaay"); -) - -( - f = { |msg, time, addr| - if((addr.port == 8765) && (msg[0] != '/status.reply'), { - "time: % sender: %\nmessage: %\n".postf(time, addr, msg); - }); - }; - thisProcess.addOSCRecvFunc(f); -) - -( - thisProcess.replaceOSCRecvFunc(f, f); -) - -( - thisProcess.removeOSCRecvFunc(f); -) - -( - thisProcess.openUDPPort(1121); -) - -( - thisProcess.stop; -) - -( - thisProcess.openPorts; -) - -( - // OSCFunc.trace(false); - s.quit; - s.boot; - // OSCFunc.trace(true); -) diff --git a/oldstuff/sclang-play/tut/ch01.sc b/oldstuff/sclang-play/tut/ch01.sc deleted file mode 100644 index ba815a4..0000000 --- a/oldstuff/sclang-play/tut/ch01.sc +++ /dev/null @@ -1,121 +0,0 @@ -( - s.boot; -) - -( - 2 + 2 -) - -( - "I am SuperCollider 3".speak -) - -( - { - Pan2.ar(SinOsc.ar(440, 0, 0.1), 0.0) - }.play; -) - -( - { - Pan2.ar(SinOsc.ar(MouseX.kr(440, 880), 0, 0.1), 0.0) - }.play; -) - -( - { - var n = 11; - - Resonz.ar( - Mix.fill(n, { - var freq = rrand(50, 560.3); - var numcps = rrand(2, 20); - - Pan2.ar( - Gendy1.ar( - 6.rand, 6.rand, 1.0.rand, 1.0.rand, freq, freq, - 1.0.rand, 1.0.rand, numcps, - SinOsc.kr(exprand(0.02, 0.2), 0, numcps/2, numcps/2), - 0.5/(n.sqrt) - ), - 1.0.rand2 - ) - }), - MouseX.kr(100, 2000), - MouseY.kr(0.1, 1.0) - ); - }.play -) - -( - { - Pan2.ar( - SinOsc.ar(440, 0, 0.1), - 0.0 - ) - }.play -) - -( - { - SinOsc.ar(440, 0, 0.1) + Pulse.ar(443, 0.6, 0.05) - }.play; -) - -( - if(4 == 4, { - if(3 == 3, { - "correct!".postln - }); - }); -) - -( - 2.postln; - - Post << [2, 3, 4, 5] << nl; -) - -( - var freq; - freq = rrand(300, 600); - - { - SinOsc.ar(freq, 0, 0.1) - }.play; -) - -// :boom: -( - { SinOsc.ar(nil) }.play -) - -// :boom: -( - Array.series(9, 0, 1) + nil -) - -( - "ls -l".unixCmd -) - -( - var p, l, d = ""; - p = Pipe.new("ls -l", "r"); - l = p.getLine; - while( - { l.notNil }, - { - d = d ++ l ++ "\n"; - l = p.getLine; - } - ); - p.close; - - Post << d << nl; - d[0..20] -) - -( - Array.browse -) diff --git a/oldstuff/sclang-play/tut/ch02.sc b/oldstuff/sclang-play/tut/ch02.sc deleted file mode 100644 index 6c0c844..0000000 --- a/oldstuff/sclang-play/tut/ch02.sc +++ /dev/null @@ -1,496 +0,0 @@ -( - s.boot; -) - -( - FreqScope.new; -) - -( - { - WhiteNoise.ar(0.1) - }.scope -) - -( - { - LPF.ar(WhiteNoise.ar(0.1), 1000) - }.scope -) - -( - { - HPF.ar(LPF.ar(WhiteNoise.ar(0.1), 1000), 1000) - }.scope -) - -( - { - LPF.ar(WhiteNoise.ar(0.1), Line.kr(10000, 1000, 10)) - }.scope -) - -( - { - Resonz.ar( - LFNoise0.ar(400), - 1000, - 0.1 - ) - }.scope -) - -( - { - Resonz.ar( - LFNoise0.ar(400), - Line.kr(10000, 1000, 10), - 0.1 - ) - }.scope -) - -( - { - var source, line, filter; - - source = LFNoise0.ar(400); - line = Line.kr(10000, 1000, 10); - filter = Resonz.ar(source, line, 0.1); - - filter - }.scope; -) - -( - { - SinOsc.ar - }.scope -) - -( - { - SinOsc.ar(400, 0, 0.1) + SinOsc.ar(660, 0, 0.1) - }.scope -) - -( - { - SinOsc.ar([400, 660], 0, 0.1) - }.scope -) - -( - { - Pan2.ar( - WhiteNoise.ar(0.1), - MouseX.kr(-1, 1) - ) - }.scope -) - -( - { - SinOsc.ar([400], 0, 0.1) - }.scope -) - -( - { - SinOsc.ar(400, 0, 0.1) - }.scope -) - -( - { - SinOsc.ar([400, 660, 870], 0, 0.1) - }.scope -) - -( - { - Mix( - SinOsc.ar([400, 660], 0, 0.1) - ) - }.scope -) - -( - { - Pan2.ar( - Mix( - SinOsc.ar([400, 660], 0, 0.1) - ), - MouseX.kr(-1, 1) - ) - }.scope -) - -// sawtooth wave -( - { - var n = 10; - var wave = Mix.fill(10, { |i| - var mult = ((-1) ** i) * (0.5 / ((i + 1))); - SinOsc.ar(440 * (i + 1)) * mult - }); - - Pan2.ar(wave / n, 0.0); - }.scope -) - -// square wave -( - { - var n = 10; - var wave = Mix.fill(10, { |i| - var harmonicnumber = 2 * i + 1; - SinOsc.ar(440 * harmonicnumber) / harmonicnumber - }) * 0.25; - - Pan2.ar(wave, 0.0); - }.scope -) - -// triangle wave -( - { - var n = 10; - var wave = Mix.fill(10, { |i| - var harmonicnumber = 2 * i + 1; - var mult = ((-1) ** ((harmonicnumber - 1)/2)) * (1.0/(harmonicnumber*harmonicnumber)); - SinOsc.ar(440 * i) * mult - })/n; - - Pan2.ar(wave, 0.0); - }.scope -) - -( - { - Mix( - SinOsc.ar(500 * [0.5, 1, 1.19, 1.56, 2.51, 2.66, 3.01, 4.1], 0, 0.1) - ) - }.scope -) - -( - { - Mix( - SinOsc.ar( - 500 * [0.5, 1, 1.19, 1.56, 2.51, 2.66, 3.01, 4.1], - 0, - 0.1 * [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1] - ) - ) - }.scope -) - -( - var n = 10; - - { - Mix(SinOsc.ar(250 * (1..n), 0, 1/n)) - }.scope -) - -// 2.2 - -( - { - SinOsc.ar(mul: 0.1) - }.scope -) - -( - { - SinOsc.ar(mul: 2.0) - }.scope -) - -( - { - SinOsc.ar(mul: 0.1) - }.scope -) - -( - { - SinOsc.ar( - mul: MouseY.kr(1.0, 0.1) - ) - }.scope -) - -( - { - SinOsc.ar( - mul: 0.1, add: MouseY.kr(0.9, -0.9) - ) - }.scope -) - -( - { - SinOsc.ar( - mul: MouseX.kr(0.1, 1.0), - add: MouseY.kr(0.9, -0.9) - ) - }.scope -) - -( - { - var cutoff = SinOsc.ar( - 1, - mul: MouseX.kr(0.0, 1700.0), - add: 2000.0 - ); - - LPF.ar( - WhiteNoise.ar, - freq: cutoff - ); - }.scope -) - -( - { - 0.1 * SinOsc.ar - }.scope -) - -( - { - SinOsc.ar(mul: 0.1) - }.scope -) - -( - { - 0.1 * SinOsc.ar + 0.5 - }.scope -) - -( - { - SinOsc.ar(mul: 0.1, add: 0.5) - }.scope -) - -( - { - var cutoff = SinOsc.ar(1) * 1700.0 + 2000.0; - LPF.ar(WhiteNoise.ar, freq: cutoff) - }.scope -) - -( - { - SinOsc.ar(440, 0.0, 0.1, 0.0) - }.scope -) - -( - { - SinOsc.ar(MouseX.kr(440, 880), 0.0, 0.1, 0.0) - }.scope -) - -( - { - SinOsc.ar(MouseX.kr(440, 880), mul: 0.1) - }.scope -) - -( - { - SinOsc.ar(440, mul: -20.dbamp) - }.scope -) - -( - { - SinOsc.ar( - 40 * SinOsc.ar(MouseX.kr(1, 20)) + 440, - 0, - 0.1 - ) - }.scope -) - -( - a = { - SinOsc.ar(440) * 0.1 - }.play; -) - -( - a.run(false); -) - -( - a.run; -) - -( - a.free; -) - -( - a = { - arg freq=440; - SinOsc.ar(freq) * 0.1 - }.play -) - -( - a = { - arg freq=440, amp=0.1; - SinOsc.ar(freq) * amp; - }.play -) - -( - a.set(\freq, rrand(220, 440), \amp, rrand(0.05, 0.2)); -) - -( - { - var carrier, modulator, carrfreq, modfreq; - - carrfreq = MouseX.kr(440, 5000, 'exponential'); - modfreq = MouseY.kr(1, 5000, 'exponential'); - - carrier = SinOsc.ar(carrfreq, 0, 0.5); - modulator = SinOsc.ar(modfreq, 0, 0.5); - - carrier * modulator; - }.scope -) - -( - { SinOsc.ar(440, 0, 0.5) }.scope -) - -( - { SinOsc.ar(440, 0, 0.5, 0.5) }.scope -) - -( - { - var carrier, modulator, carrfreq, modfreq; - - carrfreq = MouseX.kr(440, 5000, 'exponential'); - modfreq = MouseY.kr(1, 5000, 'exponential'); - - carrier = SinOsc.ar(carrfreq, 0, 0.5); - modulator = SinOsc.ar(modfreq, 0, 0.25, 0.25); - - carrier * modulator; - }.scope -) - -( - var w, carrfreqslider, modfreqslider, moddepthslider, synth; - - w = Window("frequency modulation", Rect(100, 400, 400, 300)); - w.view.decorator = FlowLayout(w.view.bounds); - - synth = { - arg carrfreq=440, modfreq=1, moddepth=0.1; - SinOsc.ar(carrfreq + (moddepth * SinOsc.ar(modfreq)), 0, 0.25) - }.scope; - - carrfreqslider = EZSlider( - w, 300@50, "carrfreq", - ControlSpec(20, 5000, 'exponential', 10, 440), - { |ez| synth.set(\carrfreq, ez.value) } - ); - w.view.decorator.nextLine; - - modfreqslider = EZSlider( - w, 300@50, "modfreq", - ControlSpec(1, 5000, 'exponential', 1, 1), - { |ez| synth.set(\modfreq, ez.value) } - ); - w.view.decorator.nextLine; - - moddepthslider = EZSlider( - w, 300@50, "moddepth", - ControlSpec(0.01, 5000, 'exponential', 0.01, 0.01), - { |ez| synth.set(\moddepth, ez.value) } - ); - - w.front; -) - -// 2.5 - -( - { - Mix(Saw.ar([440, 443, 437], 0.1)) - }.scope -) - -( - { - Mix( - Resonz.ar( - Saw.ar([440, 443, 437] + SinOsc.ar(100, 0, 100)), - XLine.kr(10000, 10, 10), - Line.kr(1, 0.05, 10), - mul: LFSaw.kr( - Line.kr(3, 17, 3), 0, 0.5, 0.5 - ) * Line.kr(1, 0, 10) - ) - ) - }.scope -) - -( - b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav"); -) - -( - { - var modfreq, modindex, modulator; - - modfreq = MouseX.kr(1, 4400, 'exponential'); - modindex = MouseY.kr(0.0, 10.0, 'linear'); - - modulator = SinOsc.kr(modfreq, 0, modfreq * modindex, 440); - - PlayBuf.ar(1, b, BufRateScale.kr(b) * (modulator/440), 1, 0, 1) - }.scope; -) - -( - var numpartials, spectrum, amplitudes, modfreqs1, modfreqs2, decaytimes; - - spectrum = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1]; - - amplitudes = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1]; - - numpartials = spectrum.size; - - modfreqs1 = Array.rand(numpartials, 1, 5.0); - - modfreqs2 = Array.rand(numpartials, 0.1, 3.0); - - decaytimes = Array.fill(numpartials, { |i| - rrand(2.5, 2.5 + (5 * (1.0 - (1/numpartials)))) - }); - - { - Mix.fill(spectrum.size, { arg i; - var amp, freq; - - freq = (spectrum[i] + (SinOsc.kr(modfreqs1[i], 0, 0.005))) * 500; - amp = 0.1 * Line.kr(1, 0, decaytimes[i]) * - (SinOsc.ar(modfreqs2[i], 0, 0.1, 0.9) * amplitudes[i]); - - Pan2.ar(SinOsc.ar(freq, 0, amp), 1.0.rand2) } - ) - }.scope -) diff --git a/oldstuff/sclang-play/tut/ch03.sc b/oldstuff/sclang-play/tut/ch03.sc deleted file mode 100644 index 9474bcb..0000000 --- a/oldstuff/sclang-play/tut/ch03.sc +++ /dev/null @@ -1,300 +0,0 @@ -( - s.boot; -) - -( - FreqScope.new; -) - -( - {SinOsc.ar(440, 0, 0.1)}.scope -) - -( - {SinOsc.ar(440, 0, Line.kr(0.1, 0.0, 1.0))}.scope -) - -( - {SinOsc.ar(440, 0, Line.kr(0.1, 0, 1, doneAction: 2))}.scope -) - -( - Env([1, 0, 1], [1, 1]).plot -) - -( - Env([0, 1, 0], [1.0, 0.5]).plot -) - -( - Env.linen(0.03, 0.5, 0.1).plot -) - -( - Env.adsr(0.01, 0.5, 0.5, 0.1, 1.0, 0).plot -) - -( - Env.perc(0.05, 0.5, 1.0, 0).plot -) - -( - Env([1, 0], [1.0]).plot -) - -( - {EnvGen.ar(Env([1, 0], [1.0]))}.scope -) - -( - {SinOsc.ar(440, 0, 0.1) * EnvGen.kr(Env([1, 0], [1.0]))}.scope -) - -( - Env([1000, 20], [1.0]).plot -) - -( - {Saw.ar(EnvGen.ar(Env([1000, 20], [1.0])), 0.1)}.scope -) - -( - { - Saw.ar( - EnvGen.ar(Env([1000, 20], [0.5])), - EnvGen.ar(Env([0.1, 0], [2.0])) - ) - }.scope -) - -( - { - Saw.ar( - EnvGen.kr(Env([1000, 20], [0.5])), - EnvGen.kr(Env([0.1, 0], [2.0])) - ) - }.play -) - -( - { - SinOsc.ar( - SinOsc.ar(10, 0, 10, 440), - 0.0, - EnvGen.kr(Env([0.5, 0.0], [1.0]), doneAction: 2) - ) - }.scope -) - -( - { - Saw.ar( - EnvGen.kr(Env([500, 100], [1.0]), doneAction: 2), - 0.1 - ) - }.scope -) - -( - { - Saw.ar( - SinOsc.ar(1, 0, 10, 440), - Line.kr(0, 1, 1, doneAction: 2) - ) - }.scope -) - -( - { - Saw.ar( - SinOsc.ar(1, 0, 10, 440), - XLine.kr(0.0001, 1, 1, doneAction: 2) - ) - }.scope -) - -( - { - EnvGen.ar( - Env([0, 0.1, 0], [0.1, 0.9]), doneAction: 2 - ) * SinOsc.ar(330) - }.scope -) - -( - a = { - EnvGen.ar( - Env.asr(0.1, 0.1, 1.0), doneAction: 2 - ) * SinOsc.ar(330) - }.play -) - -( - a.release(2.0); -) - -( - a = { - arg gate=1; - - EnvGen.ar( - Env.asr(0.1, 0.1, 0.9), gate, doneAction: 2 - ) * SinOsc.ar(330) - }.play -) - -( - a.set(\gate, 0) -) - -( - e = Env([0.2, 1.0, 0.0], [0.1, 3.0], 0, 1); - - a = { - arg gate=1; - - EnvGen.ar( - e, gate, doneAction: 2 - ) * SinOsc.ar(550, 0, 0.1) - }.play -) - -( - a.set(\gate, 0); -) - -( - e = Env([0.0, 0.0, 1.0, 0.0], [0.5, 1.0, 2.0], 0, 2, 0); - - a = { - arg gate=1; - - EnvGen.ar( - e, gate, doneAction: 2 - ) * SinOsc.ar(550, 0, 0.1) - }.play -) - -( - a.set(\gate, 0); -) - -( - e = Env( - [0.0, 1.0, -1.0, 0.0], - [0.01, 0.01, 2.0], - 0, - 2, // releaseNode - 0 // loopNode - ); - - e.plot; - - a = { - arg gate=1; - - EnvGen.ar( - e, gate, timeScale: MouseX.kr(0.1, 2.0), doneAction: 2 - ) - }.play -) - -( - a.set(\gate, 0); -) - -( - SynthDef(\sine, - { - Out.ar( - 0, SinOsc.ar( - Rand(440, 880), 0, 0.1 - ) - ) - } - ).add; -) - -( - Synth(\sine); -) - -( - a = Synth(\sine); - a.writeDefFile("synth.out"); -) - -( - SynthDef(\sine, { - arg freq=440, amp=0.1; - Out.ar( - 0, - SinOsc.ar(freq, 0, amp) - ) - }).add; -) - -( - Synth("sine"); - Synth("sine", [\freq, 880]) -) - -( - a = Synth(\sine); - b = Synth(\sine, [\freq, 550]); - c = Synth(\sine, [\freq, 660, \amp, 0.5]); -) - -( - c.set(\freq, 1000); - b.set(\amp, 0.3, \freq, 100); -) - -( - a.free; - b.free; - c.free; -) - -( - SynthDef(\hum, { - arg freq=440; - var finaloutput = Mix( - [ - SinOsc.ar(freq, 0, 0.3), - SinOsc.ar(freq*2, 0, 0.2), - SinOsc.ar(freq*3, 0, 0.1), - SinOsc.ar(freq*3.33, 0, 0.01), - SinOsc.ar(freq*4, 0, 0.1), - SinOsc.ar(freq*4.5, 0, 0.01), - SinOsc.ar(freq*4.75, 0, 0.02) - ] - ); - Out.ar(0, finaloutput); - }).add; -) - -( - Synth(\hum, [\freq, 220]); -) - -( - Synth(\hum, [\freq, 880]); -) - -( - Synth(\hum, [\freq, 440]); -) - -( - SynthDescLib.global.synthDescs[\sine].def.func.postcs -) - -( - SynthDescLib.global.synthDescs.do { |desc| - if(desc.def.notNil) { - "\nSynthDef %\n".postf(desc.name.asCompileString); - desc.def.func.postcs; - }; - } -) diff --git a/oldstuff/sclang-play/tutorial.sc b/oldstuff/sclang-play/tutorial.sc deleted file mode 100644 index f7ec91c..0000000 --- a/oldstuff/sclang-play/tutorial.sc +++ /dev/null @@ -1,919 +0,0 @@ -( - s.boot; -) - -( - s.reboot; -) - -( - s.quit; -) - -( - s.scope; -) - -( - { - var pitchOsc; - var ampOsc; - pitchOsc = { 300 + SinOsc.kr(0.1, 1.5pi, 20, 20); }; - ampOsc = SinOsc.kr(0.5, 1.5pi, 1.0, 1.0); - SinOsc.ar([pitchOsc, pitchOsc], 0, ampOsc); - }.play; -) - -( - { [SinOsc.ar(440, 0, 0.2), SinOsc.ar(442, 0, 0.2)] }.play; -) - -( - { - var freq; - freq = [[600, 880], [400, 660], 1320, 880].choose; - SinOsc.ar(freq, 0, 0.2); - }.play; -) - -( - { - Pan2.ar(PinkNoise.ar(0.2), SinOsc.kr(0.5)); - }.play; -) - -( - { - Pan2.ar(SinOsc.ar(440, 0, 0.2), SinOsc.kr(0.5)); - }.play; -) - -( - { - Pan2.ar(PinkNoise.ar(0.2), -0.3); - }.play; -) - -( - { - PinkNoise.ar(0.2) + SinOsc.ar([440, 442], 0, 0.2) + Saw.ar([660, 662], 0.2); - }.play; -) - -( - { - var a, b; - a = [ - SinOsc.ar(440, 0, 0.2), - Saw.ar(662, 0.2) - ]; - b = [ - SinOsc.ar(442, 0, 0.2), - Saw.ar(660, 0.2) - ]; - - Mix([a, b]).postln; - }.play; -) - -( - var n = 8; - { - Mix.fill(n, { SinOsc.ar([220, 500 + 500.0.rand], 0, 1 / n) }); - }.play; -) - -( - var n = 8; - { - Mix.fill(n, { |index| - var freq; - index.postln; - freq = 440 + index; - freq.postln; - SinOsc.ar(freq, 0, 1 / n) - }); - }.play; -) - -( - { - PinkNoise.ar(0.2) + SinOsc.ar(440, 0, 0.2) + Saw.ar(660, 0.2) - }.plot; -) - -( - { - PinkNoise.ar(0.2) + SinOsc.ar(440, 0, 0.2) + Saw.ar(660, 0.2) - }.plot(1); -) - -( - { - PinkNoise.ar(0.2) + SinOsc.ar(440, 0, 0.2) + Saw.ar(660, 0.2) - }.scope; -) - -( - { - [ - SinOsc.ar(440, 0, 0.2), - SinOsc.ar(442, 0, 0.2) - ] - }.scope; -) - -( - { - [ - SinOsc.ar(440, 0, 0.2), - SinOsc.ar(442, 0, 0.2) - ] - }.scope(zoom: 10); -) - -( - SynthDef.new( - "tutorial-SinOsc", - { - Out.ar(0, SinOsc.ar(440, 0, 0.2)) - } - ).play; -) - -( - SynthDef.new( - "tutorial-SinOsc-stereo", - { - var outArray; - outArray = [ - SinOsc.ar(440, 0, 0.2), - SinOsc.ar(442, 0, 0.2) - ]; - Out.ar(0, outArray) - } - ).play; -) - -( - x = { SinOsc.ar(660, 0, 0.2) }.play; - y = SynthDef.new( - "tutorial-SinOsc", - { - Out.ar(0, SinOsc.ar(440, 0, 0.2)) - } - ).play; -) - -( - x.free; - y.free; -) - - -( - SynthDef.new( - "tutorial-PinkNoise", - { - Out.ar(0, PinkNoise.ar(0.3)) - } - ).add; - - x = Synth.new("tutorial-PinkNoise"); - y = Synth.new("tutorial-PinkNoise"); -) - -( - f = { - SinOsc.ar(440 + 200.rand, 0, 0.2) - }; - x = f.play; - y = f.play; - z = f.play; -) - -( - SynthDef( - "tutorial-NoRand", - { - Out.ar(0, SinOsc.ar(440 + 200.rand, 0, 0.2)) - } - ).add; - x = Synth("tutorial-NoRand"); - y = Synth("tutorial-NoRand"); - z = Synth("tutorial-NoRand"); -) - -( - SynthDef( - "tutorial-Rand", - { - Out.ar(0, SinOsc.ar(Rand(440, 660), 0, 0.2)) - } - ).add; - x = Synth("tutorial-Rand"); - y = Synth("tutorial-Rand"); - z = Synth("tutorial-Rand"); -) - -( - SynthDef( - "tutorial-args", - { - |freq = 440, out = 0| - Out.ar(out, SinOsc.ar(freq, 0, 0.2)) - } - ).add; - Task({ - x = Synth("tutorial-args"); - 1.wait; - y = Synth("tutorial-args", ["freq", 660]); - 1.wait; - z = Synth("tutorial-args", ["freq", 880, "out", 1]); - 1.wait; - //x.free; y.free; z.free; - }).play; -) - -( - SynthDef.new( - \tutorialargs, - { - |freq = 440, out = 0| - Out.ar(out, SinOsc.ar(freq, 0, 0.2)); - } - ).add; - Task({ - x = Synth(\tutorialargs); - 1.wait; - x.set(\freq, 660); - 1.wait; - x.set(\freq, 880, \out, 1); - 1.wait; - //x.free; - }).play; -) - -( - In.ar(0, 1); - In.ar(0, 4); -) - -( - { - Out.ar(0, SinOsc.kr) - }.play; -) - -( - { - Out.kr(0, SinOsc.ar) - }.scope; -) - -( - SynthDef( - "tutorial-args", - { - |freq = 440, out = 0| - Out.ar(out, SinOsc.ar(freq, 0, 0.2)); - } - ).add; - - x = Synth("tutorial-args", ["out", 1, "freq", 660]); - y = Synth("tutorial-args", ["out", 1, "freq", 770]); -) - -( - b = Bus.control(s, 2); - c = Bus.audio(s); -) - -( - b = Bus.control(s, 2); - b.index.postln; - b.numChannels.postln; - - c = Bus.control(s); - c.index.postln; - c.numChannels.postln; -) - -( - SynthDef( - "tutorial-Infreq", - { - |bus, freqOffset = 0| - Out.ar(0, SinOsc.ar(In.kr(bus) + freqOffset, 0, 0.5)); - } - ).add; - - SynthDef( - "tutorial-Outfreq", - { - |freq = 400, bus| - Out.kr(bus, SinOsc.kr(1, 0, freq/40, freq)); - } - ).add; - - b = Bus.control(s, 1); - - x = Synth("tutorial-Outfreq", [\bus, b]); - y = Synth.after(x, "tutorial-Infreq", [\bus, b]); - z = Synth.after(x, "tutorial-Infreq", [\bus, b, \freqOffset, 200]); -) - -( - SynthDef( - "tutorial-DecayPink", - { - |outBus = 0, effectBus, direct = 0.5| - var source; - source = Decay2.ar(Impulse.ar(1, 0.25), 0.01, 0.2, PinkNoise.ar); - Out.ar(outBus, source * direct); - Out.ar(effectBus, source * (1 - direct)); - } - ).add; - - SynthDef( - "tutorial-DecaySin", - { - |outBus = 0, effectBus, direct = 0.5| - var source; - source = Decay2.ar( - Impulse.ar(1, 0.25), - 0.3, - 1, - SinOsc.ar( - SinOsc.kr(0.2, 0, 110, 440) - ) - ); - - Out.ar(outBus, source * direct); - Out.ar(effectBus, source * (1 - direct)); - } - ).add; - - SynthDef( - "tutorial-Reverb", - { - |outBus = 0, inBus| - var input; - - input = In.ar(inBus, 1); - - 16.do({ - input = AllpassC.ar( - input, - 0.04, - { - Rand(0.001, 0.04); - }.dup, - 3 - ) - }); - - Out.ar(outBus, input); - } - ).add; - - b = Bus.audio(s, 1); - - x = Synth("tutorial-Reverb", [\inBus, b]); - y = Synth.before(x, "tutorial-DecayPink", [\effectBus, b]); - z = Synth.before(x, "tutorial-DecaySin", [\effectBus, b, \outBus, 1]); - - y.set(\direct, 1); - z.set(\direct, 1); - y.set(\direct, 0); - z.set(\direct, 0); -) - -( - b = Bus.control(s, 1); - b.set(880); - - c = Bus.control(s, 1); - c.set(884); - - x = SynthDef( - "tutorial-map", - { - |freq1 = 440, freq2 = 440| - Out.ar(0, SinOsc.ar([freq1, freq2], 0, 0.2)); - } - ).play(s); - - // x.map(\freq1, b, \freq2, c); - - /* - y = { - Out.kr(b, SinOsc.kr(1, 0, 50, 880)); - }.play(addAction: \addToHead); - */ - - // y.free; - - // b.get({ |val| val.postln; f = val; }); - - // x.set(\freq2, f / 2); - - // c.set(200); - - // x.free; - // b.free; - // c.free; -) - -( - SynthDef( - \tutorial_DecaySin2, - { - |outBus = 0, effectBus, direct = 0.5, freq = 440| - var source; - source = Pan2.ar( - Decay2.ar( - Impulse.ar( - Rand(0.3, 1), - 0, - 0.125 - ), - 0.3, - 1, - SinOsc.ar( - SinOsc.kr(0.2, 0, 110, freq) - ) - ), - Rand(-1.0, 1.0) - ); - Out.ar(outBus, source * direct); - Out.ar(effectBus, source * (1 - direct)); - } - ).add; - - SynthDef( - \tutorial_Reverb2, - { - |outBus = 0, inBus| - var input; - input = In.ar(inBus, 2); - 16.do({ - input = AllpassC.ar(input, 0.04, Rand(0.001, 0.04), 3) - }); - Out.ar(outBus, input); - } - ).add; - - ~sources = Group.new; - ~effects = Group.after(~sources); - ~bus = Bus.audio(s, 2); - - x = Synth( - \tutorial_Reverb2, - [\inBus, b], - ~effects - ); - - y = Synth( - \tutorial_DecaySin2, - [\effectBus, ~bus, \outBus, 0], - ~sources - ); - - z = Synth( - \tutorial_DecaySin2, - [\effectBus, ~bus, \outBus, 0, \freq, 660], - ~sources - ); - - /* - ~sources.free; - ~effects.free; - ~bus.free; - - currentEnvironment.clear; - */ -) - -( - g = Group.new; - h = Group.head(g); - x = Synth.tail(h, \default); - s.queryAllNodes; -) - -( - Server.default.boot; - a = Synth.new(\default); - a.group; -) - -( - { - SinOsc.ar(mul: 0.2) - }.scope(1); - - s.queryAllNodes; -) - -( - g = Group.new; - - 4.do({ - { - |amp = 0.1| - Pan2.ar( - SinOsc.ar(440 + 110.rand, 0, amp), - 1.0.rand2 - ) - }.play(g); - }); - - g.set(\amp, 0.005); - // g.free; -) - -( - "--- haaaay ---".postln; - Group.superclass.postln; - // Group.superclass.help; - Group.findRespondingMethodFor('set').postln; - Group.findRespondingMethodFor('postln').postln; - // Group.findHelpForMethod('postln'); -) - -( - b = Buffer.alloc(s, 100, 2); - b.free; -) - -( - b = Buffer.alloc(s, s.sampleRate * 8.0, 2); - b.free; -) - -( - b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav"); - - x = SynthDef( - "tutorial-PlayBuf", - { - |out = 0, bufnum| - Out.ar(out, - PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum)) - ) - } - ).play(s, [\bufnum, b]); - - // x.free; - // b.free; -) - -( - SynthDef( - "tutorial-Buffer-cue", - { - |out = 0, bufnum| - Out.ar(out, DiskIn.ar(1, bufnum)) - } - ).add; -) - -( - b = Buffer.cueSoundFile( - s, - Platform.resourceDir +/+ "sounds/a11wlk01-44_1.aiff", - 0, - 1 - ); - - y = Synth.new("tutorial-Buffer-cue", [\bufnum, b], s); - - b.free; - y.free; -) - -( - b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav"); - b.bufnum.postln; - b.numFrames.postln; - b.numChannels.postln; - b.sampleRate.postln; - b.free.postln; -) - -( - b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav", action: { |buffer| - ("numFrames after update:" + buffer.numFrames).postln; - x = { - PlayBuf.ar(1, buffer, BufRateScale.kr(buffer)) - }.play; - }); - - ("numFrames before update:" + b.numFrames).postln; - - // x.free; b.free; -) - -( - b = Buffer.alloc(s, s.sampleRate * 5, 1); - - x = SynthDef( - "tutorial-RecordBuf", - { - |out = 0, bufnum = 0| - var noise; - noise = PinkNoise.ar(0.3); - RecordBuf.ar(noise, bufnum); - } - ).play(s, [\out, 0, \bufnum, b]); -) - -( - x.free; -) - -( - SynthDef( - "tutorial-Playback", - { - |out = 0, bufnum = 0| - var playbuf; - playbuf = PlayBuf.ar(1, bufnum); - FreeSelfWhenDone.kr(playbuf); - Out.ar(out, playbuf); - } - ).play(s, [\out, 0, \bufnum, b]); -) - -( - b.free; -) - -( - Date.getDate.postln; - b = Buffer.alloc(s, 8, 1); - b.updateInfo({ - |buf| - buf.set(7, 0.5); - buf.get(7, { |msg| msg.postln }); - }); -) - -( - b.free; -) - -( - var nFrames = 16; - - Buffer.alloc(s, nFrames).updateInfo({ - |b| - Task.new({ - 0.01.wait; - b.setn(0, [1, 2, 3]); - b.getn(0, 3, { |msg| ("1: "+ msg).postln }); - 0.01.wait; - b.setn(0, Array.fill(nFrames, { 1.0.rand })); - b.getn(0, nFrames, { - |msg| - ("2: " + msg).postln; - "3: buh bye".postln; - b.free - }); - }).play; - }); -) - -( - v = FloatArray.fill(44100, { 1.0.rand2 }); - b = Buffer.alloc(s, 44100); -) - -( - b.loadCollection(v, action: { - |buf| - x = { - PlayBuf.ar(buf.numChannels, buf, BufRateScale.kr(buf), loop: 1) * 0.2; - }.play; - }); -) - -( - x.free; -) - -( - b.loadToFloatArray(0, -1, { |floatArray| (floatArray == v).postln; }); - b.free; -) - -( - b.free; -) - -( - b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav"); - b.updateInfo({ - |b| - x = b.play(true); - SystemClock.sched(5, { x.free; b.free; }); - }); - // b.play; -) - -( - b = Buffer.alloc(s, 512, 1); - b.cheby([1, 0, 1, 1, 0, 1]); - - x = play({ - Shaper.ar( - b, - SinOsc.ar(300, 0, Line.kr(0, 1, 6)), - 0.5 - ) - }); - - SystemClock.sched(10, { x.free; b.free; }); -) - -( - SystemClock.sched(5, { "hello".postln }); -) - -( - var timeNow = TempoClock.default.beats; - "Time is now: ".post; - timeNow.postln; - "Scheduling for: ".post; - (timeNow + 5).postln; - TempoClock.default.schedAbs(timeNow + 5, - { "Time is later: ".post; thisThread.clock.beats.postln; nil } - ); -) - -( - var timeNow; - "------------------------------------".postln; - TempoClock.default.tempo = 2; - timeNow = TempoClock.default.beats; - "Time is now: ".post; - timeNow.postln; - "Scheduling for: ".post; - (timeNow + 5).postln; - TempoClock.default.schedAbs(timeNow + 5, - { "Time is later: ".post; thisThread.clock.beats.postln; nil } - ); -) - -( - "SystemClock.beats: ".post; SystemClock.beats.postln; - "TempoClock.default.beats: ".post; TempoClock.default.beats.postln; - "AppClock.beats: ".post; AppClock.beats.postln; - Task({ - "thisThread.clock.beats: ".post; thisThread.clock.beats.postln; - }).play; -) - -( - TempoClock.default.sched(5, { "hello".postln; nil; }); -) - -( - r = Routine({ - "abcde".yield; - "fghij".yield; - "klmno".yield; - "pqrst".yield; - "uvwxy".yield; - "z{|}~".yield; - }); - r.next; - 6.do({ r.next.postln; }); -) - -( - r = Routine({ - var delta; - loop { - delta = rrand(1, 3) * 0.5; - "Will wait ".post; delta.postln; - delta.yield; - } - }); - - r.next; - - TempoClock.default.sched(0, r); -) - -( - r.stop; -) - -( - SystemClock.sched(1, { 20.do({ "".postln; }) }); -) - -// {------------------------------------------------------------------------- -( - SynthDef( - \singrain, - { - |freq = 440, amp = 0.2, sustain = 1| - - var sig = SinOsc.ar( - freq, 0, amp - ) * EnvGen.kr( - Env.perc(0.01, sustain), doneAction: 2 - ); - - Out.ar(0, sig ! 2); - } - ).add; - - r = Routine({ - var delta; - loop { - delta = rrand(1, 3) * 0.5; - Synth( - \singrain, - [ - freq: exprand(200, 800), - amp: rrand(0.1, 0.5), - sustain: delta * 0.8 - ] - ); - delta.yield; - } - }); -) - -( - "starting routine".postln; - r.play; -) - -( - "stopping routine".postln; - r.stop; -) -// }------------------------------------------------------------------------- - - -// {------------------------------------------------------------------------- -( - t = Task({ - loop { - [60, 62, 64, 65, 67, 69, 71, 72].do({ - |midi| - Synth( - \singrain, - [ - freq: midi.midicps, - amp: 0.2, - sustain: 0.2 - ] - ); - 0.125.wait; - }); - } - }).play; -) - -( - t.stop; -) -// }------------------------------------------------------------------------- - - -// {------------------------------------------------------------------------- -( - f = { - Task({ - loop { - [60, 62, 64, 65, 67, 69, 71, 72].do({ - |midi| - Synth( - \singrain, - [ - freq: midi.midicps, - amp: 0.2, - sustain: 0.1 - ] - ); - 0.25.wait; - }); - } - }); - }; - - t = f.value.play(quant: 4); - u = f.value.play(quant: [4, 0.5]); -) - -( - t.stop; - u.stop; -) -// }------------------------------------------------------------------------- diff --git a/oldstuff/selinux/.vagrant-provision-as-vagrant.sh b/oldstuff/selinux/.vagrant-provision-as-vagrant.sh deleted file mode 100644 index 28a9e33..0000000 --- a/oldstuff/selinux/.vagrant-provision-as-vagrant.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -for f in $(find /vagrant/.vagrant-skel -type f) ; do - ln -svf $f /home/vagrant/${f##/vagrant/.vagrant-skel/} -done diff --git a/oldstuff/selinux/.vagrant-provision.sh b/oldstuff/selinux/.vagrant-provision.sh deleted file mode 100644 index ec8ef82..0000000 --- a/oldstuff/selinux/.vagrant-provision.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -ex - -if [[ ! -e /vagrant/wipe ]] ; then - exit 0 -fi - -/vagrant/base-box-wipe.sh diff --git a/oldstuff/selinux/.vagrant-skel/.bashrc b/oldstuff/selinux/.vagrant-skel/.bashrc deleted file mode 100644 index 1379a4d..0000000 --- a/oldstuff/selinux/.vagrant-skel/.bashrc +++ /dev/null @@ -1,5 +0,0 @@ -export DEVROOT=/vagrant -export POLICY_LOCATION=${DEVROOT}/centralized/hardened-refpolicy - -[[ $PS1 ]] && cd $DEVROOT -[[ -e $DEVROOT/bin/functions.sh ]] && source $DEVROOT/bin/functions.sh diff --git a/oldstuff/selinux/Vagrantfile b/oldstuff/selinux/Vagrantfile deleted file mode 100644 index ae92408..0000000 --- a/oldstuff/selinux/Vagrantfile +++ /dev/null @@ -1,11 +0,0 @@ -Vagrant.configure('2') do |config| - config.vm.box = 'meatballhat/gentoo-hardened' - config.vm.box_version = '>= 0.1.2' - config.vm.provision 'shell', path: '.vagrant-provision.sh' - config.vm.provision 'shell', path: '.vagrant-provision-as-vagrant.sh', privileged: false - - config.vm.provider 'virtualbox' do |vbox| - vbox.cpus = 4 - vbox.memory = 2048 - end -end diff --git a/oldstuff/selinux/base-box-wipe.sh b/oldstuff/selinux/base-box-wipe.sh deleted file mode 100644 index 91f1cb7..0000000 --- a/oldstuff/selinux/base-box-wipe.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -set -ex - -rm -rf /usr/portage /usr/src /tmp/* /var/tmp/* - -dd if=/dev/zero of=/EMPTY bs=1M || true -rm -f /EMPTY - -unset HISTFILE -rm -f /root/.bash_history -rm -f /home/vagrant/.bash_history - -find /var/log -type f | while read f; do echo -ne '' > $f; done - -count=`df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}'` -let count-- -dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count || true -rm /tmp/whitespace - -count=`df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}'` -let count-- -dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count || true -rm /boot/whitespace - -swappart=`cat /proc/swaps | tail -n1 | awk -F ' ' '{print $1}'` -swapoff $swappart -dd if=/dev/zero of=$swappart || true -mkswap $swappart -swapon $swappart diff --git a/oldstuff/selinux/bin/functions.sh b/oldstuff/selinux/bin/functions.sh deleted file mode 100644 index 1c38b52..0000000 --- a/oldstuff/selinux/bin/functions.sh +++ /dev/null @@ -1,81 +0,0 @@ -# sefindif - Find interface definitions that have a string that matches the -# given regular expression -sefindif() { - REGEXP="$1"; - if [ -d ${POLICY_LOCATION}/policy/modules ]; - then - pushd ${POLICY_LOCATION}/policy/modules > /dev/null 2>&1; - elif [ -d ${POLICY_LOCATION}/include ]; - then - pushd ${POLICY_LOCATION}/include > /dev/null 2>&1; - else - echo "Variable POLICY_LOCATION is not properly defined."; - return 1; - fi - for FILE in */*.if; - do - awk "BEGIN { P=1 } /(interface\(|template\()/ { NAME=\$0; P=0 }; /${REGEXP}/ { if (P==0) {P=1; print NAME}; if (NAME!=\$0) print };" ${FILE} | sed -e "s:^:${FILE}\: :g"; - done - popd > /dev/null 2>&1; -} - -# seshowif - Show the interface definition -seshowif() { - INTERFACE="$1"; - if [ -d ${POLICY_LOCATION}/policy/modules ]; - then - pushd ${POLICY_LOCATION}/policy/modules > /dev/null 2>&1; - elif [ -d ${POLICY_LOCATION}/include ]; - then - pushd ${POLICY_LOCATION}/include > /dev/null 2>&1; - else - echo "Variable POLICY_LOCATION is not properly defined."; - return 1; - fi - for FILE in */*.if; - do - grep -A 9999 "\(interface(\`${INTERFACE}'\|template(\`${INTERFACE}'\)" ${FILE} | grep -B 9999 -m 1 "^')"; - done - popd > /dev/null 2>&1; -} - -# sefinddef - Find macro definitions that have a string that matches the given -# regular expression -sefinddef() { - REGEXP="$1"; - if [ -d ${POLICY_LOCATION}/policy/support ]; - then - pushd ${POLICY_LOCATION}/policy/support > /dev/null 2>&1; - elif [ -d ${POLICY_LOCATION}/include/support ]; - then - pushd ${POLICY_LOCATION}/include/support > /dev/null 2>&1; - else - echo "Variable POLICY_LOCATION is not properly defined."; - return 1; - fi - for FILE in *; - do - awk "BEGIN { P=1; } /(define\(\`[^\`]*\`$)/ { NAME=\$0; P=0 }; /${REGEXP}/ { if (P==0) {P=1; print NAME}; if (NAME!=\$0) print };" ${FILE}; - done - popd > /dev/null 2>&1; -} - -# seshowdef - Show the macro definition -seshowdef() { - MACRONAME="$1"; - if [ -d ${POLICY_LOCATION}/policy/support ]; - then - pushd ${POLICY_LOCATION}/policy/support > /dev/null 2>&1; - elif [ -d ${POLICY_LOCATION}/include/support ]; - then - pushd ${POLICY_LOCATION}/include/support > /dev/null 2>&1; - else - echo "Variable POLICY_LOCATION is not properly defined."; - return 1; - fi - for FILE in *.spt; - do - grep -A 9999 "define(\`${MACRONAME}'" ${FILE} | grep -B 999 -m 1 "')"; - done - popd > /dev/null 2>&1; -} diff --git a/oldstuff/sltcpsrv/LICENSE b/oldstuff/sltcpsrv/LICENSE deleted file mode 100644 index cea092f..0000000 --- a/oldstuff/sltcpsrv/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Dan Buch - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/oldstuff/sltcpsrv/Makefile b/oldstuff/sltcpsrv/Makefile deleted file mode 100644 index 9a8d0a7..0000000 --- a/oldstuff/sltcpsrv/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -LIBS := \ - github.com/meatballhat/box-o-sand/sltcpsrv -TARGETS := \ - $(LIBS) \ - github.com/meatballhat/box-o-sand/sltcpsrv/syslog-tcp-server - -all: build test - -build: deps - go install -x $(TARGETS) - -test: - go test -x -v $(LIBS) - -deps: - go get -x $(TARGETS) - -.PHONY: all build deps test diff --git a/oldstuff/sltcpsrv/README b/oldstuff/sltcpsrv/README deleted file mode 100644 index ae3e732..0000000 --- a/oldstuff/sltcpsrv/README +++ /dev/null @@ -1,8 +0,0 @@ -Syslog TCP Server ------------------ - -This is a TCP server that (hopefully) knows how to consume Syslog messages. - -Notable bits: - - https://tools.ietf.org/rfc/rfc5424.txt - - https://tools.ietf.org/rfc/rfc6587.txt diff --git a/oldstuff/sltcpsrv/doc.go b/oldstuff/sltcpsrv/doc.go deleted file mode 100644 index 571cd19..0000000 --- a/oldstuff/sltcpsrv/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Syslog TCP Server -package sltcpsrv diff --git a/oldstuff/sltcpsrv/message.go b/oldstuff/sltcpsrv/message.go deleted file mode 100644 index 9801b9c..0000000 --- a/oldstuff/sltcpsrv/message.go +++ /dev/null @@ -1,140 +0,0 @@ -package sltcpsrv - -import ( - "fmt" - "log" - "strconv" - "strings" -) - -type message struct { - pri uint8 - version int - timestamp string - hostname string - appName string - pid int - body string -} - -func newMessage(line []byte) *message { - if len(line) == 0 { - return nil - } - - msg := &message{ - version: -1, - pid: -1, - } - - in := "" - accum := []byte{} - everythingElse := "" - - n := len(line) - for i, b := range line { - if *isDebug { - log.Printf("in = %q, accum = %q\n", in, string(accum)) - } - - if i == 0 && b == '<' { - in = "pri" - continue - } - - if in == "pri" { - if b == '>' { - in = "pridone" - - pri, err := strconv.ParseUint(string(accum), 10, 8) - if err != nil { - if *isDebug { - log.Println("ERROR:", err) - } - return msg - } - - msg.pri = uint8(pri) - accum = []byte{} - continue - } else { - accum = append(accum, b) - continue - } - } - - if in == "pridone" { - in = "everything_else" - accum = append(accum, b) - continue - } - - if in == "everything_else" { - if i == n-1 { - accum = append(accum, b) - everythingElse = string(accum) - break - } - - accum = append(accum, b) - continue - } - } - - dateParts := []string{} - - broken := strings.SplitN(everythingElse, ":", 4) - if len(broken) != 4 { - if *isDebug { - log.Printf("ERROR: got back unexpected parts for %q: %+v\n", everythingElse, broken) - } - return msg - } - - verMonthDateHour := strings.Split(broken[0], " ") - minutes := broken[1] - secsHostProc := strings.Split(broken[2], " ") - msg.body = string(broken[3]) - - hour := "" - - switch len(verMonthDateHour) { - case 4: - v, err := strconv.ParseUint(verMonthDateHour[0], 10, 8) - if err != nil { - if *isDebug { - log.Println("ERROR:", err) - } - } else { - msg.version = int(v) - } - - dateParts = append(dateParts, verMonthDateHour[1:3]...) - hour = verMonthDateHour[3] - case 3: - dateParts = append(dateParts, verMonthDateHour[:2]...) - hour = verMonthDateHour[2] - } - - dateParts = append(dateParts, fmt.Sprintf("%s:%s:%s", hour, minutes, secsHostProc[0])) - msg.timestamp = strings.Join(dateParts, " ") - msg.hostname = string(secsHostProc[1]) - - procParts := strings.Split(secsHostProc[2], "[") - if len(procParts) > 1 { - msg.appName = string(procParts[0]) - - p, err := strconv.ParseUint(strings.Trim(procParts[1], "[]"), 10, 16) - if err != nil { - if *isDebug { - log.Println("ERROR:", err) - } - } else { - msg.pid = int(p) - } - } else { - msg.appName = string(procParts[0]) - } - - return msg -} diff --git a/oldstuff/sltcpsrv/server.go b/oldstuff/sltcpsrv/server.go deleted file mode 100644 index b36ea40..0000000 --- a/oldstuff/sltcpsrv/server.go +++ /dev/null @@ -1,57 +0,0 @@ -package sltcpsrv - -import ( - "bufio" - "flag" - "fmt" - "io" - "log" - "net" - "strings" -) - -var ( - isDebug = flag.Bool("d", false, "Turn on debugging") -) - -func ListenAndServe(port int) { - ln, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) - if err != nil { - log.Fatal(err) - } - - log.Printf("Listening on %v\n", ln.Addr()) - - for { - conn, err := ln.Accept() - if err != nil { - log.Printf("WARN: Failed to accept connection!: %+v\n", err) - continue - } - - go handleConnection(conn) - } -} - -func handleConnection(conn net.Conn) { - defer conn.Close() - - connBuf := bufio.NewReader(conn) - - for { - line, err := connBuf.ReadString('\n') - if err != nil { - if err == io.EOF { - break - } - - log.Printf("Failed to read line: %+v\n", err) - return - } - - msg := newMessage([]byte(strings.TrimSpace(line))) - if msg != nil { - fmt.Printf("%v: %+v\n", conn.RemoteAddr(), msg) - } - } -} diff --git a/oldstuff/sltcpsrv/syslog-tcp-server/main.go b/oldstuff/sltcpsrv/syslog-tcp-server/main.go deleted file mode 100644 index 892009b..0000000 --- a/oldstuff/sltcpsrv/syslog-tcp-server/main.go +++ /dev/null @@ -1,16 +0,0 @@ -package main - -import ( - "flag" - - . "github.com/meatballhat/box-o-sand/sltcpsrv" -) - -var ( - port = flag.Int("p", 10514, "Port number on which to listen") -) - -func main() { - flag.Parse() - ListenAndServe(*port) -} diff --git a/oldstuff/sylvilagus/.example.env b/oldstuff/sylvilagus/.example.env deleted file mode 100644 index a667cbb..0000000 --- a/oldstuff/sylvilagus/.example.env +++ /dev/null @@ -1,4 +0,0 @@ -export SYLVILAGUS_ROOT="$HOME/src/box-o-sand/src/sylvilagus" -export SYLVILAGUS_AMQP_URI="amqp://sylvilagus:$(cat $SYLVILAGUS_ROOT/.sylvilagus-passwd)@localhost:5672/warren" -export SYLVILAGUS_ALERT_AMQP_URI="amqp://alert_user:alertme@localhost:5672" -export SYLVILAGUS_ROOT_ADMIN_AMQP_URI="amqp://admin:$(cat $SYLVILAGUS_ROOT/.admin-passwd)@localhost:5672" diff --git a/oldstuff/sylvilagus/.gitignore b/oldstuff/sylvilagus/.gitignore deleted file mode 100644 index fb5398a..0000000 --- a/oldstuff/sylvilagus/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/.installation/log/ -/.installation/mnesia/ -/.env -/.sylvilagus-passwd -/.admin-passwd diff --git a/oldstuff/sylvilagus/.installation/.example.env b/oldstuff/sylvilagus/.installation/.example.env deleted file mode 100644 index 4b60dd7..0000000 --- a/oldstuff/sylvilagus/.installation/.example.env +++ /dev/null @@ -1,4 +0,0 @@ -export SYLVILAGUS_ROOT=$HOME/src/box-o-sand/src/sylvilagus -export RABBITMQ_MNESIA_BASE=$SYLVILAGUS_ROOT/.installation/mnesia -export RABBITMQ_LOG_BASE=$SYLVILAGUS_ROOT/.installation/log -export PATH="$SYLVILAGUS_ROOT/.installation/rabbitmq_server-2.7.0/sbin:$PATH" diff --git a/oldstuff/sylvilagus/.installation/.gitignore b/oldstuff/sylvilagus/.installation/.gitignore deleted file mode 100644 index e18544c..0000000 --- a/oldstuff/sylvilagus/.installation/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/rabbitmq-server-generic-unix-2.7.0.tar.gz -/rabbitmq_server-2.7.0/ -/.env diff --git a/oldstuff/sylvilagus/.installation/setup b/oldstuff/sylvilagus/.installation/setup deleted file mode 100755 index baaf6d2..0000000 --- a/oldstuff/sylvilagus/.installation/setup +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ ! -f rabbitmq-server-generic-unix-2.7.0.tar.gz ] -then - wget http://www.rabbitmq.com/releases/rabbitmq-server/v2.7.0/rabbitmq-server-generic-unix-2.7.0.tar.gz -fi - -tar -xzvf rabbitmq-server-generic-unix-2.7.0.tar.gz diff --git a/oldstuff/sylvilagus/admin/ch04-alert-user-setup b/oldstuff/sylvilagus/admin/ch04-alert-user-setup deleted file mode 100755 index 75386e8..0000000 --- a/oldstuff/sylvilagus/admin/ch04-alert-user-setup +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -if [ -z "$(rabbitmqctl -q list_users | grep ^alert_user)" ] ; then - rabbitmqctl add_user alert_user alertme -fi -rabbitmqctl set_permissions -p '/' alert_user '.*' '.*' '.*' diff --git a/oldstuff/sylvilagus/go/.gitignore b/oldstuff/sylvilagus/go/.gitignore deleted file mode 100644 index e6c271f..0000000 --- a/oldstuff/sylvilagus/go/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/bin -/.env diff --git a/oldstuff/sylvilagus/go/Makefile b/oldstuff/sylvilagus/go/Makefile deleted file mode 100644 index 93fe5f8..0000000 --- a/oldstuff/sylvilagus/go/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -REPO_BASE := github.com/meatballhat/box-o-sand/sylvilagus/go -PACKAGES := \ - $(REPO_BASE)/sylvilagus-conntest \ - $(REPO_BASE)/sylvilagus-ch02-hello-world-consumer \ - $(REPO_BASE)/sylvilagus-ch02-hello-world-producer \ - $(REPO_BASE)/sylvilagus-ch04-rpc-server \ - $(REPO_BASE)/sylvilagus-ch04-rpc-client - -test: build - go test -x -v $(PACKAGES) - -build: deps - go install -x $(PACKAGES) - -deps: - go get -x $(PACKAGES) - -.PHONY: test build deps diff --git a/oldstuff/sylvilagus/go/sylvilagus-ch02-hello-world-consumer/main.go b/oldstuff/sylvilagus/go/sylvilagus-ch02-hello-world-consumer/main.go deleted file mode 100644 index cae1bb5..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus-ch02-hello-world-consumer/main.go +++ /dev/null @@ -1,45 +0,0 @@ -package main - -import ( - "log" -) - -import ( - "github.com/meatballhat/box-o-sand/sylvilagus/go/sylvilagus" - "github.com/streadway/amqp" -) - -func main() { - connection, err := amqp.Dial(sylvilagus.AMQP_URI) - if err != nil { - log.Fatal("Failed to connect!: ", err) - } - - defer connection.Close() - - channel, err := sylvilagus.CreateHelloTopology(connection) - if err != nil { - log.Fatal("Failed to build topology!: ", err) - } - - hellos, err := channel.Consume("hello-queue", "hello-consumer", false, false, false, false, nil) - if err != nil { - log.Fatal("Failed to start consuming!:", err) - } - - quit := make(chan bool) - - go func(quit chan bool) { - log.Println("Consuming...") - for hello := range hellos { - log.Printf("hello -> %v\n", string(hello.Body)) - hello.Ack(false) - if string(hello.Body) == "quit" { - quit <- true - return - } - } - }(quit) - - <-quit -} diff --git a/oldstuff/sylvilagus/go/sylvilagus-ch02-hello-world-producer/main.go b/oldstuff/sylvilagus/go/sylvilagus-ch02-hello-world-producer/main.go deleted file mode 100644 index 6b40e8e..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus-ch02-hello-world-producer/main.go +++ /dev/null @@ -1,46 +0,0 @@ -package main - -import ( - "log" - "os" - "time" -) - -import ( - "github.com/meatballhat/box-o-sand/sylvilagus/go/sylvilagus" - "github.com/streadway/amqp" -) - -func main() { - if len(os.Args) < 2 { - log.Fatal("You must provide a message as first arg!") - } - - msgBody := string(os.Args[1]) - - connection, err := amqp.Dial(sylvilagus.AMQP_URI) - if err != nil { - log.Fatal("Failed to connect!: ", err) - } - - defer connection.Close() - - channel, err := sylvilagus.CreateHelloTopology(connection) - if err != nil { - log.Fatal("Failed to build topology!: ", err) - } - - msg := amqp.Publishing{ - DeliveryMode: amqp.Persistent, - Timestamp: time.Now(), - ContentType: "text/plain", - Body: []byte(msgBody), - } - - err = channel.Publish("hello-exchange", "hola", false, false, msg) - if err != nil { - log.Fatal("Failed to publish message!: ", err) - } else { - log.Printf("Published '%v'\n", msgBody) - } -} diff --git a/oldstuff/sylvilagus/go/sylvilagus-ch04-rpc-client/main.go b/oldstuff/sylvilagus/go/sylvilagus-ch04-rpc-client/main.go deleted file mode 100644 index a1b953d..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus-ch04-rpc-client/main.go +++ /dev/null @@ -1,63 +0,0 @@ -package main - -import ( - "encoding/json" - "log" - "time" -) - -import ( - "github.com/meatballhat/box-o-sand/sylvilagus/go/sylvilagus" - "github.com/streadway/amqp" -) - -func main() { - connection, err := amqp.Dial(sylvilagus.AMQP_URI) - if err != nil { - log.Fatal("Failed to connect!:", err) - } - - defer connection.Close() - - channel, err := sylvilagus.CreateRPCTopology(connection) - if err != nil { - log.Fatal("Failed to build topology!:", err) - } - - qResult, err := channel.QueueDeclare("", false, false, true, false, nil) - if err != nil { - log.Fatal("Failed to build topology!:", err) - } - - msgBody := &sylvilagus.Ping{ - ClientName: "RPC Client 1.0", - Time: time.Now(), - } - - msgBytes, err := json.Marshal(msgBody) - if err != nil { - log.Fatal("Failed to json.Marshal the ping!:", err) - } - - msg := amqp.Publishing{ - ContentType: "application/json", - DeliveryMode: amqp.Persistent, - Timestamp: time.Now(), - Body: msgBytes, - ReplyTo: qResult.Name, - } - - channel.Publish("rpc", "ping", false, false, msg) - log.Println("Sent 'ping' RPC call:", string(msg.Body)) - log.Println("Waiting for reply...") - - pongs, err := channel.Consume(qResult.Name, qResult.Name, false, false, false, false, nil) - for pong := range pongs { - log.Println("RPC Reply ---", string(pong.Body)) - if err = channel.Close(); err != nil { - log.Fatal("Failed to close channel!:", err) - } else { - return - } - } -} diff --git a/oldstuff/sylvilagus/go/sylvilagus-ch04-rpc-server/main.go b/oldstuff/sylvilagus/go/sylvilagus-ch04-rpc-server/main.go deleted file mode 100644 index 069d05c..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus-ch04-rpc-server/main.go +++ /dev/null @@ -1,63 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "time" -) - -import ( - "github.com/meatballhat/box-o-sand/sylvilagus/go/sylvilagus" - "github.com/streadway/amqp" -) - -func main() { - connection, err := amqp.Dial(sylvilagus.AMQP_URI) - if err != nil { - log.Fatal("Failed to connect!:", err) - } - - defer connection.Close() - - channel, err := sylvilagus.CreateRPCTopology(connection) - if err != nil { - log.Fatal("Failed to build topology!:", err) - } - - pings, err := channel.Consume("ping", "ping", false, false, false, false, nil) - if err != nil { - log.Fatal("Failed to start consuming!:", err) - } - - quit := make(chan bool) - - go func(quit chan bool) { - log.Println("Waiting for RPC calls...") - - for ping := range pings { - if err = ping.Ack(false); err == nil { - log.Println("Received API call... replying...") - - pingInst := &sylvilagus.Ping{} - err = json.Unmarshal(ping.Body, pingInst) - if err == nil { - msg := amqp.Publishing{ - DeliveryMode: amqp.Persistent, - Timestamp: time.Now(), - ContentType: "text/plain", - Body: []byte(fmt.Sprintf("Pong! %s", pingInst.Time)), - } - - channel.Publish("", ping.ReplyTo, false, false, msg) - } else { - log.Println("Failed to json.Unmarshal the ping!:", err) - } - } else { - log.Println("Failed to ACK the ping!:", err) - } - } - }(quit) - - <-quit -} diff --git a/oldstuff/sylvilagus/go/sylvilagus-conntest/main.go b/oldstuff/sylvilagus/go/sylvilagus-conntest/main.go deleted file mode 100644 index bdc12a5..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus-conntest/main.go +++ /dev/null @@ -1,41 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "log" -) - -import ( - "github.com/streadway/amqp" -) - -var ( - connUri = flag.String("connuri", "amqp://guest:guest@localhost:5672/sylvilagus", "Connection URI for AMQP thingy") -) - -func main() { - flag.Parse() - - fmt.Printf("Connecting to %v...\n", *connUri) - conn, err := amqp.Dial(*connUri) - defer conn.Close() - - if err != nil { - log.Fatal("err:", err) - } - - if conn != nil { - log.Println("conn:", conn) - } - - channel, err := conn.Channel() - - if err != nil { - log.Fatal("err:", err) - } - - if channel != nil { - log.Println("channel:", channel) - } -} diff --git a/oldstuff/sylvilagus/go/sylvilagus.go b/oldstuff/sylvilagus/go/sylvilagus.go deleted file mode 100644 index 1269d85..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus.go +++ /dev/null @@ -1 +0,0 @@ -package sylvilagus diff --git a/oldstuff/sylvilagus/go/sylvilagus/hello.go b/oldstuff/sylvilagus/go/sylvilagus/hello.go deleted file mode 100644 index 04c2f71..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus/hello.go +++ /dev/null @@ -1,37 +0,0 @@ -package sylvilagus - -import ( - "log" -) - -import ( - "github.com/streadway/amqp" -) - -func CreateHelloTopology(connection *amqp.Connection) (*amqp.Channel, error) { - channel, err := connection.Channel() - if err != nil { - log.Println("Failed to get channel!: ", err) - return nil, err - } - - err = channel.ExchangeDeclare("hello-exchange", "direct", true, false, false, false, nil) - if err != nil { - log.Println("Failed to declare exchange!: ", err) - return nil, err - } - - _, err = channel.QueueDeclare("hello-queue", false, false, false, false, nil) - if err != nil { - log.Println("Failed to declare queue!: ", err) - return nil, err - } - - err = channel.QueueBind("hello-queue", "hola", "hello-exchange", false, nil) - if err != nil { - log.Println("Failed to bind to queue!: ", err) - return nil, err - } - - return channel, nil -} diff --git a/oldstuff/sylvilagus/go/sylvilagus/rpc.go b/oldstuff/sylvilagus/go/sylvilagus/rpc.go deleted file mode 100644 index c14f6ae..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus/rpc.go +++ /dev/null @@ -1,39 +0,0 @@ -package sylvilagus - -import ( - "log" - "time" -) - -import ( - "github.com/streadway/amqp" -) - -type Ping struct { - ClientName string `json:"client_name"` - Time time.Time `json:"time"` -} - -func CreateRPCTopology(connection *amqp.Connection) (channel *amqp.Channel, err error) { - if channel, err = connection.Channel(); err != nil { - log.Println("Failed to get channel!: ", err) - return nil, err - } - - if err = channel.ExchangeDeclare("rpc", "direct", true, false, false, false, nil); err != nil { - log.Println("Failed to declare exchange!: ", err) - return nil, err - } - - if _, err = channel.QueueDeclare("ping", false, false, false, false, nil); err != nil { - log.Println("Failed to declare queue!: ", err) - return nil, err - } - - if err = channel.QueueBind("ping", "ping", "rpc", false, nil); err != nil { - log.Println("Failed to bind to queue!: ", err) - return nil, err - } - - return channel, nil -} diff --git a/oldstuff/sylvilagus/go/sylvilagus/uri.go b/oldstuff/sylvilagus/go/sylvilagus/uri.go deleted file mode 100644 index 501dcf7..0000000 --- a/oldstuff/sylvilagus/go/sylvilagus/uri.go +++ /dev/null @@ -1,14 +0,0 @@ -package sylvilagus - -import ( - "log" - "os" -) - -var AMQP_URI = os.Getenv("SYLVILAGUS_AMQP_URI") - -func init() { - if len(AMQP_URI) < 1 { - log.Fatal("SYLVILAGUS_AMQP_URI is not defined!") - } -} diff --git a/oldstuff/sylvilagus/jruby/.gitignore b/oldstuff/sylvilagus/jruby/.gitignore deleted file mode 100644 index 4f3b44f..0000000 --- a/oldstuff/sylvilagus/jruby/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/tmp/ -/lib/java/*.jar diff --git a/oldstuff/sylvilagus/jruby/.rbenv-version b/oldstuff/sylvilagus/jruby/.rbenv-version deleted file mode 100644 index 70ea3ca..0000000 --- a/oldstuff/sylvilagus/jruby/.rbenv-version +++ /dev/null @@ -1 +0,0 @@ -jruby-1.6.7.2 diff --git a/oldstuff/sylvilagus/jruby/Gemfile b/oldstuff/sylvilagus/jruby/Gemfile deleted file mode 100644 index ea43f9b..0000000 --- a/oldstuff/sylvilagus/jruby/Gemfile +++ /dev/null @@ -1,9 +0,0 @@ -source :rubygems - -gem 'json_pure' -gem 'jruby-openssl' - -group :development, :test do - gem 'awesome_print' - gem 'rspec' -end diff --git a/oldstuff/sylvilagus/jruby/Gemfile.lock b/oldstuff/sylvilagus/jruby/Gemfile.lock deleted file mode 100644 index edf535e..0000000 --- a/oldstuff/sylvilagus/jruby/Gemfile.lock +++ /dev/null @@ -1,26 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - awesome_print (1.1.0) - bouncy-castle-java (1.5.0146.1) - diff-lcs (1.1.3) - jruby-openssl (0.7.7) - bouncy-castle-java (>= 1.5.0146.1) - json_pure (1.7.5) - rspec (2.12.0) - rspec-core (~> 2.12.0) - rspec-expectations (~> 2.12.0) - rspec-mocks (~> 2.12.0) - rspec-core (2.12.0) - rspec-expectations (2.12.0) - diff-lcs (~> 1.1.3) - rspec-mocks (2.12.0) - -PLATFORMS - java - -DEPENDENCIES - awesome_print - jruby-openssl - json_pure - rspec diff --git a/oldstuff/sylvilagus/jruby/Rakefile b/oldstuff/sylvilagus/jruby/Rakefile deleted file mode 100644 index e3f21f4..0000000 --- a/oldstuff/sylvilagus/jruby/Rakefile +++ /dev/null @@ -1,43 +0,0 @@ -RMQ_URI_BASE = 'http://www.rabbitmq.com/releases/rabbitmq-java-client' -RMQV = '2.8.7' -GSONV = '2.2.2' - -directory './tmp' -directory './lib/java' - -file "./tmp/google-gson-#{GSONV}-release.zip" => ['./tmp'] do |t| - sh "curl -s -o #{t.name} " << - "http://google-gson.googlecode.com/files/google-gson-#{GSONV}-release.zip" -end - -file "./tmp/google-gson-#{GSONV}" => ["./tmp/google-gson-#{GSONV}-release.zip"] do - Dir.chdir('./tmp') do - sh "unzip -f -o google-gson-#{GSONV}-release.zip" - end -end - -file "./lib/java/gson.jar" => ["./tmp/google-gson-#{GSONV}", './lib/java'] do |t| - sh "cp ./tmp/google-gson-#{GSONV}/gson-#{GSONV}.jar #{t.name}" -end - -file "./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz" => ['./tmp'] do |t| - sh "curl -s -o #{t.name} " << - "#{RMQ_URI_BASE}/v#{RMQV}/rabbitmq-java-client-bin-#{RMQV}.tar.gz" -end - -file "./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar" => - ["./tmp/rabbitmq-java-client-bin-#{RMQV}.tar.gz"] do - Dir.chdir('./tmp') do - sh "tar xzf rabbitmq-java-client-bin-#{RMQV}.tar.gz" - end -end - -file './lib/java/rabbitmq-client.jar' => - ["./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar", './lib/java'] do - sh "cp ./tmp/rabbitmq-java-client-bin-#{RMQV}/rabbitmq-client.jar ./lib/java/" -end - -desc 'Do everything to set up the things' -task :setup => ['./lib/java/rabbitmq-client.jar', './lib/java/gson.jar'] - -task :default => :setup diff --git a/oldstuff/sylvilagus/jruby/lib/java/.gitkeep b/oldstuff/sylvilagus/jruby/lib/java/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus.rb deleted file mode 100644 index 6174b76..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Sylvilagus -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02.rb deleted file mode 100644 index 4f169ac..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Sylvilagus - module Ch02 - end -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world.rb deleted file mode 100644 index 1b0441b..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'sylvilagus/init' -require 'sylvilagus/ch02' - -require 'rabbitmq-client.jar' -import com.rabbitmq.client.ConnectionFactory - -module Sylvilagus::Ch02::HelloWorld - module ClassMethods - def with_hello_world_channel(&block) - factory = ConnectionFactory.new - factory.uri = ENV.fetch('SYLVILAGUS_AMQP_URI') - conn = factory.new_connection - - channel = conn.create_channel - channel.exchange_declare('hello-exchange', 'direct', true) - channel.queue_declare('hello-queue', false, false, false, nil) - - block.call(channel) - ensure - conn.close - end - end -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world_consumer.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world_consumer.rb deleted file mode 100644 index 094492c..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world_consumer.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'sylvilagus/ch02/hello_world' - -class Sylvilagus::Ch02::HelloWorldConsumer < Java::ComRabbitmqClient::DefaultConsumer - class << self - include Sylvilagus::Ch02::HelloWorld::ClassMethods - - def main - with_hello_world_channel do |channel| - consumer = new(channel) - - STDERR.puts 'Starting consume loop...' - channel.basic_consume('hello-queue', false, consumer) - - loop do - sleep 1 - break if consumer.done? - end - end - end - end - - def done? - @done ||= false - end - - def handleDelivery(consumer_tag, envelope, properties, body) - body_string = Java::OrgJruby::RubyString.bytes_to_string(body) - - puts "Consumed #{body_string.inspect}" - channel.basic_ack(envelope.delivery_tag, false) - - if body_string == 'quit' - STDERR.puts 'Quitting...' - @done = true - end - end -end - -if $0 == __FILE__ - Sylvilagus::Ch02::HelloWorldConsumer.main -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world_producer.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world_producer.rb deleted file mode 100644 index 5397775..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch02/hello_world_producer.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'sylvilagus/ch02/hello_world' - -class Sylvilagus::Ch02::HelloWorldProducer - class << self - include Sylvilagus::Ch02::HelloWorld::ClassMethods - - def main(args = ARGV.clone) - raise 'Missing message arg!' if args.empty? - message = args.fetch(0) - with_hello_world_channel do |channel| - channel.basic_publish('hello-exchange', 'hola', nil, message.to_java_bytes) - puts "Published #{message.inspect}" - end - end - end -end - -if $0 == __FILE__ - Sylvilagus::Ch02::HelloWorldProducer.main(ARGV) -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch03.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch03.rb deleted file mode 100644 index 5a9b1a2..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch03.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Sylvilagus - module Ch03 - end -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch03/log_listeners.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch03/log_listeners.rb deleted file mode 100644 index f3c8055..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch03/log_listeners.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'sylvilagus/init' -require 'sylvilagus/ch03' - -require 'rabbitmq-client.jar' -import com.rabbitmq.client.ConnectionFactory -import com.rabbitmq.client.DefaultConsumer -import org.jruby.RubyString - -class Sylvilagus::Ch03::LogListeners - class LogConsumer < DefaultConsumer - attr_accessor :level - - def handleDelivery(consumer_tag, envelope, properties, body) - body_string = RubyString.bytes_to_string(body) - puts "#{level}: #{body_string}" - channel.basic_ack(envelope.delivery_tag, false) - end - end - - def main - factory = ConnectionFactory.new - amqp_uri = ENV.fetch('SYLVILAGUS_ROOT_ADMIN_AMQP_URI') - factory.uri = amqp_uri - puts "Getting connection for #{amqp_uri.inspect}..." - @conn = factory.new_connection - - trap :INT do - begin - @conn.close - exit 1 - rescue NativeException - exit 2 - end - end - - puts 'Getting channel...' - channel = @conn.create_channel - - puts 'Declaring queues...' - errors_queue = channel.queue_declare.get_queue - warnings_queue = channel.queue_declare.get_queue - info_queue = channel.queue_declare.get_queue - - puts "Binding queues to 'amq.rabbitmq.log' exchange..." - channel.queue_bind(errors_queue, 'amq.rabbitmq.log', 'error') - channel.queue_bind(warnings_queue, 'amq.rabbitmq.log', 'warning') - channel.queue_bind(info_queue, 'amq.rabbitmq.log', 'info') - - errors_consumer = LogConsumer.new(channel) - errors_consumer.level = 'error' - warnings_consumer = LogConsumer.new(channel) - warnings_consumer.level = 'warning' - info_consumer = LogConsumer.new(channel) - info_consumer.level = 'info' - - puts 'Setting up consumers...' - channel.basic_consume(errors_queue, false, errors_consumer) - channel.basic_consume(warnings_queue, false, warnings_consumer) - channel.basic_consume(info_queue, false, info_consumer) - - loop do - sleep 1 - end - ensure - begin - @conn.close if @conn - rescue NativeException - end - end -end - -if $0 == __FILE__ - Sylvilagus::Ch03::LogListeners.new.main -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04.rb deleted file mode 100644 index eb9a071..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Sylvilagus - module Ch04 - end -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/add_points_consumer.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/add_points_consumer.rb deleted file mode 100644 index 5a5bf42..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/add_points_consumer.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'sylvilagus/init' -require 'sylvilagus/ch04' -require 'json' -require 'rabbitmq-client.jar' - -class Sylvilagus::Ch04::AddPointsConsumer - class Consumer < Java::ComRabbitmqClient::DefaultConsumer - def handleDelivery(consumer_tag, envelope, properties, body) - message = Java::OrgJruby::RubyString.bytes_to_string(body) - - if message == 'quit' - channel.basic_cancel(consumer_tag) - @done = true - return - end - - add_points_to_user(JSON.parse(message).fetch('user_id')) - - channel.basic_ack(envelope.delivery_tag, false) - rescue StandardError - channel.basic_nack(envelope.delivery_tag, false) - end - - def add_points_to_user(user_id) - puts "Adding points to user: #{user_id}" - end - - def done? - !!@done - end - end - - def main - factory = Java::ComRabbitmqClient::ConnectionFactory.new - factory.uri = ENV.fetch('SYLVILAGUS_AMQP_URI') - @conn = factory.new_connection - channel = @conn.create_channel - channel.exchange_declare( - 'upload-pictures', 'fanout', false, true, false, nil - ) - channel.queue_declare('add-points', false, false, false, nil) - channel.queue_bind('add-points', 'upload-pictures', '') - - consumer = Consumer.new(channel) - puts "Consuming from 'upload-pictures' exchange" - channel.basic_consume('add-points', false, 'add-points-consumer', - false, false, nil, consumer) - loop do - break if consumer.done? - sleep 1 - end - return 0 - ensure - @conn.close if @conn - end -end - -if $0 == __FILE__ - exit Sylvilagus::Ch04::AddPointsConsumer.new.main -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/alert_consumer.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/alert_consumer.rb deleted file mode 100644 index 6ba6866..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/alert_consumer.rb +++ /dev/null @@ -1,93 +0,0 @@ -require 'sylvilagus/init' -require 'sylvilagus/ch04' -require 'json' -require 'net/smtp' -require 'rabbitmq-client.jar' - -class Sylvilagus::Ch04::AlertProducer - OPS_EMAILS = ['me@localhost'].freeze - ADMIN_EMAILS = ['me@localhost'].freeze - - def self.send_email(recipients, subject, body) - Net::SMTP.start('localhost', 25) do |smtp| - msgstr = <<-EOM.gsub(/^ /, '') - To: #{recipients.join(', ')} - From: alerts@sylvilagus.local - Subject: #{subject} - Date: #{Time.now} - - #{body} - EOM - smtp.send_message(msgstr, 'alerts@sylvilagus.local', recipients) - end - end - - class CriticalNotifier < Java::ComRabbitmqClient::DefaultConsumer - def handleDelivery(consumer_tag, envelope, properties, body) - message = JSON.parse( - Java::OrgJruby::RubyString.bytes_to_string(body) - ).fetch('message') - - Sylvilagus::Ch04::AlertProducer.send_email( - OPS_EMAILS, 'CRITICAL ALERT!', message - ) - puts "Sent alert via email! Alert text: #{message}" - puts "Recipients: #{OPS_EMAILS}" - - channel.basic_ack(envelope.delivery_tag, false) - end - end - - class RateLimitNotifier < Java::ComRabbitmqClient::DefaultConsumer - def handleDelivery(consumer_tag, envelope, properties, body) - message = JSON.parse( - Java::OrgJruby::RubyString.bytes_to_string(body) - ).fetch('message') - - Sylvilagus::Ch04::AlertProducer.send_email( - ADMIN_EMAILS, 'RATE LIMIT ALERT!', message - ) - puts "Sent alert via email! Alert text: #{message}" - puts "Recipients: #{ADMIN_EMAILS}" - - channel.basic_ack(envelope.delivery_tag, false) - end - end - - def main - factory = Java::ComRabbitmqClient::ConnectionFactory.new - factory.uri = ENV.fetch('SYLVILAGUS_ALERT_AMQP_URI') - @conn = factory.new_connection - channel = @conn.create_channel - - channel.exchange_declare('alerts', 'topic', true, false, false, nil) - channel.queue_declare('critical', true, false, false, nil) - channel.queue_bind('critical', 'alerts', 'critical.*', nil) - channel.queue_declare('rate_limit', true, false, false, nil) - channel.queue_bind('rate_limit', 'alerts', '*.rate_limit', nil) - - critical_notifier = CriticalNotifier.new(channel) - rate_limit_notifier = RateLimitNotifier.new(channel) - - channel.basic_consume( - 'critical', false, 'critical', critical_notifier - ) - channel.basic_consume( - 'rate_limit', false, 'rate_limit', rate_limit_notifier - ) - - trap(:INT) { exit 0 } - - puts 'Starting consumer loop...' - loop { sleep 1 } - ensure - begin - @conn.close if @conn - rescue NativeException - end - end -end - -if $0 == __FILE__ - Sylvilagus::Ch04::AlertProducer.new.main -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/alert_producer.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/alert_producer.rb deleted file mode 100644 index 6c3dd3b..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/alert_producer.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'sylvilagus/init' -require 'sylvilagus/ch04' -require 'optparse' -require 'json' -require 'rabbitmq-client.jar' - -class Sylvilagus::Ch04::AlertProducer - def main - options = {} - OptionParser.new do |opts| - opts.on('-rROUTING_KEY', '--routing-key=ROUTING_KEY', - 'Routing key for message (e.g. myalert.im)') do |r| - options[:routing_key] = r - end - opts.on('-mMESSAGE', '--message=MESSAGE', - 'Message text for alert.') do |m| - options[:message] = m - end - end.parse! - - unless options[:message] && options[:routing_key] - STDERR.puts 'Need both message and routing_key!' - exit 1 - end - - factory = Java::ComRabbitmqClient::ConnectionFactory.new - factory.uri = ENV.fetch('SYLVILAGUS_ALERT_AMQP_URI') - @conn = factory.new_connection - channel = @conn.create_channel - channel.exchange_declare('alerts', 'topic', true, false, false, nil) - - props = Java::ComRabbitmqClient::AMQP::BasicProperties.new - props.content_type = 'application/json' - - json_msg = JSON.dump({'message' => options[:message]}) - channel.basic_publish('alerts', options[:routing_key], - true, true, props, json_msg.to_java_bytes) - - puts "Sent message #{json_msg.inspect} tagged " << - "with routing key #{options[:routing_key].inspect} to " << - 'exchange "alerts" on vhost "/".' - ensure - @conn.close if @conn - end -end - -if $0 == __FILE__ - Sylvilagus::Ch04::AlertProducer.new.main -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/fanout_publisher.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/fanout_publisher.rb deleted file mode 100644 index f0aca69..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/fanout_publisher.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'sylvilagus/init' -require 'sylvilagus/ch04' -require 'json' -require 'rabbitmq-client.jar' - -class Sylvilagus::Ch04::FanoutPublisher - def main(argv = ARGV.clone) - unless argv.length == 3 - STDERR.puts "Usage: #{File.basename($0)} " - return 1 - end - message = { - 'image_id' => Integer(argv.fetch(0)), - 'user_id' => Integer(argv.fetch(1)), - 'image_path' => argv.fetch(2) - } - - factory = Java::ComRabbitmqClient::ConnectionFactory.new - factory.uri = ENV.fetch('SYLVILAGUS_AMQP_URI') - @conn = factory.new_connection - channel = @conn.create_channel - channel.exchange_declare( - 'upload-pictures', 'fanout', false, true, false, nil - ) - - props = Java::ComRabbitmqClient::AMQP::BasicProperties.new - props.content_type = 'application/json' - props.delivery_mode = 2 - - json_msg = JSON.dump(message) - channel.basic_publish('upload-pictures', '', props, json_msg.to_java_bytes) - - puts "Sent message #{json_msg.inspect} tagged " << - 'exchange "upload-pictures" on vhost "/".' - return 0 - ensure - @conn.close if @conn - end -end - -if $0 == __FILE__ - exit Sylvilagus::Ch04::FanoutPublisher.new.main -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/resize_picture_consumer.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/resize_picture_consumer.rb deleted file mode 100644 index a20126d..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/ch04/resize_picture_consumer.rb +++ /dev/null @@ -1,62 +0,0 @@ -require 'sylvilagus/init' -require 'sylvilagus/ch04' -require 'json' -require 'rabbitmq-client.jar' - -class Sylvilagus::Ch04::ResizePictureConsumer - class Consumer < Java::ComRabbitmqClient::DefaultConsumer - def handleDelivery(consumer_tag, envelope, properties, body) - message = Java::OrgJruby::RubyString.bytes_to_string(body) - - if message == 'quit' - channel.basic_cancel(consumer_tag) - @done = true - return - end - - message_hash = JSON.parse(message) - resize_picture(message_hash.fetch('image_id'), - message_hash.fetch('image_path')) - - channel.basic_ack(envelope.delivery_tag, false) - rescue StandardError - channel.basic_nack(envelope.delivery_tag, false) - end - - def resize_picture(image_id, image_path) - puts "Resizing picture: #{image_id} #{image_path}" - end - - def done? - !!@done - end - end - - def main - factory = Java::ComRabbitmqClient::ConnectionFactory.new - factory.uri = ENV.fetch('SYLVILAGUS_AMQP_URI') - @conn = factory.new_connection - channel = @conn.create_channel - channel.exchange_declare( - 'upload-pictures', 'fanout', false, true, false, nil - ) - channel.queue_declare('resize-picture', false, false, false, nil) - channel.queue_bind('resize-picture', 'upload-pictures', '') - - consumer = Consumer.new(channel) - puts "Consuming from 'upload-pictures' exchange" - channel.basic_consume('resize-picture', false, 'resize-picture-consumer', - false, false, nil, consumer) - loop do - break if consumer.done? - sleep 1 - end - return 0 - ensure - @conn.close if @conn - end -end - -if $0 == __FILE__ - exit Sylvilagus::Ch04::ResizePictureConsumer.new.main -end diff --git a/oldstuff/sylvilagus/jruby/lib/sylvilagus/init.rb b/oldstuff/sylvilagus/jruby/lib/sylvilagus/init.rb deleted file mode 100644 index 0d6dbfd..0000000 --- a/oldstuff/sylvilagus/jruby/lib/sylvilagus/init.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'java' - -SYLVILAGUS_JAVA_LIBS = File.expand_path('../../java/', __FILE__) - -$CLASSPATH << SYLVILAGUS_JAVA_LIBS - -Dir["#{SYLVILAGUS_JAVA_LIBS}/*.jar"].each do |jar| - $CLASSPATH << jar -end diff --git a/oldstuff/sylvilagus/php/.gitignore b/oldstuff/sylvilagus/php/.gitignore deleted file mode 100644 index 8d49294..0000000 --- a/oldstuff/sylvilagus/php/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/php-amqplib/ diff --git a/oldstuff/sylvilagus/php/rabbitmqctl-examples.php b/oldstuff/sylvilagus/php/rabbitmqctl-examples.php deleted file mode 100644 index 5843d47..0000000 --- a/oldstuff/sylvilagus/php/rabbitmqctl-examples.php +++ /dev/null @@ -1,32 +0,0 @@ -channel(); - -$channel->exchange_declare('logs-exchange', 'topic', false, true, false); - -$channel->queue_declare('msg-inbox-errors', false, true, false, false); - -$channel->queue_declare('msg-inbox-logs', false, true, false, false); - -$channel->queue_declare('all-logs', false, true, false, false); - -$channel->queue_bind('msg-inbox-errors', 'logs-exchange', 'error.msg-inbox'); - -$channel->queue_bind('msg-inbox-logs', 'logs-exchange', '*.msg-inbox'); - -?> diff --git a/oldstuff/sylvilagus/php/setup b/oldstuff/sylvilagus/php/setup deleted file mode 100755 index 9d81869..0000000 --- a/oldstuff/sylvilagus/php/setup +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -x - -if [ ! -d php-amqplib/.git ] ; then - git clone git://github.com/videlalvaro/php-amqplib.git -else - pushd php-amqplib - git fetch - get reset --hard origin/master - popd -fi - -pushd php-amqplib -if [ ! -f composer.phar ] ; then - curl -s https://getcomposer.org/installer | php -fi -php composer.phar install -popd diff --git a/oldstuff/sylvilagus/python/.gitignore b/oldstuff/sylvilagus/python/.gitignore deleted file mode 100644 index 578aea5..0000000 --- a/oldstuff/sylvilagus/python/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/.env -/*.egg-info/ diff --git a/oldstuff/sylvilagus/python/setup.py b/oldstuff/sylvilagus/python/setup.py deleted file mode 100644 index bf0565a..0000000 --- a/oldstuff/sylvilagus/python/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from setuptools import setup - -setup( - name='sylvilagus', - version='0.1.0', - author='Dan Buch', - author_email='dan@meatballhat.com', - description='crap accumulated while reading through RabbitMQ in Action', - packages=['sylvilagus'], - install_requires=[ - 'pika == 0.9.6' - ] -) diff --git a/oldstuff/sylvilagus/python/sylvilagus/__init__.py b/oldstuff/sylvilagus/python/sylvilagus/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/sylvilagus/python/sylvilagus/ch02/__init__.py b/oldstuff/sylvilagus/python/sylvilagus/ch02/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world.py b/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world.py deleted file mode 100644 index a389d3e..0000000 --- a/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world.py +++ /dev/null @@ -1,37 +0,0 @@ -import os - -import pika - - -def get_conn_params(): - return pika.URLParameters(os.environ['SYLVILAGUS_AMQP_URI']) - - -def get_nonblocking_channel(declare_exchange=True): - channel = pika.SelectConnection(get_conn_params()).channel() - - if declare_exchange: - channel.exchange_declare( - exchange='hello-exchange', - exchange_type='direct', - passive=False, - durable=True, - auto_delete=False - ) - - return channel - - -def get_channel(declare_exchange=True): - channel = pika.BlockingConnection(get_conn_params()).channel() - - if declare_exchange: - channel.exchange_declare( - exchange='hello-exchange', - exchange_type='direct', - passive=False, - durable=True, - auto_delete=False - ) - - return channel diff --git a/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_consumer.py b/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_consumer.py deleted file mode 100644 index edf817f..0000000 --- a/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_consumer.py +++ /dev/null @@ -1,39 +0,0 @@ -from __future__ import print_function - -import sys - -import pika - -from sylvilagus.ch02 import hello_world - - -def msg_consumer(channel, method, header, body): - channel.basic_ack(delivery_tag=method.delivery_tag) - if body == 'quit': - channel.basic_cancel(consumer_tag='hello-consumer') - channel.stop_consuming() - else: - print(body) - return - - -def main(): - channel = hello_world.get_channel() - - channel.queue_declare(queue='hello-queue') - channel.queue_bind(queue='hello-queue', - exchange='hello-exchange', - routing_key='hola') - - channel.basic_consume(msg_consumer, - queue='hello-queue', - consumer_tag='hello-consumer') - - print('consuming...') - channel.start_consuming() - - return 0 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_producer.py b/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_producer.py deleted file mode 100644 index 04142af..0000000 --- a/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_producer.py +++ /dev/null @@ -1,27 +0,0 @@ -from __future__ import print_function - -import sys - -import pika - -from sylvilagus.ch02 import hello_world - - -def main(args=sys.argv[:]): - channel = hello_world.get_channel() - - msg = args[1] - msg_props = pika.BasicProperties() - msg_props.content_type = 'text/plain' - - channel.basic_publish(body=msg, - exchange='hello-exchange', - properties=msg_props, - routing_key='hola') - print('published {!r}'.format(msg)) - - return 0 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_producer_with_confirms.py b/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_producer_with_confirms.py deleted file mode 100644 index 579e2a6..0000000 --- a/oldstuff/sylvilagus/python/sylvilagus/ch02/hello_world_producer_with_confirms.py +++ /dev/null @@ -1,37 +0,0 @@ -from __future__ import print_function - -import logging -import sys - -import pika - -from sylvilagus.ch02 import hello_world - - -def main(sysargs=sys.argv[:]): - msg = sysargs[1] - - logging.basicConfig() - - channel = hello_world.get_channel() - - if channel.basic_publish( - body=msg, - exchange='hello-exchange', - properties=pika.BasicProperties( - content_type='text/plain', - delivery_mode=1 - ), - routing_key='hola', - mandatory=True): - print('Message delivered!') - else: - print('Message returned!') - - channel.close() - - return 0 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/oldstuff/sylvilagus/python/sylvilagus/ch04/__init__.py b/oldstuff/sylvilagus/python/sylvilagus/ch04/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/oldstuff/sylvilagus/python/sylvilagus/ch04/alert_consumer.py b/oldstuff/sylvilagus/python/sylvilagus/ch04/alert_consumer.py deleted file mode 100644 index d493248..0000000 --- a/oldstuff/sylvilagus/python/sylvilagus/ch04/alert_consumer.py +++ /dev/null @@ -1,100 +0,0 @@ -from __future__ import print_function - -import json -import smtplib -import sys - -import pika - - -AMQP_SERVER = 'localhost' -AMQP_USER = 'alert_user' -AMQP_PASS = 'alertme' -AMQP_VHOST = '/' -AMQP_EXCHANGE = 'alerts' -OPS_EMAILS = ['me@localhost'] -ADMIN_EMAILS = ['me@localhost'] - - -def main(): - creds_broker = pika.PlainCredentials(AMQP_USER, AMQP_PASS) - conn_params = pika.ConnectionParameters(AMQP_SERVER, - virtual_host=AMQP_VHOST, - credentials=creds_broker) - conn_broker = pika.BlockingConnection(conn_params) - - channel = conn_broker.channel() - - channel.exchange_declare(exchange=AMQP_EXCHANGE, - exchange_type='topic', - auto_delete=False) - channel.queue_declare(queue='critical', auto_delete=False) - channel.queue_bind(queue='critical', - exchange='alerts', - routing_key='critical.*') - channel.queue_declare(queue='rate_limit', auto_delete=False) - channel.queue_bind(queue='rate_limit', - exchange='alerts', - routing_key='*.rate_limit') - - channel.basic_consume(critical_notify, - queue='critical', - no_ack=False, - consumer_tag='critical') - channel.basic_consume(rate_limit_notify, - queue='rate_limit', - no_ack=False, - consumer_tag='rate_limit') - - try: - print('Ready for alerts!') - channel.start_consuming() - except KeyboardInterrupt: - conn_broker.close() - return 0 - - -def send_mail(recipients, subject, message): - """Email generator for received alerts.""" - headers = '\r\n'.join([ - 'From: alerts@sylvilagus.local', - 'To: ', - 'Date: ', - 'Subject: {}'.format(subject) - ]) + '\r\n\r\n' - smtp_server = smtplib.SMTP() - smtp_server.connect('localhost', 25) - smtp_server.sendmail('alerts@sylvilagus.local', - recipients, - headers + str(message)) - smtp_server.close() - - -def critical_notify(channel, method, header, body): - """Sends CRITICAL alerts to administrators via email.""" - message = json.loads(body) - - send_mail(OPS_EMAILS, 'CRITICAL ALERT', message) - print('Sent alert via email! Alert Text: {} \nRecipients: {}'.format( - message, OPS_EMAILS - ) - ) - - channel.basic_ack(delivery_tag=method.delivery_tag) - - -def rate_limit_notify(channel, method, header, body): - """Sends the message to the administrators via email.""" - message = json.loads(body) - - send_mail(ADMIN_EMAILS, 'RATE LIMIT ALERT!', message) - print('Sent alert via email! Alert Text: {} \nRecipients: {}'.format( - message, ADMIN_EMAILS - ) - ) - - channel.basic_ack(delivery_tag=method.delivery_tag) - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/oldstuff/sylvilagus/python/sylvilagus/ch04/alert_producer.py b/oldstuff/sylvilagus/python/sylvilagus/ch04/alert_producer.py deleted file mode 100644 index d579f72..0000000 --- a/oldstuff/sylvilagus/python/sylvilagus/ch04/alert_producer.py +++ /dev/null @@ -1,51 +0,0 @@ -from __future__ import print_function - -import json -import sys - -import pika - -from argparse import ArgumentParser - - -def main(sysargs=sys.argv[:]): - parser = ArgumentParser() - parser.add_argument('-r', - '--routing-key', - help='Routing key for message (e.g. myalert.im)') - parser.add_argument('-m', - '--message', - help='Message text for alert.') - - args = parser.parse_args(sysargs[1:]) - - creds_broker = pika.PlainCredentials('alert_user', 'alertme') - conn_params = pika.ConnectionParameters('localhost', - virtual_host='/', - credentials=creds_broker) - conn_broker = pika.BlockingConnection(conn_params) - - channel = conn_broker.channel() - - msg = json.dumps({'message': args.message}) - msg_props = pika.BasicProperties() - msg_props.content_type = 'application/json' - msg_props.durable = False - - channel.basic_publish(body=msg, - exchange='alerts', - properties=msg_props, - routing_key=args.routing_key) - - print( - ('Sent message {} tagged with routing key {!r} to ' + - 'exchange "alerts" on vhost "/".').format(msg, args.routing_key) - ) - - conn_broker.close() - - return 0 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/oldstuff/sylvilagus/scala/.gitignore b/oldstuff/sylvilagus/scala/.gitignore deleted file mode 100644 index acda17d..0000000 --- a/oldstuff/sylvilagus/scala/.gitignore +++ /dev/null @@ -1,43 +0,0 @@ -# use glob syntax. -syntax: glob -*.ser -*.class -*~ -*.bak -#*.off -*.old - -.env - -# eclipse conf file -.settings -.classpath -.project -.manager -.scala_dependencies - -# idea -.idea -*.iml - -# building -target -build -null -tmp* -temp* -dist -test-output -build.log - -# other scm -.svn -.CVS -.hg* - -# switch to regexp syntax. -# syntax: regexp -# ^\.pc/ - -#SHITTY output not in target directory -build.log diff --git a/oldstuff/sylvilagus/scala/bin/sylvilagus-ch02-hello-world-producer b/oldstuff/sylvilagus/scala/bin/sylvilagus-ch02-hello-world-producer deleted file mode 100755 index a623469..0000000 --- a/oldstuff/sylvilagus/scala/bin/sylvilagus-ch02-hello-world-producer +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -cd $(dirname $(dirname $0)) -mvn scala:run -Dlauncher=ch02-hello-world-producer -DaddArgs="$1" diff --git a/oldstuff/sylvilagus/scala/build.sbt b/oldstuff/sylvilagus/scala/build.sbt deleted file mode 100644 index c8a72f3..0000000 --- a/oldstuff/sylvilagus/scala/build.sbt +++ /dev/null @@ -1,11 +0,0 @@ -import AssemblyKeys._ - -assemblySettings - -name := "sylvilagus" - -version := "0.1.0" - -scalaVersion := "2.9.2" - -libraryDependencies += "com.rabbitmq" % "amqp-client" % "2.8.7" diff --git a/oldstuff/sylvilagus/scala/pom.xml b/oldstuff/sylvilagus/scala/pom.xml deleted file mode 100644 index cc957a6..0000000 --- a/oldstuff/sylvilagus/scala/pom.xml +++ /dev/null @@ -1,116 +0,0 @@ - - 4.0.0 - com.meatballhat.sylvilagus - sylvilagus - 0.1.0 - ${project.artifactId} - Scala stuff accumulated for RabbitMQ in Action - 2012 - - - 1.5 - 1.5 - UTF-8 - 2.9.2 - - - - - - org.scala-lang - scala-library - ${scala.version} - - - com.rabbitmq - amqp-client - 2.8.7 - - - - - junit - junit - 4.8.1 - test - - - - - - - - - org.scalatest - scalatest - 1.2 - test - - - - - src/main/scala - src/test/scala - - - org.scala-tools - maven-scala-plugin - 2.15.0 - - - - compile - testCompile - - - - -make:transitive - -dependencyfile - ${project.build.directory}/.scala_dependencies - - - - - - - - ch02-hello-world-producer - com.meatballhat.sylvilagus.ch02.HelloWorldProducer - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.6 - - false - true - - - - **/*Test.* - **/*Suite.* - - - - - - diff --git a/oldstuff/sylvilagus/scala/project/plugins.sbt b/oldstuff/sylvilagus/scala/project/plugins.sbt deleted file mode 100644 index bc32de7..0000000 --- a/oldstuff/sylvilagus/scala/project/plugins.sbt +++ /dev/null @@ -1,3 +0,0 @@ -resolvers += Resolver.url("Artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns) - -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.5") diff --git a/oldstuff/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldConsumer.scala b/oldstuff/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldConsumer.scala deleted file mode 100644 index e6c4497..0000000 --- a/oldstuff/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldConsumer.scala +++ /dev/null @@ -1,25 +0,0 @@ -package com.meatballhat.sylvilagus.ch02 - -import com.rabbitmq.client._ - -object HelloWorldConsumer extends App { - val factory = new ConnectionFactory() - factory.setUri(sys.env("SYLVILAGUS_AMQP_URI")) - val connection = factory.newConnection - val channel = connection.createChannel - - channel.exchangeDeclare("hello-exchange", "direct", true) - channel.queueDeclare("hello-queue", false, false, false, null) - - var consumer = new QueueingConsumer(channel) - channel.basicConsume("hello-queue", true, consumer) - - println("Waiting for messages...") - - while (true) { - new String(consumer.nextDelivery.getBody) match { - case "quit" => println("Exiting..") ; connection.close ; exit - case msg@_ => println("Received '%s'".format(msg)) - } - } -} diff --git a/oldstuff/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldProducer.scala b/oldstuff/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldProducer.scala deleted file mode 100644 index d796769..0000000 --- a/oldstuff/sylvilagus/scala/src/main/scala/com/meatballhat/sylvilagus/ch02/HelloWorldProducer.scala +++ /dev/null @@ -1,24 +0,0 @@ -package com.meatballhat.sylvilagus.ch02 - -import com.rabbitmq.client._ - -object HelloWorldProducer extends App { - if (args.length < 1) { - println("You must provide a message argument") - exit - } - var messageBody = args(0) - - var factory = new ConnectionFactory() - factory.setUri(sys.env("SYLVILAGUS_AMQP_URI")) - var connection = factory.newConnection() - var channel = connection.createChannel() - - channel.exchangeDeclare("hello-exchange", "direct", true) - channel.queueDeclare("hello-queue", false, false, false, null) - - printf("Publishing '%s'\n", messageBody) - channel.basicPublish("hello-exchange", "hola", null, messageBody.getBytes()) - - connection.close() -} diff --git a/oldstuff/tsfun/.gitignore b/oldstuff/tsfun/.gitignore deleted file mode 100644 index c2658d7..0000000 --- a/oldstuff/tsfun/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/oldstuff/tsfun/greeter.js b/oldstuff/tsfun/greeter.js deleted file mode 100644 index 0f6d09c..0000000 --- a/oldstuff/tsfun/greeter.js +++ /dev/null @@ -1,14 +0,0 @@ -var Student = /** @class */ (function () { - function Student(firstName, middleInitial, lastName) { - this.firstName = firstName; - this.middleInitial = middleInitial; - this.lastName = lastName; - this.fullName = firstName + " " + middleInitial + " " + lastName; - } - return Student; -}()); -function greeter(person) { - return "Hello, " + person.firstName + " " + person.lastName; -} -var user = new Student("Jane", "M.", "User"); -console.log(greeter(user)); diff --git a/oldstuff/tsfun/greeter.ts b/oldstuff/tsfun/greeter.ts deleted file mode 100644 index 207a02c..0000000 --- a/oldstuff/tsfun/greeter.ts +++ /dev/null @@ -1,23 +0,0 @@ -class Student { - fullName: string; - constructor( - public firstName: string, - public middleInitial: string, - public lastName: string - ) { - this.fullName = firstName + " " + middleInitial + " " + lastName; - } -} - -interface Person { - firstName: string, - lastName: string; -} - -function greeter(person: Person) { - return "Hello, " + person.firstName + " " + person.lastName; -} - -let user = new Student("Jane", "M.", "User"); - -console.log(greeter(user)); diff --git a/oldstuff/tsfun/package.json b/oldstuff/tsfun/package.json deleted file mode 100644 index 8bd48b4..0000000 --- a/oldstuff/tsfun/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "devDependencies": { - "typescript": "^3.7.2" - }, - "license": "MIT" -} diff --git a/oldstuff/tsfun/yarn.lock b/oldstuff/tsfun/yarn.lock deleted file mode 100644 index 230c5be..0000000 --- a/oldstuff/tsfun/yarn.lock +++ /dev/null @@ -1,8 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -typescript@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== diff --git a/oldstuff/vuefun/.gitignore b/oldstuff/vuefun/.gitignore deleted file mode 100644 index b947077..0000000 --- a/oldstuff/vuefun/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -dist/ diff --git a/oldstuff/vuefun/Makefile b/oldstuff/vuefun/Makefile deleted file mode 100644 index 21b9d07..0000000 --- a/oldstuff/vuefun/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -BUILD_NAME := $(shell go env GOOS)_$(shell go env GOARCH) -TARGETS := build/$(BUILD_NAME)/vuefun-app dist/index.html - -.PHONY: all -all: build test - -.PHONY: build -build: $(TARGETS) - -.PHONY: test -test: - go test -v - -.PHONY: wat -wat: - @echo TARGETS="$(TARGETS)" - -.PHONY: clean -clean: - rm -rf dist/ build/ - -dist/index.html: $(wildcard src/*) - yarn build - -build/$(BUILD_NAME)/vuefun-app: $(wildcard *.go) - go build -o $@ $< diff --git a/oldstuff/vuefun/README.md b/oldstuff/vuefun/README.md deleted file mode 100644 index 500b88d..0000000 --- a/oldstuff/vuefun/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# 🚀 Welcome to your new awesome project! - -This project has been created using **webpack scaffold**, you can now run - -``` -npm run build -``` - -or - -``` -yarn build -``` - -to bundle your application diff --git a/oldstuff/vuefun/app.go b/oldstuff/vuefun/app.go deleted file mode 100644 index d2830fd..0000000 --- a/oldstuff/vuefun/app.go +++ /dev/null @@ -1,33 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "io" - "net/http" - - "github.com/urfave/negroni" -) - -var ( - addrFlag = flag.String("a", ":9745", "addr at which to listen") - distDir = flag.String("d", "dist", "directory in which are the dist bits") -) - -func main() { - flag.Parse() - - mux := http.NewServeMux() - - mux.HandleFunc(`/api/`, func(w http.ResponseWriter, req *http.Request) { - io.WriteString(w, "welp") - }) - - n := negroni.New() - n.Use(negroni.NewStatic(http.Dir(*distDir))) - n.Use(negroni.NewLogger()) - n.UseHandler(mux) - - fmt.Printf("Serving at %v\n", *addrFlag) - http.ListenAndServe(*addrFlag, n) -} diff --git a/oldstuff/vuefun/go.mod b/oldstuff/vuefun/go.mod deleted file mode 100644 index 682589a..0000000 --- a/oldstuff/vuefun/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/meatballhat/box-o-sand/vuefun - -go 1.12 - -require github.com/urfave/negroni v1.0.0 diff --git a/oldstuff/vuefun/go.sum b/oldstuff/vuefun/go.sum deleted file mode 100644 index 6607639..0000000 --- a/oldstuff/vuefun/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= -github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= diff --git a/oldstuff/vuefun/package.json b/oldstuff/vuefun/package.json deleted file mode 100644 index 812869b..0000000 --- a/oldstuff/vuefun/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "vuefun", - "version": "0.1.0", - "description": "fun with vue ok", - "main": "index.js", - "scripts": { - "test": "echo nope", - "build": "webpack", - "start": "webpack-dev-server" - }, - "repository": { - "type": "git", - "url": "https://github.com/meatballhat/box-o-sand/vuefun/" - }, - "keywords": [ - "unusable" - ], - "author": "Kilgore Trout", - "license": "MIT", - "devDependencies": { - "@babel/core": "^7.7.0", - "@babel/preset-env": "^7.7.1", - "@webpack-cli/init": "^0.2.2", - "babel-loader": "^8.0.6", - "babel-plugin-syntax-dynamic-import": "^6.18.0", - "css-loader": "^3.2.0", - "html-webpack-plugin": "^3.2.0", - "node-sass": "^4.13.0", - "normalize.css": "^8.0.1", - "sass-loader": "^8.0.0", - "style-loader": "^1.0.0", - "typescript": "^3.7.2", - "vue": "^2.6.10", - "webpack": "^4.41.2", - "webpack-cli": "^3.3.10", - "webpack-dev-server": "^3.9.0" - }, - "dependencies": { - "vue-loader": "^15.7.2", - "vue-template-compiler": "^2.6.10" - } -} diff --git a/oldstuff/vuefun/src/App.vue b/oldstuff/vuefun/src/App.vue deleted file mode 100644 index dd1696b..0000000 --- a/oldstuff/vuefun/src/App.vue +++ /dev/null @@ -1,43 +0,0 @@ - - - - - diff --git a/oldstuff/vuefun/src/index.html b/oldstuff/vuefun/src/index.html deleted file mode 100644 index 6a636fa..0000000 --- a/oldstuff/vuefun/src/index.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - vuefun - - -
    - - diff --git a/oldstuff/vuefun/src/index.js b/oldstuff/vuefun/src/index.js deleted file mode 100644 index 3d1aece..0000000 --- a/oldstuff/vuefun/src/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import Vue from 'vue' -import App from './App' - -const app = new Vue({ - el: '#app', - template: '', - components: { App }, -}) diff --git a/oldstuff/vuefun/webpack.config.js b/oldstuff/vuefun/webpack.config.js deleted file mode 100644 index 95a4f25..0000000 --- a/oldstuff/vuefun/webpack.config.js +++ /dev/null @@ -1,109 +0,0 @@ -const path = require('path'); -const webpack = require('webpack'); -const VueLoaderPlugin = require('vue-loader/lib/plugin'); - -/* - * SplitChunksPlugin is enabled by default and replaced - * deprecated CommonsChunkPlugin. It automatically identifies modules which - * should be splitted of chunk by heuristics using module duplication count and - * module category (i. e. node_modules). And splits the chunks… - * - * It is safe to remove "splitChunks" from the generated configuration - * and was added as an educational example. - * - * https://webpack.js.org/plugins/split-chunks-plugin/ - * - */ - -const HtmlWebpackPlugin = require('html-webpack-plugin'); - -/* - * We've enabled HtmlWebpackPlugin for you! This generates a html - * page for you when you compile webpack, which will make you start - * developing and prototyping faster. - * - * https://github.com/jantimon/html-webpack-plugin - * - */ - -module.exports = { - mode: 'development', - entry: path.resolve(__dirname, 'src/index.js'), - - output: { - filename: '[name].[chunkhash].js', - path: path.resolve(__dirname, 'dist') - }, - - plugins: [ - new webpack.ProgressPlugin(), - new HtmlWebpackPlugin({ - template: path.resolve(__dirname, 'src/index.html'), - }), - new VueLoaderPlugin(), - ], - - module: { - rules: [ - { - test: /\.vue$/, - exclude: /node_modules/, - loader: 'vue-loader', - options: { - loaders: { - 'scss': 'vue-style-loader!css-loader!sass-loader', - }, - }, - }, - { - test: /\.scss$/, - use: [ - 'style-loader', - 'css-loader', - 'sass-loader' - ] - }, - { - test: /\.js$/, - exclude: /node_modules/, - loader: 'babel-loader', - }, - { - test: /\.css$/, - use: [ - 'vue-style-loader', - 'css-loader' - ] - }, - ] - }, - - resolve: { - extensions: ['.js', '.vue', '.json'], - alias: { - 'vue$': 'vue/dist/vue.esm.js', - }, - }, - - devtool: '#eval-source-map', - - optimization: { - splitChunks: { - cacheGroups: { - vendors: { - priority: -10, - test: /[\\/]node_modules[\\/]/ - } - }, - - chunks: 'async', - minChunks: 1, - minSize: 30000, - name: true - } - }, - - devServer: { - open: true - } -}; diff --git a/oldstuff/vuefun/yarn.lock b/oldstuff/vuefun/yarn.lock deleted file mode 100644 index f3f1cd6..0000000 --- a/oldstuff/vuefun/yarn.lock +++ /dev/null @@ -1,8615 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" - integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== - dependencies: - "@babel/highlight" "^7.0.0" - -"@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.0.tgz#461d2948b1a7113088baf999499bcbd39a7faa3b" - integrity sha512-Bb1NjZCaiwTQC/ARL+MwDpgocdnwWDCaugvkGt6cxfBzQa8Whv1JybBoUEiBDKl8Ni3H3c7Fykwk7QChUsHRlg== - dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.7.0" - "@babel/helpers" "^7.7.0" - "@babel/parser" "^7.7.0" - "@babel/template" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - convert-source-map "^1.1.0" - debug "^4.1.0" - json5 "^2.1.0" - lodash "^4.17.13" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - -"@babel/generator@^7.4.0", "@babel/generator@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.0.tgz#c6d4d1f7a0d6e139cbd01aca73170b0bff5425b4" - integrity sha512-1wdJ6UxHyL1XoJQ119JmvuRX27LRih7iYStMPZOWAjQqeAabFg3dYXKMpgihma+to+0ADsTVVt6oRyUxWZw6Mw== - dependencies: - "@babel/types" "^7.7.0" - jsesc "^2.5.1" - lodash "^4.17.13" - source-map "^0.5.0" - -"@babel/helper-annotate-as-pure@^7.0.0", "@babel/helper-annotate-as-pure@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.0.tgz#efc54032d43891fe267679e63f6860aa7dbf4a5e" - integrity sha512-k50CQxMlYTYo+GGyUGFwpxKVtxVJi9yh61sXZji3zYHccK9RYliZGSTOgci85T+r+0VFN2nWbGM04PIqwfrpMg== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.7.0.tgz#32dd9551d6ed3a5fc2edc50d6912852aa18274d9" - integrity sha512-Cd8r8zs4RKDwMG/92lpZcnn5WPQ3LAMQbCw42oqUh4s7vsSN5ANUZjMel0OOnxDLq57hoDDbai+ryygYfCTOsw== - dependencies: - "@babel/helper-explode-assignable-expression" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/helper-call-delegate@^7.4.4": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.7.0.tgz#df8942452c2c1a217335ca7e393b9afc67f668dc" - integrity sha512-Su0Mdq7uSSWGZayGMMQ+z6lnL00mMCnGAbO/R0ZO9odIdB/WNU/VfQKqMQU0fdIsxQYbRjDM4BixIa93SQIpvw== - dependencies: - "@babel/helper-hoist-variables" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/helper-create-class-features-plugin@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.7.0.tgz#bcdc223abbfdd386f94196ae2544987f8df775e8" - integrity sha512-MZiB5qvTWoyiFOgootmRSDV1udjIqJW/8lmxgzKq6oDqxdmHUjeP2ZUOmgHdYjmUVNABqRrHjYAYRvj8Eox/UA== - dependencies: - "@babel/helper-function-name" "^7.7.0" - "@babel/helper-member-expression-to-functions" "^7.7.0" - "@babel/helper-optimise-call-expression" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.7.0" - "@babel/helper-split-export-declaration" "^7.7.0" - -"@babel/helper-create-regexp-features-plugin@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.0.tgz#2e8badfe201cfafb5d930f46cf1e0b6f1cdcab23" - integrity sha512-ZhagAAVGD3L6MPM9/zZi7RRteonfBFLVUz3kjsnYsMAtr9hOJCKI9BAKIMpqn3NyWicPieoX779UL+7/3BEAOA== - dependencies: - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.6.0" - -"@babel/helper-define-map@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.7.0.tgz#60b0e9fd60def9de5054c38afde8c8ee409c7529" - integrity sha512-kPKWPb0dMpZi+ov1hJiwse9dWweZsz3V9rP4KdytnX1E7z3cTNmFGglwklzFPuqIcHLIY3bgKSs4vkwXXdflQA== - dependencies: - "@babel/helper-function-name" "^7.7.0" - "@babel/types" "^7.7.0" - lodash "^4.17.13" - -"@babel/helper-explode-assignable-expression@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.7.0.tgz#db2a6705555ae1f9f33b4b8212a546bc7f9dc3ef" - integrity sha512-CDs26w2shdD1urNUAji2RJXyBFCaR+iBEGnFz3l7maizMkQe3saVw9WtjG1tz8CwbjvlFnaSLVhgnu1SWaherg== - dependencies: - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/helper-function-name@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.7.0.tgz#44a5ad151cfff8ed2599c91682dda2ec2c8430a3" - integrity sha512-tDsJgMUAP00Ugv8O2aGEua5I2apkaQO7lBGUq1ocwN3G23JE5Dcq0uh3GvFTChPa4b40AWiAsLvCZOA2rdnQ7Q== - dependencies: - "@babel/helper-get-function-arity" "^7.7.0" - "@babel/template" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/helper-get-function-arity@^7.0.0", "@babel/helper-get-function-arity@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.0.tgz#c604886bc97287a1d1398092bc666bc3d7d7aa2d" - integrity sha512-tLdojOTz4vWcEnHWHCuPN5P85JLZWbm5Fx5ZsMEMPhF3Uoe3O7awrbM2nQ04bDOUToH/2tH/ezKEOR8zEYzqyw== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-hoist-variables@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.7.0.tgz#b4552e4cfe5577d7de7b183e193e84e4ec538c81" - integrity sha512-LUe/92NqsDAkJjjCEWkNe+/PcpnisvnqdlRe19FahVapa4jndeuJ+FBiTX1rcAKWKcJGE+C3Q3tuEuxkSmCEiQ== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-member-expression-to-functions@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.7.0.tgz#472b93003a57071f95a541ea6c2b098398bcad8a" - integrity sha512-QaCZLO2RtBcmvO/ekOLp8p7R5X2JriKRizeDpm5ChATAFWrrYDcDxPuCIBXKyBjY+i1vYSdcUTMIb8psfxHDPA== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-module-imports@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.7.0.tgz#99c095889466e5f7b6d66d98dffc58baaf42654d" - integrity sha512-Dv3hLKIC1jyfTkClvyEkYP2OlkzNvWs5+Q8WgPbxM5LMeorons7iPP91JM+DU7tRbhqA1ZeooPaMFvQrn23RHw== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.0.tgz#154a69f0c5b8fd4d39e49750ff7ac4faa3f36786" - integrity sha512-rXEefBuheUYQyX4WjV19tuknrJFwyKw0HgzRwbkyTbB+Dshlq7eqkWbyjzToLrMZk/5wKVKdWFluiAsVkHXvuQ== - dependencies: - "@babel/helper-module-imports" "^7.7.0" - "@babel/helper-simple-access" "^7.7.0" - "@babel/helper-split-export-declaration" "^7.7.0" - "@babel/template" "^7.7.0" - "@babel/types" "^7.7.0" - lodash "^4.17.13" - -"@babel/helper-optimise-call-expression@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.0.tgz#4f66a216116a66164135dc618c5d8b7a959f9365" - integrity sha512-48TeqmbazjNU/65niiiJIJRc5JozB8acui1OS7bSd6PgxfuovWsvjfWSzlgx+gPFdVveNzUdpdIg5l56Pl5jqg== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-plugin-utils@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" - integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== - -"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.5.5.tgz#0aa6824f7100a2e0e89c1527c23936c152cab351" - integrity sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw== - dependencies: - lodash "^4.17.13" - -"@babel/helper-remap-async-to-generator@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.0.tgz#4d69ec653e8bff5bce62f5d33fc1508f223c75a7" - integrity sha512-pHx7RN8X0UNHPB/fnuDnRXVZ316ZigkO8y8D835JlZ2SSdFKb6yH9MIYRU4fy/KPe5sPHDFOPvf8QLdbAGGiyw== - dependencies: - "@babel/helper-annotate-as-pure" "^7.7.0" - "@babel/helper-wrap-function" "^7.7.0" - "@babel/template" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/helper-replace-supers@^7.5.5", "@babel/helper-replace-supers@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.7.0.tgz#d5365c8667fe7cbd13b8ddddceb9bd7f2b387512" - integrity sha512-5ALYEul5V8xNdxEeWvRsBzLMxQksT7MaStpxjJf9KsnLxpAKBtfw5NeMKZJSYDa0lKdOcy0g+JT/f5mPSulUgg== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.7.0" - "@babel/helper-optimise-call-expression" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/helper-simple-access@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.7.0.tgz#97a8b6c52105d76031b86237dc1852b44837243d" - integrity sha512-AJ7IZD7Eem3zZRuj5JtzFAptBw7pMlS3y8Qv09vaBWoFsle0d1kAn5Wq6Q9MyBXITPOKnxwkZKoAm4bopmv26g== - dependencies: - "@babel/template" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/helper-split-export-declaration@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.0.tgz#1365e74ea6c614deeb56ebffabd71006a0eb2300" - integrity sha512-HgYSI8rH08neWlAH3CcdkFg9qX9YsZysZI5GD8LjhQib/mM0jGOZOVkoUiiV2Hu978fRtjtsGsW6w0pKHUWtqA== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-wrap-function@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.7.0.tgz#15af3d3e98f8417a60554acbb6c14e75e0b33b74" - integrity sha512-sd4QjeMgQqzshSjecZjOp8uKfUtnpmCyQhKQrVJBBgeHAB/0FPi33h3AbVlVp07qQtMD4QgYSzaMI7VwncNK/w== - dependencies: - "@babel/helper-function-name" "^7.7.0" - "@babel/template" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/helpers@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.7.0.tgz#359bb5ac3b4726f7c1fde0ec75f64b3f4275d60b" - integrity sha512-VnNwL4YOhbejHb7x/b5F39Zdg5vIQpUUNzJwx0ww1EcVRt41bbGRZWhAURrfY32T5zTT3qwNOQFWpn+P0i0a2g== - dependencies: - "@babel/template" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/highlight@^7.0.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" - integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^4.0.0" - -"@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.0.tgz#232618f6e8947bc54b407fa1f1c91a22758e7159" - integrity sha512-GqL+Z0d7B7ADlQBMXlJgvXEbtt5qlqd1YQ5fr12hTSfh7O/vgrEIvJxU2e7aSVrEUn75zTZ6Nd0s8tthrlZnrQ== - -"@babel/plugin-proposal-async-generator-functions@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.0.tgz#83ef2d6044496b4c15d8b4904e2219e6dccc6971" - integrity sha512-ot/EZVvf3mXtZq0Pd0+tSOfGWMizqmOohXmNZg6LNFjHOV+wOPv7BvVYh8oPR8LhpIP3ye8nNooKL50YRWxpYA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.7.0" - "@babel/plugin-syntax-async-generators" "^7.2.0" - -"@babel/plugin-proposal-class-properties@^7.1.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.7.0.tgz#ac54e728ecf81d90e8f4d2a9c05a890457107917" - integrity sha512-tufDcFA1Vj+eWvwHN+jvMN6QsV5o+vUlytNKrbMiCeDL0F2j92RURzUsUMWE5EJkLyWxjdUslCsMQa9FWth16A== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-proposal-dynamic-import@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.7.0.tgz#dc02a8bad8d653fb59daf085516fa416edd2aa7f" - integrity sha512-7poL3Xi+QFPC7sGAzEIbXUyYzGJwbc2+gSD0AkiC5k52kH2cqHdqxm5hNFfLW3cRSTcx9bN0Fl7/6zWcLLnKAQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - -"@babel/plugin-proposal-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" - integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - -"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.6.2.tgz#8ffccc8f3a6545e9f78988b6bf4fe881b88e8096" - integrity sha512-LDBXlmADCsMZV1Y9OQwMc0MyGZ8Ta/zlD9N67BfQT8uYwkRswiu2hU6nJKrjrt/58aH/vqfQlR/9yId/7A2gWw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - -"@babel/plugin-proposal-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" - integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - -"@babel/plugin-proposal-unicode-property-regex@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.0.tgz#549fe1717a1bd0a2a7e63163841cb37e78179d5d" - integrity sha512-mk34H+hp7kRBWJOOAR0ZMGCydgKMD4iN9TpDRp3IIcbunltxEY89XSimc6WbtSLCDrwcdy/EEw7h5CFCzxTchw== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-async-generators@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" - integrity sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-dynamic-import@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" - integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-flow@^7.2.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.7.0.tgz#5c9465bcd26354d5215294ea90ab1c706a571386" - integrity sha512-vQMV07p+L+jZeUnvX3pEJ9EiXGCjB5CTTvsirFD9rpEuATnoAvLBLoYbw1v5tyn3d2XxSuvEKi8cV3KqYUa0vQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" - integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" - integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" - integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-top-level-await@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.0.tgz#f5699549f50bbe8d12b1843a4e82f0a37bb65f4d" - integrity sha512-hi8FUNiFIY1fnUI2n1ViB1DR0R4QeK4iHcTlW6aJkrPoTdb8Rf1EMQ6GT3f67DDkYyWgew9DFoOZ6gOoEsdzTA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-typescript@^7.2.0": - version "7.3.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz#a7cc3f66119a9f7ebe2de5383cce193473d65991" - integrity sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-arrow-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" - integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-async-to-generator@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.0.tgz#e2b84f11952cf5913fe3438b7d2585042772f492" - integrity sha512-vLI2EFLVvRBL3d8roAMqtVY0Bm9C1QzLkdS57hiKrjUBSqsQYrBsMCeOg/0KK7B0eK9V71J5mWcha9yyoI2tZw== - dependencies: - "@babel/helper-module-imports" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.7.0" - -"@babel/plugin-transform-block-scoped-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" - integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-block-scoping@^7.6.3": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" - integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - lodash "^4.17.13" - -"@babel/plugin-transform-classes@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.0.tgz#b411ecc1b8822d24b81e5d184f24149136eddd4a" - integrity sha512-/b3cKIZwGeUesZheU9jNYcwrEA7f/Bo4IdPmvp7oHgvks2majB5BoT5byAql44fiNQYOPzhk2w8DbgfuafkMoA== - dependencies: - "@babel/helper-annotate-as-pure" "^7.7.0" - "@babel/helper-define-map" "^7.7.0" - "@babel/helper-function-name" "^7.7.0" - "@babel/helper-optimise-call-expression" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.7.0" - "@babel/helper-split-export-declaration" "^7.7.0" - globals "^11.1.0" - -"@babel/plugin-transform-computed-properties@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" - integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-destructuring@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz#44bbe08b57f4480094d57d9ffbcd96d309075ba6" - integrity sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-dotall-regex@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.0.tgz#c5c9ecacab3a5e0c11db6981610f0c32fd698b3b" - integrity sha512-3QQlF7hSBnSuM1hQ0pS3pmAbWLax/uGNCbPBND9y+oJ4Y776jsyujG2k0Sn2Aj2a0QwVOiOFL5QVPA7spjvzSA== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-duplicate-keys@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" - integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-exponentiation-operator@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" - integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== - dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-flow-strip-types@^7.0.0": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.6.3.tgz#8110f153e7360cfd5996eee68706cfad92d85256" - integrity sha512-l0ETkyEofkqFJ9LS6HChNIKtVJw2ylKbhYMlJ5C6df+ldxxaLIyXY4yOdDQQspfFpV8/vDiaWoJlvflstlYNxg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" - -"@babel/plugin-transform-for-of@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" - integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-function-name@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.0.tgz#0fa786f1eef52e3b7d4fc02e54b2129de8a04c2a" - integrity sha512-P5HKu0d9+CzZxP5jcrWdpe7ZlFDe24bmqP6a6X8BHEBl/eizAsY8K6LX8LASZL0Jxdjm5eEfzp+FIrxCm/p8bA== - dependencies: - "@babel/helper-function-name" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" - integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-member-expression-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d" - integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-modules-amd@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" - integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== - dependencies: - "@babel/helper-module-transforms" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" - babel-plugin-dynamic-import-node "^2.3.0" - -"@babel/plugin-transform-modules-commonjs@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.0.tgz#3e5ffb4fd8c947feede69cbe24c9554ab4113fe3" - integrity sha512-KEMyWNNWnjOom8vR/1+d+Ocz/mILZG/eyHHO06OuBQ2aNhxT62fr4y6fGOplRx+CxCSp3IFwesL8WdINfY/3kg== - dependencies: - "@babel/helper-module-transforms" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.7.0" - babel-plugin-dynamic-import-node "^2.3.0" - -"@babel/plugin-transform-modules-systemjs@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.0.tgz#9baf471213af9761c1617bb12fd278e629041417" - integrity sha512-ZAuFgYjJzDNv77AjXRqzQGlQl4HdUM6j296ee4fwKVZfhDR9LAGxfvXjBkb06gNETPnN0sLqRm9Gxg4wZH6dXg== - dependencies: - "@babel/helper-hoist-variables" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - babel-plugin-dynamic-import-node "^2.3.0" - -"@babel/plugin-transform-modules-umd@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.7.0.tgz#d62c7da16670908e1d8c68ca0b5d4c0097b69966" - integrity sha512-u7eBA03zmUswQ9LQ7Qw0/ieC1pcAkbp5OQatbWUzY1PaBccvuJXUkYzoN1g7cqp7dbTu6Dp9bXyalBvD04AANA== - dependencies: - "@babel/helper-module-transforms" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-named-capturing-groups-regex@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.7.0.tgz#358e6fd869b9a4d8f5cbc79e4ed4fc340e60dcaf" - integrity sha512-+SicSJoKouPctL+j1pqktRVCgy+xAch1hWWTMy13j0IflnyNjaoskj+DwRQFimHbLqO3sq2oN2CXMvXq3Bgapg== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.0" - -"@babel/plugin-transform-new-target@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" - integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-object-super@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz#c70021df834073c65eb613b8679cc4a381d1a9f9" - integrity sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.5.5" - -"@babel/plugin-transform-parameters@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" - integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== - dependencies: - "@babel/helper-call-delegate" "^7.4.4" - "@babel/helper-get-function-arity" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-property-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905" - integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-regenerator@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.0.tgz#f1b20b535e7716b622c99e989259d7dd942dd9cc" - integrity sha512-AXmvnC+0wuj/cFkkS/HFHIojxH3ffSXE+ttulrqWjZZRaUOonfJc60e1wSNT4rV8tIunvu/R3wCp71/tLAa9xg== - dependencies: - regenerator-transform "^0.14.0" - -"@babel/plugin-transform-reserved-words@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634" - integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-shorthand-properties@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" - integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-spread@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.6.2.tgz#fc77cf798b24b10c46e1b51b1b88c2bf661bb8dd" - integrity sha512-DpSvPFryKdK1x+EDJYCy28nmAaIMdxmhot62jAXF/o99iA33Zj2Lmcp3vDmz+MUh0LNYVPvfj5iC3feb3/+PFg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-sticky-regex@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" - integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.0.0" - -"@babel/plugin-transform-template-literals@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" - integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== - dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-typeof-symbol@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" - integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-typescript@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.7.0.tgz#182be03fa8bd2ffd0629791a1eaa4373b7589d38" - integrity sha512-y3KYbcfKe+8ziRXiGhhnGrVysDBo5+aJdB+x8sanM0K41cnmK7Q5vBlQLMbOnW/HPjLG9bg7dLgYDQZZG9T09g== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-typescript" "^7.2.0" - -"@babel/plugin-transform-unicode-regex@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.7.0.tgz#743d9bcc44080e3cc7d49259a066efa30f9187a3" - integrity sha512-RrThb0gdrNwFAqEAAx9OWgtx6ICK69x7i9tCnMdVrxQwSDp/Abu9DXFU5Hh16VP33Rmxh04+NGW28NsIkFvFKA== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/preset-env@^7.1.6", "@babel/preset-env@^7.7.1": - version "7.7.1" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.1.tgz#04a2ff53552c5885cf1083e291c8dd5490f744bb" - integrity sha512-/93SWhi3PxcVTDpSqC+Dp4YxUu3qZ4m7I76k0w73wYfn7bGVuRIO4QUz95aJksbS+AD1/mT1Ie7rbkT0wSplaA== - dependencies: - "@babel/helper-module-imports" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.7.0" - "@babel/plugin-proposal-dynamic-import" "^7.7.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.6.2" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.7.0" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-syntax-top-level-await" "^7.7.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.7.0" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.6.3" - "@babel/plugin-transform-classes" "^7.7.0" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.6.0" - "@babel/plugin-transform-dotall-regex" "^7.7.0" - "@babel/plugin-transform-duplicate-keys" "^7.5.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.4" - "@babel/plugin-transform-function-name" "^7.7.0" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-member-expression-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.5.0" - "@babel/plugin-transform-modules-commonjs" "^7.7.0" - "@babel/plugin-transform-modules-systemjs" "^7.7.0" - "@babel/plugin-transform-modules-umd" "^7.7.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.7.0" - "@babel/plugin-transform-new-target" "^7.4.4" - "@babel/plugin-transform-object-super" "^7.5.5" - "@babel/plugin-transform-parameters" "^7.4.4" - "@babel/plugin-transform-property-literals" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.7.0" - "@babel/plugin-transform-reserved-words" "^7.2.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.6.2" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.4.4" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.7.0" - "@babel/types" "^7.7.1" - browserslist "^4.6.0" - core-js-compat "^3.1.1" - invariant "^2.2.2" - js-levenshtein "^1.1.3" - semver "^5.5.0" - -"@babel/preset-flow@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" - integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" - -"@babel/preset-typescript@^7.1.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.7.0.tgz#5d7682d938160ceaf51c3d4239e9521ef893474c" - integrity sha512-WZ3qvtAJy8w/i6wqq5PuDnkCUXaLUTHIlJujfGHmHxsT5veAbEdEjl3cC/3nXfyD0bzlWsIiMdUhZgrXjd9QWg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-typescript" "^7.7.0" - -"@babel/register@^7.0.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.0.tgz#4e23ecf840296ef79c605baaa5c89e1a2426314b" - integrity sha512-HV3GJzTvSoyOMWGYn2TAh6uL6g+gqKTgEZ99Q3+X9UURT1VPT/WcU46R61XftIc5rXytcOHZ4Z0doDlsjPomIg== - dependencies: - find-cache-dir "^2.0.0" - lodash "^4.17.13" - make-dir "^2.1.0" - pirates "^4.0.0" - source-map-support "^0.5.16" - -"@babel/template@^7.4.0", "@babel/template@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.0.tgz#4fadc1b8e734d97f56de39c77de76f2562e597d0" - integrity sha512-OKcwSYOW1mhWbnTBgQY5lvg1Fxg+VyfQGjcBduZFljfc044J5iDlnDSfhQ867O17XHiSCxYHUxHg2b7ryitbUQ== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.7.0" - "@babel/types" "^7.7.0" - -"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.0.tgz#9f5744346b8d10097fd2ec2eeffcaf19813cbfaf" - integrity sha512-ea/3wRZc//e/uwCpuBX2itrhI0U9l7+FsrKWyKGNyvWbuMcCG7ATKY2VI4wlg2b2TA39HHwIxnvmXvtiKsyn7w== - dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.7.0" - "@babel/helper-function-name" "^7.7.0" - "@babel/helper-split-export-declaration" "^7.7.0" - "@babel/parser" "^7.7.0" - "@babel/types" "^7.7.0" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - -"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.7.0", "@babel/types@^7.7.1": - version "7.7.1" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.1.tgz#8b08ea368f2baff236613512cf67109e76285827" - integrity sha512-kN/XdANDab9x1z5gcjDc9ePpxexkt+1EQ2MQUiM4XnMvQfvp87/+6kY4Ko2maLXH+tei/DgJ/ybFITeqqRwDiA== - dependencies: - esutils "^2.0.2" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - -"@cnakazawa/watch@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" - integrity sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA== - dependencies: - exec-sh "^0.3.2" - minimist "^1.2.0" - -"@jest/console@^24.7.1", "@jest/console@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" - integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== - dependencies: - "@jest/source-map" "^24.9.0" - chalk "^2.0.1" - slash "^2.0.0" - -"@jest/core@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" - integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== - dependencies: - "@jest/console" "^24.7.1" - "@jest/reporters" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - ansi-escapes "^3.0.0" - chalk "^2.0.1" - exit "^0.1.2" - graceful-fs "^4.1.15" - jest-changed-files "^24.9.0" - jest-config "^24.9.0" - jest-haste-map "^24.9.0" - jest-message-util "^24.9.0" - jest-regex-util "^24.3.0" - jest-resolve "^24.9.0" - jest-resolve-dependencies "^24.9.0" - jest-runner "^24.9.0" - jest-runtime "^24.9.0" - jest-snapshot "^24.9.0" - jest-util "^24.9.0" - jest-validate "^24.9.0" - jest-watcher "^24.9.0" - micromatch "^3.1.10" - p-each-series "^1.0.0" - realpath-native "^1.1.0" - rimraf "^2.5.4" - slash "^2.0.0" - strip-ansi "^5.0.0" - -"@jest/environment@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" - integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== - dependencies: - "@jest/fake-timers" "^24.9.0" - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - jest-mock "^24.9.0" - -"@jest/fake-timers@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" - integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== - dependencies: - "@jest/types" "^24.9.0" - jest-message-util "^24.9.0" - jest-mock "^24.9.0" - -"@jest/reporters@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" - integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== - dependencies: - "@jest/environment" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - chalk "^2.0.1" - exit "^0.1.2" - glob "^7.1.2" - istanbul-lib-coverage "^2.0.2" - istanbul-lib-instrument "^3.0.1" - istanbul-lib-report "^2.0.4" - istanbul-lib-source-maps "^3.0.1" - istanbul-reports "^2.2.6" - jest-haste-map "^24.9.0" - jest-resolve "^24.9.0" - jest-runtime "^24.9.0" - jest-util "^24.9.0" - jest-worker "^24.6.0" - node-notifier "^5.4.2" - slash "^2.0.0" - source-map "^0.6.0" - string-length "^2.0.0" - -"@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" - integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== - dependencies: - callsites "^3.0.0" - graceful-fs "^4.1.15" - source-map "^0.6.0" - -"@jest/test-result@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" - integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== - dependencies: - "@jest/console" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/istanbul-lib-coverage" "^2.0.0" - -"@jest/test-sequencer@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" - integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== - dependencies: - "@jest/test-result" "^24.9.0" - jest-haste-map "^24.9.0" - jest-runner "^24.9.0" - jest-runtime "^24.9.0" - -"@jest/transform@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" - integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== - dependencies: - "@babel/core" "^7.1.0" - "@jest/types" "^24.9.0" - babel-plugin-istanbul "^5.1.0" - chalk "^2.0.1" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" - graceful-fs "^4.1.15" - jest-haste-map "^24.9.0" - jest-regex-util "^24.9.0" - jest-util "^24.9.0" - micromatch "^3.1.10" - pirates "^4.0.1" - realpath-native "^1.1.0" - slash "^2.0.0" - source-map "^0.6.1" - write-file-atomic "2.4.1" - -"@jest/types@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" - integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^13.0.0" - -"@mrmlnc/readdir-enhanced@^2.2.1": - version "2.2.1" - resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" - integrity sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g== - dependencies: - call-me-maybe "^1.0.1" - glob-to-regexp "^0.3.0" - -"@nodelib/fs.stat@^1.1.2": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" - integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== - -"@sindresorhus/is@^0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" - integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow== - -"@types/babel__core@^7.1.0": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" - integrity sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.0.tgz#f1ec1c104d1bb463556ecb724018ab788d0c172a" - integrity sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" - integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.0.7" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.7.tgz#2496e9ff56196cc1429c72034e07eab6121b6f3f" - integrity sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw== - dependencies: - "@babel/types" "^7.3.0" - -"@types/events@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" - integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== - -"@types/glob@^7.1.1": - version "7.1.1" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" - integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== - dependencies: - "@types/events" "*" - "@types/minimatch" "*" - "@types/node" "*" - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" - integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg== - -"@types/istanbul-lib-report@*": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#e5471e7fa33c61358dd38426189c037a58433b8c" - integrity sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg== - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz#7a8cbf6a406f36c8add871625b278eaf0b0d255a" - integrity sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA== - dependencies: - "@types/istanbul-lib-coverage" "*" - "@types/istanbul-lib-report" "*" - -"@types/minimatch@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" - integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== - -"@types/node@*": - version "12.12.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.6.tgz#a47240c10d86a9a57bb0c633f0b2e0aea9ce9253" - integrity sha512-FjsYUPzEJdGXjwKqSpE0/9QEh6kzhTAeObA54rn6j3rR4C/mzpI9L0KNfoeASSPMMdxIsoJuCLDWcM/rVjIsSA== - -"@types/stack-utils@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" - integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== - -"@types/yargs-parser@*": - version "13.1.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" - integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== - -"@types/yargs@^13.0.0": - version "13.0.3" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380" - integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ== - dependencies: - "@types/yargs-parser" "*" - -"@vue/component-compiler-utils@^3.0.0": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@vue/component-compiler-utils/-/component-compiler-utils-3.0.2.tgz#7daf8aaf0d5faa66e7c8a1f6fea315630e45fbc9" - integrity sha512-BSnY2PmW4QwU1AOcGSNYAmEPLjdQ9itl1YpLCWtpwMA5Jy/aqWNuzZ9+ZZ8h6yZJ53W95tVkEP6yrXJ/zUHdEA== - dependencies: - consolidate "^0.15.1" - hash-sum "^1.0.2" - lru-cache "^4.1.2" - merge-source-map "^1.1.0" - postcss "^7.0.14" - postcss-selector-parser "^5.0.0" - prettier "^1.18.2" - source-map "~0.6.1" - vue-template-es2015-compiler "^1.9.0" - -"@webassemblyjs/ast@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" - integrity sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ== - dependencies: - "@webassemblyjs/helper-module-context" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/wast-parser" "1.8.5" - -"@webassemblyjs/floating-point-hex-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz#1ba926a2923613edce496fd5b02e8ce8a5f49721" - integrity sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ== - -"@webassemblyjs/helper-api-error@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz#c49dad22f645227c5edb610bdb9697f1aab721f7" - integrity sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA== - -"@webassemblyjs/helper-buffer@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz#fea93e429863dd5e4338555f42292385a653f204" - integrity sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q== - -"@webassemblyjs/helper-code-frame@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz#9a740ff48e3faa3022b1dff54423df9aa293c25e" - integrity sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ== - dependencies: - "@webassemblyjs/wast-printer" "1.8.5" - -"@webassemblyjs/helper-fsm@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz#ba0b7d3b3f7e4733da6059c9332275d860702452" - integrity sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow== - -"@webassemblyjs/helper-module-context@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz#def4b9927b0101dc8cbbd8d1edb5b7b9c82eb245" - integrity sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g== - dependencies: - "@webassemblyjs/ast" "1.8.5" - mamacro "^0.0.3" - -"@webassemblyjs/helper-wasm-bytecode@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz#537a750eddf5c1e932f3744206551c91c1b93e61" - integrity sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ== - -"@webassemblyjs/helper-wasm-section@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz#74ca6a6bcbe19e50a3b6b462847e69503e6bfcbf" - integrity sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - -"@webassemblyjs/ieee754@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz#712329dbef240f36bf57bd2f7b8fb9bf4154421e" - integrity sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g== - dependencies: - "@xtuc/ieee754" "^1.2.0" - -"@webassemblyjs/leb128@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.8.5.tgz#044edeb34ea679f3e04cd4fd9824d5e35767ae10" - integrity sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A== - dependencies: - "@xtuc/long" "4.2.2" - -"@webassemblyjs/utf8@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.8.5.tgz#a8bf3b5d8ffe986c7c1e373ccbdc2a0915f0cedc" - integrity sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw== - -"@webassemblyjs/wasm-edit@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz#962da12aa5acc1c131c81c4232991c82ce56e01a" - integrity sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/helper-wasm-section" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - "@webassemblyjs/wasm-opt" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - "@webassemblyjs/wast-printer" "1.8.5" - -"@webassemblyjs/wasm-gen@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz#54840766c2c1002eb64ed1abe720aded714f98bc" - integrity sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/ieee754" "1.8.5" - "@webassemblyjs/leb128" "1.8.5" - "@webassemblyjs/utf8" "1.8.5" - -"@webassemblyjs/wasm-opt@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz#b24d9f6ba50394af1349f510afa8ffcb8a63d264" - integrity sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - -"@webassemblyjs/wasm-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz#21576f0ec88b91427357b8536383668ef7c66b8d" - integrity sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-api-error" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/ieee754" "1.8.5" - "@webassemblyjs/leb128" "1.8.5" - "@webassemblyjs/utf8" "1.8.5" - -"@webassemblyjs/wast-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz#e10eecd542d0e7bd394f6827c49f3df6d4eefb8c" - integrity sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/floating-point-hex-parser" "1.8.5" - "@webassemblyjs/helper-api-error" "1.8.5" - "@webassemblyjs/helper-code-frame" "1.8.5" - "@webassemblyjs/helper-fsm" "1.8.5" - "@xtuc/long" "4.2.2" - -"@webassemblyjs/wast-printer@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz#114bbc481fd10ca0e23b3560fa812748b0bae5bc" - integrity sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/wast-parser" "1.8.5" - "@xtuc/long" "4.2.2" - -"@webpack-cli/generators@^0.1.8": - version "0.1.8" - resolved "https://registry.yarnpkg.com/@webpack-cli/generators/-/generators-0.1.8.tgz#5cef426e4f39426915864800e1064cec395b3000" - integrity sha512-aEOZtnjgMVg/3AzgkuTZypUWxcFC0vHhPFy8mlIWcRsUmZQx+TyNi9PwmqC7ylqJW22g6iFKacmtrUK3qSxmtA== - dependencies: - "@webpack-cli/utils" "^0.2.2" - "@webpack-cli/webpack-scaffold" "^0.1.8" - chalk "^2.4.1" - glob-all "^3.1.0" - inquirer-autocomplete-prompt "^1.0.1" - lodash "^4.17.11" - log-symbols "^2.2.0" - mkdirp "^0.5.1" - webpack "4.x.x" - webpack-dev-server "^3.1.10" - yeoman-generator "^3.1.1" - -"@webpack-cli/init@^0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/@webpack-cli/init/-/init-0.2.2.tgz#1330cc6619110e5ce5dc6c13b8c3ae251e1e36aa" - integrity sha512-Wis17j6XiL8QxzFl9c8xGBoiHqtV9l6I4VOSf3SwVjpr9HM5fGe3Olbpd0O2DdNJTpH5PWMIcrUIGMm7tfYoDw== - dependencies: - "@webpack-cli/generators" "^0.1.8" - "@webpack-cli/utils" "^0.2.2" - chalk "^2.4.1" - jscodeshift "^0.6.4" - p-each-series "^1.0.0" - -"@webpack-cli/utils@^0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/@webpack-cli/utils/-/utils-0.2.2.tgz#d28c9564b59c6ea408e7e13b7809a032d6792365" - integrity sha512-tzyRLHdZIO0GfTz8/LHUv5PBaYbaT3ekKG2nzXkiNnkLWBo9JYBhR6N94+9ahqSCGwZ+Q+3igM/frdesQP43Sg== - dependencies: - chalk "^2.4.1" - cross-spawn "^6.0.5" - findup-sync "^3.0.0" - global-modules "^1.0.0" - got "8.x.x" - jest "^24.8.0" - jscodeshift "^0.6.4" - log-symbols "^2.2.0" - p-each-series "^1.0.0" - prettier "^1.17.0" - yeoman-environment "^2.3.4" - yeoman-generator "^3.1.1" - -"@webpack-cli/webpack-scaffold@^0.1.8": - version "0.1.8" - resolved "https://registry.yarnpkg.com/@webpack-cli/webpack-scaffold/-/webpack-scaffold-0.1.8.tgz#10acb4da30bc7d2a8e5986f3c187777f75d64694" - integrity sha512-sXL7VC7HQwaa0ppVT272kk060IqjrQxMge5WVo+Ls7F8cRklTdjkxPXhgWG0Q72/xeLOlu7hgCh5v2p86ULTng== - dependencies: - jscodeshift "^0.6.4" - -"@xtuc/ieee754@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" - integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== - -"@xtuc/long@4.2.2": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" - integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== - -abab@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.2.tgz#a2fba1b122c69a85caa02d10f9270c7219709a9d" - integrity sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg== - -abbrev@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" - integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== - -accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: - version "1.3.7" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" - integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== - dependencies: - mime-types "~2.1.24" - negotiator "0.6.2" - -acorn-globals@^4.1.0: - version "4.3.4" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" - integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== - dependencies: - acorn "^6.0.1" - acorn-walk "^6.0.1" - -acorn-walk@^6.0.1: - version "6.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" - integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== - -acorn@^5.5.3: - version "5.7.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" - integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== - -acorn@^6.0.1, acorn@^6.2.1: - version "6.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" - integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== - -ajv-errors@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" - integrity sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ== - -ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" - integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== - -ajv@^6.1.0, ajv@^6.10.2, ajv@^6.5.5: - version "6.10.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" - integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= - -ansi-colors@^3.0.0: - version "3.2.4" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" - integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== - -ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" - integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== - -ansi-html@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" - integrity sha1-gTWEAhliqenm/QOflA0S9WynhZ4= - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= - -ansi-regex@^4.0.0, ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= - -ansi-styles@^3.2.0, ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -anymatch@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" - integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== - dependencies: - micromatch "^3.1.4" - normalize-path "^2.1.1" - -aproba@^1.0.3, aproba@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== - -are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - -arr-diff@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" - integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= - -arr-flatten@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== - -arr-union@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" - integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= - -array-differ@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" - integrity sha1-7/UuN1gknTO+QCuLuOVkuytdQDE= - -array-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" - integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= - -array-find-index@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" - integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= - -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= - -array-flatten@^2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-2.1.2.tgz#24ef80a28c1a893617e2149b0c6d0d788293b099" - integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== - -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= - dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY= - -array-unique@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= - -arrify@^1.0.0, arrify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= - -asn1.js@^4.0.0: - version "4.10.1" - resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" - integrity sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw== - dependencies: - bn.js "^4.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - -asn1@~0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" - integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= - -assert@^1.1.1: - version "1.5.0" - resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" - integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA== - dependencies: - object-assign "^4.1.1" - util "0.10.3" - -assign-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= - -ast-types@0.11.7: - version "0.11.7" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.7.tgz#f318bf44e339db6a320be0009ded64ec1471f46c" - integrity sha512-2mP3TwtkY/aTv5X3ZsMpNAbOnyoC/aMJwJSoaELPkHId0nSQgFcnU4dRW3isxiz7+zBexk0ym3WNVjMiQBnJSw== - -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== - -async-each@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" - integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== - -async-foreach@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542" - integrity sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI= - -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - -async@^2.6.0, async@^2.6.2: - version "2.6.3" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" - integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== - dependencies: - lodash "^4.17.14" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= - -atob@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" - integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= - -aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== - -babel-core@^7.0.0-bridge.0: - version "7.0.0-bridge.0" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" - integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== - -babel-jest@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" - integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== - dependencies: - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/babel__core" "^7.1.0" - babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.9.0" - chalk "^2.4.2" - slash "^2.0.0" - -babel-loader@^8.0.6: - version "8.0.6" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.6.tgz#e33bdb6f362b03f4bb141a0c21ab87c501b70dfb" - integrity sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw== - dependencies: - find-cache-dir "^2.0.0" - loader-utils "^1.0.2" - mkdirp "^0.5.1" - pify "^4.0.1" - -babel-plugin-dynamic-import-node@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" - integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== - dependencies: - object.assign "^4.1.0" - -babel-plugin-istanbul@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" - integrity sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - find-up "^3.0.0" - istanbul-lib-instrument "^3.3.0" - test-exclude "^5.2.3" - -babel-plugin-jest-hoist@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" - integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== - dependencies: - "@types/babel__traverse" "^7.0.6" - -babel-plugin-syntax-dynamic-import@^6.18.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da" - integrity sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo= - -babel-preset-jest@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" - integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== - dependencies: - "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.9.0" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= - -base64-js@^1.0.2: - version "1.3.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" - integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== - -base@^0.11.1: - version "0.11.2" - resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" - integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== - dependencies: - cache-base "^1.0.1" - class-utils "^0.3.5" - component-emitter "^1.2.1" - define-property "^1.0.0" - isobject "^3.0.1" - mixin-deep "^1.2.0" - pascalcase "^0.1.1" - -batch@0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" - integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= - -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= - dependencies: - tweetnacl "^0.14.3" - -big.js@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" - integrity sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q== - -big.js@^5.2.2: - version "5.2.2" - resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" - integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== - -binary-extensions@^1.0.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" - integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== - -binaryextensions@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/binaryextensions/-/binaryextensions-2.1.2.tgz#c83c3d74233ba7674e4f313cb2a2b70f54e94b7c" - integrity sha512-xVNN69YGDghOqCCtA6FI7avYrr02mTJjOgB0/f1VPD3pJC8QEvjTKWc4epDx8AqxxA75NI0QpVM2gPJXUbE4Tg== - -block-stream@*: - version "0.0.9" - resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" - integrity sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo= - dependencies: - inherits "~2.0.0" - -bluebird@^3.1.1, bluebird@^3.5.5: - version "3.7.1" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.1.tgz#df70e302b471d7473489acf26a93d63b53f874de" - integrity sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg== - -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.8" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" - integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== - -body-parser@1.19.0: - version "1.19.0" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" - integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== - dependencies: - bytes "3.1.0" - content-type "~1.0.4" - debug "2.6.9" - depd "~1.1.2" - http-errors "1.7.2" - iconv-lite "0.4.24" - on-finished "~2.3.0" - qs "6.7.0" - raw-body "2.4.0" - type-is "~1.6.17" - -bonjour@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/bonjour/-/bonjour-3.5.0.tgz#8e890a183d8ee9a2393b3844c691a42bcf7bc9f5" - integrity sha1-jokKGD2O6aI5OzhExpGkK897yfU= - dependencies: - array-flatten "^2.1.0" - deep-equal "^1.0.1" - dns-equal "^1.0.0" - dns-txt "^2.0.2" - multicast-dns "^6.0.1" - multicast-dns-service-types "^1.1.0" - -boolbase@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" - integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^2.3.1, braces@^2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" - integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== - dependencies: - arr-flatten "^1.1.0" - array-unique "^0.3.2" - extend-shallow "^2.0.1" - fill-range "^4.0.0" - isobject "^3.0.1" - repeat-element "^1.1.2" - snapdragon "^0.8.1" - snapdragon-node "^2.0.1" - split-string "^3.0.2" - to-regex "^3.0.1" - -brorand@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= - -browser-process-hrtime@^0.1.2: - version "0.1.3" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" - integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw== - -browser-resolve@^1.11.3: - version "1.11.3" - resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" - integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== - dependencies: - resolve "1.1.7" - -browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.2.0" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" - integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== - dependencies: - buffer-xor "^1.0.3" - cipher-base "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.3" - inherits "^2.0.1" - safe-buffer "^5.0.1" - -browserify-cipher@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" - integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== - dependencies: - browserify-aes "^1.0.4" - browserify-des "^1.0.0" - evp_bytestokey "^1.0.0" - -browserify-des@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" - integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== - dependencies: - cipher-base "^1.0.1" - des.js "^1.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -browserify-rsa@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" - integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= - dependencies: - bn.js "^4.1.0" - randombytes "^2.0.1" - -browserify-sign@^4.0.0: - version "4.0.4" - resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" - integrity sha1-qk62jl17ZYuqa/alfmMMvXqT0pg= - dependencies: - bn.js "^4.1.1" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.2" - elliptic "^6.0.0" - inherits "^2.0.1" - parse-asn1 "^5.0.0" - -browserify-zlib@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" - integrity sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== - dependencies: - pako "~1.0.5" - -browserslist@^4.6.0, browserslist@^4.7.2: - version "4.7.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.7.2.tgz#1bb984531a476b5d389cedecb195b2cd69fb1348" - integrity sha512-uZavT/gZXJd2UTi9Ov7/Z340WOSQ3+m1iBVRUknf+okKxonL9P83S3ctiBDtuRmRu8PiCHjqyueqQ9HYlJhxiw== - dependencies: - caniuse-lite "^1.0.30001004" - electron-to-chromium "^1.3.295" - node-releases "^1.1.38" - -bser@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" - integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== - dependencies: - node-int64 "^0.4.0" - -buffer-alloc-unsafe@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" - integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== - -buffer-alloc@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" - integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== - dependencies: - buffer-alloc-unsafe "^1.1.0" - buffer-fill "^1.0.0" - -buffer-fill@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" - integrity sha1-+PeLdniYiO858gXNY39o5wISKyw= - -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== - -buffer-indexof@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-indexof/-/buffer-indexof-1.1.1.tgz#52fabcc6a606d1a00302802648ef68f639da268c" - integrity sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g== - -buffer-xor@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= - -buffer@^4.3.0: - version "4.9.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" - integrity sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg= - dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" - isarray "^1.0.0" - -builtin-status-codes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" - integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= - -bytes@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" - integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= - -bytes@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" - integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== - -cacache@^12.0.2: - version "12.0.3" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390" - integrity sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw== - dependencies: - bluebird "^3.5.5" - chownr "^1.1.1" - figgy-pudding "^3.5.1" - glob "^7.1.4" - graceful-fs "^4.1.15" - infer-owner "^1.0.3" - lru-cache "^5.1.1" - mississippi "^3.0.0" - mkdirp "^0.5.1" - move-concurrently "^1.0.1" - promise-inflight "^1.0.1" - rimraf "^2.6.3" - ssri "^6.0.1" - unique-filename "^1.1.1" - y18n "^4.0.0" - -cache-base@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" - integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== - dependencies: - collection-visit "^1.0.0" - component-emitter "^1.2.1" - get-value "^2.0.6" - has-value "^1.0.0" - isobject "^3.0.1" - set-value "^2.0.0" - to-object-path "^0.3.0" - union-value "^1.0.0" - unset-value "^1.0.0" - -cacheable-request@^2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-2.1.4.tgz#0d808801b6342ad33c91df9d0b44dc09b91e5c3d" - integrity sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0= - dependencies: - clone-response "1.0.2" - get-stream "3.0.0" - http-cache-semantics "3.8.1" - keyv "3.0.0" - lowercase-keys "1.0.0" - normalize-url "2.0.1" - responselike "1.0.2" - -call-me-maybe@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" - integrity sha1-JtII6onje1y95gJQoV8DHBak1ms= - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camel-case@3.0.x: - version "3.0.0" - resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" - integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M= - dependencies: - no-case "^2.2.0" - upper-case "^1.1.1" - -camelcase-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" - integrity sha1-MIvur/3ygRkFHvodkyITyRuPkuc= - dependencies: - camelcase "^2.0.0" - map-obj "^1.0.0" - -camelcase@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" - integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= - -camelcase@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" - integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= - -camelcase@^5.0.0, camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -caniuse-lite@^1.0.30001004: - version "1.0.30001008" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001008.tgz#b8841b1df78a9f5ed9702537ef592f1f8772c0d9" - integrity sha512-b8DJyb+VVXZGRgJUa30cbk8gKHZ3LOZTBLaUEEVr2P4xpmFigOCc62CO4uzquW641Ouq1Rm9N+rWLWdSYDaDIw== - -capture-exit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" - integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== - dependencies: - rsvp "^4.8.4" - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= - -chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -chardet@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" - integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== - -chokidar@^2.0.2, chokidar@^2.1.8: - version "2.1.8" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" - integrity sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg== - dependencies: - anymatch "^2.0.0" - async-each "^1.0.1" - braces "^2.3.2" - glob-parent "^3.1.0" - inherits "^2.0.3" - is-binary-path "^1.0.0" - is-glob "^4.0.0" - normalize-path "^3.0.0" - path-is-absolute "^1.0.0" - readdirp "^2.2.1" - upath "^1.1.1" - optionalDependencies: - fsevents "^1.2.7" - -chownr@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" - integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== - -chrome-trace-event@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4" - integrity sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ== - dependencies: - tslib "^1.9.0" - -ci-info@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" - integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== - -cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" - integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -class-utils@^0.3.5: - version "0.3.6" - resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" - integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== - dependencies: - arr-union "^3.1.0" - define-property "^0.2.5" - isobject "^3.0.0" - static-extend "^0.1.1" - -clean-css@4.2.x: - version "4.2.1" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17" - integrity sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g== - dependencies: - source-map "~0.6.0" - -cli-cursor@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" - integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= - dependencies: - restore-cursor "^2.0.0" - -cli-table@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/cli-table/-/cli-table-0.3.1.tgz#f53b05266a8b1a0b934b3d0821e6e2dc5914ae23" - integrity sha1-9TsFJmqLGguTSz0IIebi3FkUriM= - dependencies: - colors "1.0.3" - -cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= - -cliui@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" - integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - wrap-ansi "^2.0.0" - -cliui@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" - integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== - dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" - -cliui@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" - integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== - dependencies: - string-width "^3.1.0" - strip-ansi "^5.2.0" - wrap-ansi "^5.1.0" - -clone-buffer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58" - integrity sha1-4+JbIHrE5wGvch4staFnksrD3Fg= - -clone-deep@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" - integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== - dependencies: - is-plain-object "^2.0.4" - kind-of "^6.0.2" - shallow-clone "^3.0.0" - -clone-response@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b" - integrity sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws= - dependencies: - mimic-response "^1.0.0" - -clone-stats@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" - integrity sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE= - -clone-stats@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680" - integrity sha1-s3gt/4u1R04Yuba/D9/ngvh3doA= - -clone@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" - integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= - -clone@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= - -cloneable-readable@^1.0.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.1.3.tgz#120a00cb053bfb63a222e709f9683ea2e11d8cec" - integrity sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ== - dependencies: - inherits "^2.0.1" - process-nextick-args "^2.0.0" - readable-stream "^2.3.5" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= - -collection-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" - integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= - dependencies: - map-visit "^1.0.0" - object-visit "^1.0.0" - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= - -colors@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" - integrity sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs= - -colors@^1.1.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" - integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== - -combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commander@2.17.x: - version "2.17.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" - integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== - -commander@^2.20.0, commander@~2.20.3: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -commander@~2.19.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" - integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== - -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= - -component-emitter@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" - integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== - -compressible@~2.0.16: - version "2.0.17" - resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.17.tgz#6e8c108a16ad58384a977f3a482ca20bff2f38c1" - integrity sha512-BGHeLCK1GV7j1bSmQQAi26X+GgWcTjLr/0tzSvMCl3LH1w1IJ4PFSPoV5316b30cneTziC+B1a+3OjoSUcQYmw== - dependencies: - mime-db ">= 1.40.0 < 2" - -compression@^1.7.4: - version "1.7.4" - resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f" - integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ== - dependencies: - accepts "~1.3.5" - bytes "3.0.0" - compressible "~2.0.16" - debug "2.6.9" - on-headers "~1.0.2" - safe-buffer "5.1.2" - vary "~1.1.2" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - -concat-stream@^1.5.0: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -connect-history-api-fallback@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" - integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== - -console-browserify@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" - integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== - -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= - -consolidate@^0.15.1: - version "0.15.1" - resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.15.1.tgz#21ab043235c71a07d45d9aad98593b0dba56bab7" - integrity sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw== - dependencies: - bluebird "^3.1.1" - -constants-browserify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" - integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= - -content-disposition@0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" - integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== - dependencies: - safe-buffer "5.1.2" - -content-type@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" - integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== - -convert-source-map@^1.1.0, convert-source-map@^1.4.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" - integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== - dependencies: - safe-buffer "~5.1.1" - -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= - -cookie@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" - integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== - -copy-concurrently@^1.0.0: - version "1.0.5" - resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" - integrity sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A== - dependencies: - aproba "^1.1.1" - fs-write-stream-atomic "^1.0.8" - iferr "^0.1.5" - mkdirp "^0.5.1" - rimraf "^2.5.4" - run-queue "^1.0.0" - -copy-descriptor@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" - integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= - -core-js-compat@^3.1.1: - version "3.3.6" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.3.6.tgz#70c30dbeb582626efe9ecd6f49daa9ff4aeb136c" - integrity sha512-YnwZG/+0/f7Pf6Lr3jxtVAFjtGBW9lsLYcqrxhYJai1GfvrP8DEyEpnNzj/FRQfIkOOfk1j5tTBvPBLWVVJm4A== - dependencies: - browserslist "^4.7.2" - semver "^6.3.0" - -core-util-is@1.0.2, core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= - -create-ecdh@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" - integrity sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw== - dependencies: - bn.js "^4.1.0" - elliptic "^6.0.0" - -create-hash@^1.1.0, create-hash@^1.1.2: - version "1.2.0" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: - version "1.1.7" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -cross-spawn@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-3.0.1.tgz#1256037ecb9f0c5f79e3d6ef135e30770184b982" - integrity sha1-ElYDfsufDF9549bvE14wdwGEuYI= - dependencies: - lru-cache "^4.0.1" - which "^1.2.9" - -crypto-browserify@^3.11.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" - integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== - dependencies: - browserify-cipher "^1.0.0" - browserify-sign "^4.0.0" - create-ecdh "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.0" - diffie-hellman "^5.0.0" - inherits "^2.0.1" - pbkdf2 "^3.0.3" - public-encrypt "^4.0.0" - randombytes "^2.0.0" - randomfill "^1.0.3" - -css-loader@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.2.0.tgz#bb570d89c194f763627fcf1f80059c6832d009b2" - integrity sha512-QTF3Ud5H7DaZotgdcJjGMvyDj5F3Pn1j/sC6VBEOVp94cbwqyIBdcs/quzj4MC1BKQSrTpQznegH/5giYbhnCQ== - dependencies: - camelcase "^5.3.1" - cssesc "^3.0.0" - icss-utils "^4.1.1" - loader-utils "^1.2.3" - normalize-path "^3.0.0" - postcss "^7.0.17" - postcss-modules-extract-imports "^2.0.0" - postcss-modules-local-by-default "^3.0.2" - postcss-modules-scope "^2.1.0" - postcss-modules-values "^3.0.0" - postcss-value-parser "^4.0.0" - schema-utils "^2.0.0" - -css-select@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" - integrity sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg= - dependencies: - boolbase "~1.0.0" - css-what "2.1" - domutils "1.5.1" - nth-check "~1.0.1" - -css-what@2.1: - version "2.1.3" - resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2" - integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg== - -cssesc@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-2.0.0.tgz#3b13bd1bb1cb36e1bcb5a4dcd27f54c5dcb35703" - integrity sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg== - -cssesc@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" - integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== - -cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" - integrity sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA== - dependencies: - cssom "0.3.x" - -currently-unhandled@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" - integrity sha1-mI3zP+qxke95mmE2nddsF635V+o= - dependencies: - array-find-index "^1.0.1" - -cyclist@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" - integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= - -dargs@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/dargs/-/dargs-6.1.0.tgz#1f3b9b56393ecf8caa7cbfd6c31496ffcfb9b272" - integrity sha512-5dVBvpBLBnPwSsYXqfybFyehMmC/EenKEcf23AhCTgTf48JFBbmJKqoZBsERDnjL0FyiVTYWdFsRfTLHxLyKdQ== - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= - dependencies: - assert-plus "^1.0.0" - -data-urls@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" - integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== - dependencies: - abab "^2.0.0" - whatwg-mimetype "^2.2.0" - whatwg-url "^7.0.0" - -dateformat@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" - integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== - -de-indent@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" - integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0= - -debug@2.6.9, debug@^2.2.0, debug@^2.3.3: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6: - version "3.2.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" - integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== - dependencies: - ms "^2.1.1" - -debug@^4.1.0, debug@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== - dependencies: - ms "^2.1.1" - -decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= - -decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= - -decompress-response@^3.2.0, decompress-response@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" - integrity sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M= - dependencies: - mimic-response "^1.0.0" - -deep-equal@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.0.tgz#3103cdf8ab6d32cf4a8df7865458f2b8d33f3745" - integrity sha512-ZbfWJq/wN1Z273o7mUSjILYqehAktR2NVoSrOukDkU9kg2v/Uv89yU4Cvz8seJeAmtN5oqiefKq8FPuXOboqLw== - dependencies: - is-arguments "^1.0.4" - is-date-object "^1.0.1" - is-regex "^1.0.4" - object-is "^1.0.1" - object-keys "^1.1.1" - regexp.prototype.flags "^1.2.0" - -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= - -default-gateway@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-4.2.0.tgz#167104c7500c2115f6dd69b0a536bb8ed720552b" - integrity sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA== - dependencies: - execa "^1.0.0" - ip-regex "^2.1.0" - -define-properties@^1.1.2, define-properties@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== - dependencies: - object-keys "^1.0.12" - -define-property@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" - integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= - dependencies: - is-descriptor "^0.1.0" - -define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" - integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= - dependencies: - is-descriptor "^1.0.0" - -define-property@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" - integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== - dependencies: - is-descriptor "^1.0.2" - isobject "^3.0.1" - -del@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" - integrity sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ== - dependencies: - "@types/glob" "^7.1.1" - globby "^6.1.0" - is-path-cwd "^2.0.0" - is-path-in-cwd "^2.0.0" - p-map "^2.0.0" - pify "^4.0.1" - rimraf "^2.6.3" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= - -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= - -depd@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= - -des.js@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" - integrity sha1-wHTS4qpqipoH29YfmhXCzYPsjsw= - dependencies: - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - -destroy@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" - integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= - -detect-conflict@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/detect-conflict/-/detect-conflict-1.0.1.tgz#088657a66a961c05019db7c4230883b1c6b4176e" - integrity sha1-CIZXpmqWHAUBnbfEIwiDsca0F24= - -detect-file@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" - integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= - -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= - -detect-newline@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" - integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= - -detect-node@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" - integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw== - -diff-sequences@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" - integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== - -diff@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" - integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== - -diffie-hellman@^5.0.0: - version "5.0.3" - resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" - integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== - dependencies: - bn.js "^4.1.0" - miller-rabin "^4.0.0" - randombytes "^2.0.0" - -dir-glob@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" - integrity sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag== - dependencies: - arrify "^1.0.1" - path-type "^3.0.0" - -dns-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" - integrity sha1-s55/HabrCnW6nBcySzR1PEfgZU0= - -dns-packet@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-1.3.1.tgz#12aa426981075be500b910eedcd0b47dd7deda5a" - integrity sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg== - dependencies: - ip "^1.1.0" - safe-buffer "^5.0.1" - -dns-txt@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/dns-txt/-/dns-txt-2.0.2.tgz#b91d806f5d27188e4ab3e7d107d881a1cc4642b6" - integrity sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY= - dependencies: - buffer-indexof "^1.0.0" - -dom-converter@^0.2: - version "0.2.0" - resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" - integrity sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA== - dependencies: - utila "~0.4" - -dom-serializer@0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.1.tgz#13650c850daffea35d8b626a4cfc4d3a17643fdb" - integrity sha512-sK3ujri04WyjwQXVoK4PU3y8ula1stq10GJZpqHIUgoGZdsGzAGu65BnU3d08aTVSvO7mGPZUc0wTEDL+qGE0Q== - dependencies: - domelementtype "^2.0.1" - entities "^2.0.0" - -domain-browser@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" - integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== - -domelementtype@1, domelementtype@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" - integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w== - -domelementtype@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.0.1.tgz#1f8bdfe91f5a78063274e803b4bdcedf6e94f94d" - integrity sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ== - -domexception@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" - integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== - dependencies: - webidl-conversions "^4.0.2" - -domhandler@^2.3.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803" - integrity sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA== - dependencies: - domelementtype "1" - -domutils@1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - integrity sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8= - dependencies: - dom-serializer "0" - domelementtype "1" - -domutils@^1.5.1: - version "1.7.0" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a" - integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg== - dependencies: - dom-serializer "0" - domelementtype "1" - -duplexer3@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" - integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= - -duplexify@^3.4.2, duplexify@^3.6.0: - version "3.7.1" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" - integrity sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g== - dependencies: - end-of-stream "^1.0.0" - inherits "^2.0.1" - readable-stream "^2.0.0" - stream-shift "^1.0.0" - -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -editions@^2.1.3: - version "2.2.0" - resolved "https://registry.yarnpkg.com/editions/-/editions-2.2.0.tgz#dacd0c2a9441ebef592bba316a6264febb337f35" - integrity sha512-RYg3iEA2BDLCNVe8PUkD+ox5vAKxB9XS/mAhx1bdxGCF0CpX077C0pyTA9t5D6idCYA3avl5/XDHKPsHFrygfw== - dependencies: - errlop "^1.1.2" - semver "^6.3.0" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= - -ejs@^2.5.9: - version "2.7.1" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.1.tgz#5b5ab57f718b79d4aca9254457afecd36fa80228" - integrity sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ== - -electron-to-chromium@^1.3.295: - version "1.3.304" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.304.tgz#49b47d961f8143116174c2f70fbfee3aabf43015" - integrity sha512-a5mqa13jCdBc+Crgk3Gyr7vpXCiFWfFq23YDCEmrPYeiDOQKZDVE6EX/Q4Xdv97n3XkcjiSBDOY0IS19yP2yeA== - -elliptic@^6.0.0: - version "6.5.1" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.1.tgz#c380f5f909bf1b9b4428d028cd18d3b0efd6b52b" - integrity sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg== - dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" - hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" - -emoji-regex@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" - integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== - -emojis-list@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" - integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k= - -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= - -end-of-stream@^1.0.0, end-of-stream@^1.1.0: - version "1.4.4" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" - integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== - dependencies: - once "^1.4.0" - -enhanced-resolve@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" - integrity sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng== - dependencies: - graceful-fs "^4.1.2" - memory-fs "^0.4.0" - tapable "^1.0.0" - -enhanced-resolve@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz#2937e2b8066cd0fe7ce0990a98f0d71a35189f66" - integrity sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA== - dependencies: - graceful-fs "^4.1.2" - memory-fs "^0.5.0" - tapable "^1.0.0" - -entities@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" - integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== - -entities@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4" - integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw== - -errlop@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/errlop/-/errlop-1.1.2.tgz#a99a48f37aa264d614e342ffdbbaa49eec9220e0" - integrity sha512-djkRp+urJ+SmqDBd7F6LUgm4Be1TTYBxia2bhjNdFBuBDQtJDHExD2VbxR6eyst3h1TZy3qPRCdqb6FBoFttTA== - dependencies: - editions "^2.1.3" - -errno@^0.1.3, errno@~0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" - integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== - dependencies: - prr "~1.0.1" - -error-ex@^1.2.0, error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== - dependencies: - is-arrayish "^0.2.1" - -error@^7.0.2: - version "7.2.0" - resolved "https://registry.yarnpkg.com/error/-/error-7.2.0.tgz#80c989885635b41df9309d145834a4f125ae2245" - integrity sha512-M6t3j3Vt3uDicrViMP5fLq2AeADNrCVFD8Oj4Qt2MHsX0mPYG7D5XdnEfSdRpaHQzjAJ19wu+I1mw9rQYMTAPg== - dependencies: - string-template "~0.2.1" - -es-abstract@^1.5.1: - version "1.16.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.0.tgz#d3a26dc9c3283ac9750dca569586e976d9dcc06d" - integrity sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg== - dependencies: - es-to-primitive "^1.2.0" - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.0" - is-callable "^1.1.4" - is-regex "^1.0.4" - object-inspect "^1.6.0" - object-keys "^1.1.1" - string.prototype.trimleft "^2.1.0" - string.prototype.trimright "^2.1.0" - -es-to-primitive@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" - integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== - dependencies: - is-callable "^1.1.4" - is-date-object "^1.0.1" - is-symbol "^1.0.2" - -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= - -escodegen@^1.9.1: - version "1.12.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.0.tgz#f763daf840af172bb3a2b6dd7219c0e17f7ff541" - integrity sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg== - dependencies: - esprima "^3.1.3" - estraverse "^4.2.0" - esutils "^2.0.2" - optionator "^0.8.1" - optionalDependencies: - source-map "~0.6.1" - -eslint-scope@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" - integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -esprima@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" - integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= - -esprima@~4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" - integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== - dependencies: - estraverse "^4.1.0" - -estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= - -eventemitter3@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb" - integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg== - -events@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88" - integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA== - -eventsource@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-1.0.7.tgz#8fbc72c93fcd34088090bc0a4e64f4b5cee6d8d0" - integrity sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ== - dependencies: - original "^1.0.0" - -evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" - integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== - dependencies: - md5.js "^1.3.4" - safe-buffer "^5.1.1" - -exec-sh@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" - integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== - -execa@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" - integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== - dependencies: - cross-spawn "^6.0.0" - get-stream "^4.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= - -expand-brackets@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= - dependencies: - debug "^2.3.3" - define-property "^0.2.5" - extend-shallow "^2.0.1" - posix-character-classes "^0.1.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -expand-tilde@^2.0.0, expand-tilde@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" - integrity sha1-l+gBqgUt8CRU3kawK/YhZCzchQI= - dependencies: - homedir-polyfill "^1.0.1" - -expect@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" - integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== - dependencies: - "@jest/types" "^24.9.0" - ansi-styles "^3.2.0" - jest-get-type "^24.9.0" - jest-matcher-utils "^24.9.0" - jest-message-util "^24.9.0" - jest-regex-util "^24.9.0" - -express@^4.17.1: - version "4.17.1" - resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" - integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== - dependencies: - accepts "~1.3.7" - array-flatten "1.1.1" - body-parser "1.19.0" - content-disposition "0.5.3" - content-type "~1.0.4" - cookie "0.4.0" - cookie-signature "1.0.6" - debug "2.6.9" - depd "~1.1.2" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "~1.1.2" - fresh "0.5.2" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "~2.3.0" - parseurl "~1.3.3" - path-to-regexp "0.1.7" - proxy-addr "~2.0.5" - qs "6.7.0" - range-parser "~1.2.1" - safe-buffer "5.1.2" - send "0.17.1" - serve-static "1.14.1" - setprototypeof "1.1.1" - statuses "~1.5.0" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - -extend-shallow@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= - dependencies: - is-extendable "^0.1.0" - -extend-shallow@^3.0.0, extend-shallow@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" - integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= - dependencies: - assign-symbols "^1.0.0" - is-extendable "^1.0.1" - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - -external-editor@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" - integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== - dependencies: - chardet "^0.7.0" - iconv-lite "^0.4.24" - tmp "^0.0.33" - -extglob@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" - integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== - dependencies: - array-unique "^0.3.2" - define-property "^1.0.0" - expand-brackets "^2.1.4" - extend-shallow "^2.0.1" - fragment-cache "^0.2.1" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= - -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= - -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" - integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= - -fast-glob@^2.0.2: - version "2.2.7" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" - integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== - dependencies: - "@mrmlnc/readdir-enhanced" "^2.2.1" - "@nodelib/fs.stat" "^1.1.2" - glob-parent "^3.1.0" - is-glob "^4.0.0" - merge2 "^1.2.3" - micromatch "^3.1.10" - -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= - -fast-levenshtein@~2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= - -faye-websocket@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" - integrity sha1-TkkvjQTftviQA1B/btvy1QHnxvQ= - dependencies: - websocket-driver ">=0.5.1" - -faye-websocket@~0.11.1: - version "0.11.3" - resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.3.tgz#5c0e9a8968e8912c286639fde977a8b209f2508e" - integrity sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA== - dependencies: - websocket-driver ">=0.5.1" - -fb-watchman@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" - integrity sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg= - dependencies: - bser "^2.0.0" - -figgy-pudding@^3.5.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" - integrity sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w== - -figures@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" - integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= - dependencies: - escape-string-regexp "^1.0.5" - -fill-range@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" - integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= - dependencies: - extend-shallow "^2.0.1" - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range "^2.1.0" - -finalhandler@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" - integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "~2.3.0" - parseurl "~1.3.3" - statuses "~1.5.0" - unpipe "~1.0.0" - -find-cache-dir@^2.0.0, find-cache-dir@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" - integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== - dependencies: - commondir "^1.0.1" - make-dir "^2.0.0" - pkg-dir "^3.0.0" - -find-up@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" - integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= - dependencies: - path-exists "^2.0.0" - pinkie-promise "^2.0.0" - -find-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" - integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== - dependencies: - locate-path "^3.0.0" - -findup-sync@3.0.0, findup-sync@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-3.0.0.tgz#17b108f9ee512dfb7a5c7f3c8b27ea9e1a9c08d1" - integrity sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg== - dependencies: - detect-file "^1.0.0" - is-glob "^4.0.0" - micromatch "^3.0.4" - resolve-dir "^1.0.1" - -first-chunk-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz#1bdecdb8e083c0664b91945581577a43a9f31d70" - integrity sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA= - dependencies: - readable-stream "^2.0.2" - -flow-parser@0.*: - version "0.111.1" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.111.1.tgz#f84108934264105916f466e7d1824efacb19b9a3" - integrity sha512-yo+C0a/fMsGwooxA2xd4kK/kuzSnFC8JZLsIB68mkTllLrF/nSQ8llwD82o8Vxwvisw9IPC/ZC8zqrWmkir9jQ== - -flush-write-stream@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" - integrity sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w== - dependencies: - inherits "^2.0.3" - readable-stream "^2.3.6" - -follow-redirects@^1.0.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.9.0.tgz#8d5bcdc65b7108fe1508649c79c12d732dcedb4f" - integrity sha512-CRcPzsSIbXyVDl0QI01muNDu69S8trU4jArW9LpOt2WtC6LyUJetcIrmfHsRBx7/Jb6GHJUiuqyYxPooFfNt6A== - dependencies: - debug "^3.0.0" - -for-in@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= - -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -forwarded@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" - integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= - -fragment-cache@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" - integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= - dependencies: - map-cache "^0.2.2" - -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= - -from2@^2.1.0, from2@^2.1.1: - version "2.3.0" - resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" - integrity sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8= - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.0" - -fs-minipass@^1.2.5: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - -fs-write-stream-atomic@^1.0.8: - version "1.0.10" - resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" - integrity sha1-tH31NJPvkR33VzHnCp3tAYnbQMk= - dependencies: - graceful-fs "^4.1.2" - iferr "^0.1.5" - imurmurhash "^0.1.4" - readable-stream "1 || 2" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -fsevents@^1.2.7: - version "1.2.9" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f" - integrity sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw== - dependencies: - nan "^2.12.1" - node-pre-gyp "^0.12.0" - -fstream@^1.0.0, fstream@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.12.tgz#4e8ba8ee2d48be4f7d0de505455548eae5932045" - integrity sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg== - dependencies: - graceful-fs "^4.1.2" - inherits "~2.0.0" - mkdirp ">=0.5 0" - rimraf "2" - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== - -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -gaze@^1.0.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/gaze/-/gaze-1.1.3.tgz#c441733e13b927ac8c0ff0b4c3b033f28812924a" - integrity sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g== - dependencies: - globule "^1.0.0" - -get-caller-file@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" - integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== - -get-caller-file@^2.0.1: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-stdin@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" - integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= - -get-stream@3.0.0, get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= - -get-stream@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" - integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== - dependencies: - pump "^3.0.0" - -get-value@^2.0.3, get-value@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" - integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= - dependencies: - assert-plus "^1.0.0" - -gh-got@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/gh-got/-/gh-got-6.0.0.tgz#d74353004c6ec466647520a10bd46f7299d268d0" - integrity sha512-F/mS+fsWQMo1zfgG9MD8KWvTWPPzzhuVwY++fhQ5Ggd+0P+CAMHtzMZhNxG+TqGfHDChJKsbh6otfMGqO2AKBw== - dependencies: - got "^7.0.0" - is-plain-obj "^1.1.0" - -github-username@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/github-username/-/github-username-4.1.0.tgz#cbe280041883206da4212ae9e4b5f169c30bf417" - integrity sha1-y+KABBiDIG2kISrp5LXxacML9Bc= - dependencies: - gh-got "^6.0.0" - -glob-all@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/glob-all/-/glob-all-3.1.0.tgz#8913ddfb5ee1ac7812656241b03d5217c64b02ab" - integrity sha1-iRPd+17hrHgSZWJBsD1SF8ZLAqs= - dependencies: - glob "^7.0.5" - yargs "~1.2.6" - -glob-parent@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" - integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= - dependencies: - is-glob "^3.1.0" - path-dirname "^1.0.0" - -glob-to-regexp@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" - integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= - -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.1: - version "7.1.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.5.tgz#6714c69bee20f3c3e64c4dd905553e532b40cdc0" - integrity sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -global-modules@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" - integrity sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A== - dependencies: - global-prefix "^3.0.0" - -global-modules@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" - integrity sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg== - dependencies: - global-prefix "^1.0.1" - is-windows "^1.0.1" - resolve-dir "^1.0.0" - -global-prefix@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-1.0.2.tgz#dbf743c6c14992593c655568cb66ed32c0122ebe" - integrity sha1-2/dDxsFJklk8ZVVoy2btMsASLr4= - dependencies: - expand-tilde "^2.0.2" - homedir-polyfill "^1.0.1" - ini "^1.3.4" - is-windows "^1.0.1" - which "^1.2.14" - -global-prefix@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-3.0.0.tgz#fc85f73064df69f50421f47f883fe5b913ba9b97" - integrity sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg== - dependencies: - ini "^1.3.5" - kind-of "^6.0.2" - which "^1.3.1" - -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -globby@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= - dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -globby@^8.0.1: - version "8.0.2" - resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" - integrity sha512-yTzMmKygLp8RUpG1Ymu2VXPSJQZjNAZPD4ywgYEaG7e4tBJeUQBO8OpXrf1RCNcEs5alsoJYPAMiIHP0cmeC7w== - dependencies: - array-union "^1.0.1" - dir-glob "2.0.0" - fast-glob "^2.0.2" - glob "^7.1.2" - ignore "^3.3.5" - pify "^3.0.0" - slash "^1.0.0" - -globule@^1.0.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/globule/-/globule-1.2.1.tgz#5dffb1b191f22d20797a9369b49eab4e9839696d" - integrity sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ== - dependencies: - glob "~7.1.1" - lodash "~4.17.10" - minimatch "~3.0.2" - -got@8.x.x: - version "8.3.2" - resolved "https://registry.yarnpkg.com/got/-/got-8.3.2.tgz#1d23f64390e97f776cac52e5b936e5f514d2e937" - integrity sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw== - dependencies: - "@sindresorhus/is" "^0.7.0" - cacheable-request "^2.1.1" - decompress-response "^3.3.0" - duplexer3 "^0.1.4" - get-stream "^3.0.0" - into-stream "^3.1.0" - is-retry-allowed "^1.1.0" - isurl "^1.0.0-alpha5" - lowercase-keys "^1.0.0" - mimic-response "^1.0.0" - p-cancelable "^0.4.0" - p-timeout "^2.0.1" - pify "^3.0.0" - safe-buffer "^5.1.1" - timed-out "^4.0.1" - url-parse-lax "^3.0.0" - url-to-options "^1.0.1" - -got@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a" - integrity sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw== - dependencies: - decompress-response "^3.2.0" - duplexer3 "^0.1.4" - get-stream "^3.0.0" - is-plain-obj "^1.1.0" - is-retry-allowed "^1.0.0" - is-stream "^1.0.0" - isurl "^1.0.0-alpha5" - lowercase-keys "^1.0.0" - p-cancelable "^0.3.0" - p-timeout "^1.1.1" - safe-buffer "^5.0.1" - timed-out "^4.0.0" - url-parse-lax "^1.0.0" - url-to-options "^1.0.1" - -graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2: - version "4.2.3" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" - integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== - -grouped-queue@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/grouped-queue/-/grouped-queue-0.3.3.tgz#c167d2a5319c5a0e0964ef6a25b7c2df8996c85c" - integrity sha1-wWfSpTGcWg4JZO9qJbfC34mWyFw= - dependencies: - lodash "^4.17.2" - -growly@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" - integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= - -handle-thing@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.0.tgz#0e039695ff50c93fc288557d696f3c1dc6776754" - integrity sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ== - -handlebars@^4.1.2: - version "4.5.1" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.1.tgz#8a01c382c180272260d07f2d1aa3ae745715c7ba" - integrity sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA== - dependencies: - neo-async "^2.6.0" - optimist "^0.6.1" - source-map "^0.6.1" - optionalDependencies: - uglify-js "^3.1.4" - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= - -har-validator@~5.1.0: - version "5.1.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" - integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== - dependencies: - ajv "^6.5.5" - har-schema "^2.0.0" - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= - dependencies: - ansi-regex "^2.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= - -has-symbol-support-x@^1.4.1: - version "1.4.2" - resolved "https://registry.yarnpkg.com/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz#1409f98bc00247da45da67cee0a36f282ff26455" - integrity sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw== - -has-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" - integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= - -has-to-string-tag-x@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz#a045ab383d7b4b2012a00148ab0aa5f290044d4d" - integrity sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw== - dependencies: - has-symbol-support-x "^1.4.1" - -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= - -has-value@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" - integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= - dependencies: - get-value "^2.0.3" - has-values "^0.1.4" - isobject "^2.0.0" - -has-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" - integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= - dependencies: - get-value "^2.0.6" - has-values "^1.0.0" - isobject "^3.0.0" - -has-values@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" - integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= - -has-values@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" - integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - -has@^1.0.1, has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" - -hash-base@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" - integrity sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -hash-sum@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/hash-sum/-/hash-sum-1.0.2.tgz#33b40777754c6432573c120cc3808bbd10d47f04" - integrity sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ= - -hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -he@1.2.x, he@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" - integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== - -hmac-drbg@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -homedir-polyfill@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" - integrity sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== - dependencies: - parse-passwd "^1.0.0" - -hosted-git-info@^2.1.4: - version "2.8.5" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" - integrity sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg== - -hpack.js@^2.1.6: - version "2.1.6" - resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" - integrity sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI= - dependencies: - inherits "^2.0.1" - obuf "^1.0.0" - readable-stream "^2.0.1" - wbuf "^1.1.0" - -html-encoding-sniffer@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" - integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== - dependencies: - whatwg-encoding "^1.0.1" - -html-entities@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.2.1.tgz#0df29351f0721163515dfb9e5543e5f6eed5162f" - integrity sha1-DfKTUfByEWNRXfueVUPl9u7VFi8= - -html-minifier@^3.2.3: - version "3.5.21" - resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.21.tgz#d0040e054730e354db008463593194015212d20c" - integrity sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA== - dependencies: - camel-case "3.0.x" - clean-css "4.2.x" - commander "2.17.x" - he "1.2.x" - param-case "2.1.x" - relateurl "0.2.x" - uglify-js "3.4.x" - -html-webpack-plugin@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz#b01abbd723acaaa7b37b6af4492ebda03d9dd37b" - integrity sha1-sBq71yOsqqeze2r0SS69oD2d03s= - dependencies: - html-minifier "^3.2.3" - loader-utils "^0.2.16" - lodash "^4.17.3" - pretty-error "^2.0.2" - tapable "^1.0.0" - toposort "^1.0.0" - util.promisify "1.0.0" - -htmlparser2@^3.3.0: - version "3.10.1" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f" - integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ== - dependencies: - domelementtype "^1.3.1" - domhandler "^2.3.0" - domutils "^1.5.1" - entities "^1.1.1" - inherits "^2.0.1" - readable-stream "^3.1.1" - -http-cache-semantics@3.8.1: - version "3.8.1" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" - integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== - -http-deceiver@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" - integrity sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc= - -http-errors@1.7.2: - version "1.7.2" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" - integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.1" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.0" - -http-errors@~1.6.2: - version "1.6.3" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" - integrity sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0= - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.0" - statuses ">= 1.4.0 < 2" - -http-errors@~1.7.2: - version "1.7.3" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" - integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== - dependencies: - depd "~1.1.2" - inherits "2.0.4" - setprototypeof "1.1.1" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.0" - -"http-parser-js@>=0.4.0 <0.4.11": - version "0.4.10" - resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.10.tgz#92c9c1374c35085f75db359ec56cc257cbb93fa4" - integrity sha1-ksnBN0w1CF912zWexWzCV8u5P6Q= - -http-proxy-middleware@0.19.1: - version "0.19.1" - resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz#183c7dc4aa1479150306498c210cdaf96080a43a" - integrity sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q== - dependencies: - http-proxy "^1.17.0" - is-glob "^4.0.0" - lodash "^4.17.11" - micromatch "^3.1.10" - -http-proxy@^1.17.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.0.tgz#dbe55f63e75a347db7f3d99974f2692a314a6a3a" - integrity sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ== - dependencies: - eventemitter3 "^4.0.0" - follow-redirects "^1.0.0" - requires-port "^1.0.0" - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -https-browserify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" - integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= - -iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -icss-utils@^4.0.0, icss-utils@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467" - integrity sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA== - dependencies: - postcss "^7.0.14" - -ieee754@^1.1.4: - version "1.1.13" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" - integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== - -iferr@^0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" - integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= - -ignore-walk@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" - integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== - dependencies: - minimatch "^3.0.4" - -ignore@^3.3.5: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== - -import-local@2.0.0, import-local@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" - integrity sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ== - dependencies: - pkg-dir "^3.0.0" - resolve-cwd "^2.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= - -in-publish@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.0.tgz#e20ff5e3a2afc2690320b6dc552682a9c7fadf51" - integrity sha1-4g/146KvwmkDILbcVSaCqcf631E= - -indent-string@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" - integrity sha1-ji1INIdCEhtKghi3oTfppSBJ3IA= - dependencies: - repeating "^2.0.0" - -indexes-of@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" - integrity sha1-8w9xbI4r00bHtn0985FVZqfAVgc= - -infer-owner@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" - integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -inherits@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= - -inherits@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= - -ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: - version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" - integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== - -inquirer-autocomplete-prompt@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/inquirer-autocomplete-prompt/-/inquirer-autocomplete-prompt-1.0.1.tgz#e4be98a9e727ea5160937e33f8724e70464e3c4d" - integrity sha512-Y4V6ifAu9LNrNjcEtYq8YUKhrgmmufUn5fsDQqeWgHY8rEO6ZAQkNUiZtBm2kw2uUQlC9HdgrRCHDhTPPguH5A== - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - figures "^2.0.0" - run-async "^2.3.0" - -inquirer@^6.0.0: - version "6.5.2" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" - integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== - dependencies: - ansi-escapes "^3.2.0" - chalk "^2.4.2" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^3.0.3" - figures "^2.0.0" - lodash "^4.17.12" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^6.4.0" - string-width "^2.1.0" - strip-ansi "^5.1.0" - through "^2.3.6" - -internal-ip@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-4.3.0.tgz#845452baad9d2ca3b69c635a137acb9a0dad0907" - integrity sha512-S1zBo1D6zcsyuC6PMmY5+55YMILQ9av8lotMx447Bq6SAgo/sDK6y6uUKmuYhW7eacnIhFfsPmCNYdDzsnnDCg== - dependencies: - default-gateway "^4.2.0" - ipaddr.js "^1.9.0" - -interpret@1.2.0, interpret@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" - integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== - -into-stream@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-3.1.0.tgz#96fb0a936c12babd6ff1752a17d05616abd094c6" - integrity sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY= - dependencies: - from2 "^2.1.1" - p-is-promise "^1.1.0" - -invariant@^2.2.2, invariant@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" - integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== - dependencies: - loose-envify "^1.0.0" - -invert-kv@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" - integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= - -invert-kv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" - integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== - -ip-regex@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" - integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= - -ip@^1.1.0, ip@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" - integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= - -ipaddr.js@1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.0.tgz#37df74e430a0e47550fe54a2defe30d8acd95f65" - integrity sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA== - -ipaddr.js@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - -is-absolute-url@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-3.0.3.tgz#96c6a22b6a23929b11ea0afb1836c36ad4a5d698" - integrity sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q== - -is-accessor-descriptor@^0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" - integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= - dependencies: - kind-of "^3.0.2" - -is-accessor-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" - integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== - dependencies: - kind-of "^6.0.0" - -is-arguments@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.0.4.tgz#3faf966c7cba0ff437fb31f6250082fcf0448cf3" - integrity sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA== - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= - -is-binary-path@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" - integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= - dependencies: - binary-extensions "^1.0.0" - -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== - -is-callable@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" - integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== - -is-ci@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" - integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== - dependencies: - ci-info "^2.0.0" - -is-data-descriptor@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" - integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= - dependencies: - kind-of "^3.0.2" - -is-data-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" - integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== - dependencies: - kind-of "^6.0.0" - -is-date-object@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" - integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= - -is-descriptor@^0.1.0: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" - integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== - dependencies: - is-accessor-descriptor "^0.1.6" - is-data-descriptor "^0.1.4" - kind-of "^5.0.0" - -is-descriptor@^1.0.0, is-descriptor@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" - integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== - dependencies: - is-accessor-descriptor "^1.0.0" - is-data-descriptor "^1.0.0" - kind-of "^6.0.2" - -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= - -is-extendable@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" - integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== - dependencies: - is-plain-object "^2.0.4" - -is-extglob@^2.1.0, is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= - -is-finite@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" - integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= - -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== - -is-glob@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" - integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= - dependencies: - is-extglob "^2.1.0" - -is-glob@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" - integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== - dependencies: - is-extglob "^2.1.1" - -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= - dependencies: - kind-of "^3.0.2" - -is-object@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470" - integrity sha1-iVJojF7C/9awPsyF52ngKQMINHA= - -is-path-cwd@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" - integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== - -is-path-in-cwd@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz#bfe2dca26c69f397265a4009963602935a053acb" - integrity sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ== - dependencies: - is-path-inside "^2.1.0" - -is-path-inside@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-2.1.0.tgz#7c9810587d659a40d27bcdb4d5616eab059494b2" - integrity sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg== - dependencies: - path-is-inside "^1.0.2" - -is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" - integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= - -is-plain-object@^2.0.3, is-plain-object@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" - integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== - dependencies: - isobject "^3.0.1" - -is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= - -is-regex@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" - integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= - dependencies: - has "^1.0.1" - -is-retry-allowed@^1.0.0, is-retry-allowed@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4" - integrity sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg== - -is-scoped@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-scoped/-/is-scoped-1.0.0.tgz#449ca98299e713038256289ecb2b540dc437cb30" - integrity sha1-RJypgpnnEwOCViieyytUDcQ3yzA= - dependencies: - scoped-regex "^1.0.0" - -is-stream@^1.0.0, is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= - -is-symbol@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" - integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== - dependencies: - has-symbols "^1.0.0" - -is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= - -is-utf8@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" - integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= - -is-windows@^1.0.1, is-windows@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" - integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== - -is-wsl@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" - integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= - -isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= - -isbinaryfile@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-3.0.3.tgz#5d6def3edebf6e8ca8cae9c30183a804b5f8be80" - integrity sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw== - dependencies: - buffer-alloc "^1.2.0" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= - dependencies: - isarray "1.0.0" - -isobject@^3.0.0, isobject@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= - -istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#675f0ab69503fad4b1d849f736baaca803344f49" - integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== - -istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz#a5f63d91f0bbc0c3e479ef4c5de027335ec6d630" - integrity sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== - dependencies: - "@babel/generator" "^7.4.0" - "@babel/parser" "^7.4.3" - "@babel/template" "^7.4.0" - "@babel/traverse" "^7.4.3" - "@babel/types" "^7.4.0" - istanbul-lib-coverage "^2.0.5" - semver "^6.0.0" - -istanbul-lib-report@^2.0.4: - version "2.0.8" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz#5a8113cd746d43c4889eba36ab10e7d50c9b4f33" - integrity sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ== - dependencies: - istanbul-lib-coverage "^2.0.5" - make-dir "^2.1.0" - supports-color "^6.1.0" - -istanbul-lib-source-maps@^3.0.1: - version "3.0.6" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz#284997c48211752ec486253da97e3879defba8c8" - integrity sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^2.0.5" - make-dir "^2.1.0" - rimraf "^2.6.3" - source-map "^0.6.1" - -istanbul-reports@^2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" - integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== - dependencies: - handlebars "^4.1.2" - -istextorbinary@^2.2.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/istextorbinary/-/istextorbinary-2.5.1.tgz#14a33824cf6b9d5d7743eac1be2bd2c310d0ccbd" - integrity sha512-pv/JNPWnfpwGjPx7JrtWTwsWsxkrK3fNzcEVnt92YKEIErps4Fsk49+qzCe9iQF2hjqK8Naqf8P9kzoeCuQI1g== - dependencies: - binaryextensions "^2.1.2" - editions "^2.1.3" - textextensions "^2.4.0" - -isurl@^1.0.0-alpha5: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" - integrity sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w== - dependencies: - has-to-string-tag-x "^1.2.0" - is-object "^1.0.1" - -jest-changed-files@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" - integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== - dependencies: - "@jest/types" "^24.9.0" - execa "^1.0.0" - throat "^4.0.0" - -jest-cli@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" - integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== - dependencies: - "@jest/core" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - chalk "^2.0.1" - exit "^0.1.2" - import-local "^2.0.0" - is-ci "^2.0.0" - jest-config "^24.9.0" - jest-util "^24.9.0" - jest-validate "^24.9.0" - prompts "^2.0.1" - realpath-native "^1.1.0" - yargs "^13.3.0" - -jest-config@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" - integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== - dependencies: - "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^24.9.0" - "@jest/types" "^24.9.0" - babel-jest "^24.9.0" - chalk "^2.0.1" - glob "^7.1.1" - jest-environment-jsdom "^24.9.0" - jest-environment-node "^24.9.0" - jest-get-type "^24.9.0" - jest-jasmine2 "^24.9.0" - jest-regex-util "^24.3.0" - jest-resolve "^24.9.0" - jest-util "^24.9.0" - jest-validate "^24.9.0" - micromatch "^3.1.10" - pretty-format "^24.9.0" - realpath-native "^1.1.0" - -jest-diff@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" - integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== - dependencies: - chalk "^2.0.1" - diff-sequences "^24.9.0" - jest-get-type "^24.9.0" - pretty-format "^24.9.0" - -jest-docblock@^24.3.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" - integrity sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA== - dependencies: - detect-newline "^2.1.0" - -jest-each@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" - integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== - dependencies: - "@jest/types" "^24.9.0" - chalk "^2.0.1" - jest-get-type "^24.9.0" - jest-util "^24.9.0" - pretty-format "^24.9.0" - -jest-environment-jsdom@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" - integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== - dependencies: - "@jest/environment" "^24.9.0" - "@jest/fake-timers" "^24.9.0" - "@jest/types" "^24.9.0" - jest-mock "^24.9.0" - jest-util "^24.9.0" - jsdom "^11.5.1" - -jest-environment-node@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" - integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== - dependencies: - "@jest/environment" "^24.9.0" - "@jest/fake-timers" "^24.9.0" - "@jest/types" "^24.9.0" - jest-mock "^24.9.0" - jest-util "^24.9.0" - -jest-get-type@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" - integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== - -jest-haste-map@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" - integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== - dependencies: - "@jest/types" "^24.9.0" - anymatch "^2.0.0" - fb-watchman "^2.0.0" - graceful-fs "^4.1.15" - invariant "^2.2.4" - jest-serializer "^24.9.0" - jest-util "^24.9.0" - jest-worker "^24.9.0" - micromatch "^3.1.10" - sane "^4.0.3" - walker "^1.0.7" - optionalDependencies: - fsevents "^1.2.7" - -jest-jasmine2@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" - integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== - dependencies: - "@babel/traverse" "^7.1.0" - "@jest/environment" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - chalk "^2.0.1" - co "^4.6.0" - expect "^24.9.0" - is-generator-fn "^2.0.0" - jest-each "^24.9.0" - jest-matcher-utils "^24.9.0" - jest-message-util "^24.9.0" - jest-runtime "^24.9.0" - jest-snapshot "^24.9.0" - jest-util "^24.9.0" - pretty-format "^24.9.0" - throat "^4.0.0" - -jest-leak-detector@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" - integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== - dependencies: - jest-get-type "^24.9.0" - pretty-format "^24.9.0" - -jest-matcher-utils@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" - integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== - dependencies: - chalk "^2.0.1" - jest-diff "^24.9.0" - jest-get-type "^24.9.0" - pretty-format "^24.9.0" - -jest-message-util@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" - integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== - dependencies: - "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/stack-utils" "^1.0.1" - chalk "^2.0.1" - micromatch "^3.1.10" - slash "^2.0.0" - stack-utils "^1.0.1" - -jest-mock@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" - integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== - dependencies: - "@jest/types" "^24.9.0" - -jest-pnp-resolver@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" - integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== - -jest-regex-util@^24.3.0, jest-regex-util@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" - integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== - -jest-resolve-dependencies@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" - integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== - dependencies: - "@jest/types" "^24.9.0" - jest-regex-util "^24.3.0" - jest-snapshot "^24.9.0" - -jest-resolve@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" - integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== - dependencies: - "@jest/types" "^24.9.0" - browser-resolve "^1.11.3" - chalk "^2.0.1" - jest-pnp-resolver "^1.2.1" - realpath-native "^1.1.0" - -jest-runner@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" - integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== - dependencies: - "@jest/console" "^24.7.1" - "@jest/environment" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - chalk "^2.4.2" - exit "^0.1.2" - graceful-fs "^4.1.15" - jest-config "^24.9.0" - jest-docblock "^24.3.0" - jest-haste-map "^24.9.0" - jest-jasmine2 "^24.9.0" - jest-leak-detector "^24.9.0" - jest-message-util "^24.9.0" - jest-resolve "^24.9.0" - jest-runtime "^24.9.0" - jest-util "^24.9.0" - jest-worker "^24.6.0" - source-map-support "^0.5.6" - throat "^4.0.0" - -jest-runtime@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" - integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== - dependencies: - "@jest/console" "^24.7.1" - "@jest/environment" "^24.9.0" - "@jest/source-map" "^24.3.0" - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/yargs" "^13.0.0" - chalk "^2.0.1" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.1.15" - jest-config "^24.9.0" - jest-haste-map "^24.9.0" - jest-message-util "^24.9.0" - jest-mock "^24.9.0" - jest-regex-util "^24.3.0" - jest-resolve "^24.9.0" - jest-snapshot "^24.9.0" - jest-util "^24.9.0" - jest-validate "^24.9.0" - realpath-native "^1.1.0" - slash "^2.0.0" - strip-bom "^3.0.0" - yargs "^13.3.0" - -jest-serializer@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" - integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== - -jest-snapshot@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" - integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== - dependencies: - "@babel/types" "^7.0.0" - "@jest/types" "^24.9.0" - chalk "^2.0.1" - expect "^24.9.0" - jest-diff "^24.9.0" - jest-get-type "^24.9.0" - jest-matcher-utils "^24.9.0" - jest-message-util "^24.9.0" - jest-resolve "^24.9.0" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - pretty-format "^24.9.0" - semver "^6.2.0" - -jest-util@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" - integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== - dependencies: - "@jest/console" "^24.9.0" - "@jest/fake-timers" "^24.9.0" - "@jest/source-map" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - callsites "^3.0.0" - chalk "^2.0.1" - graceful-fs "^4.1.15" - is-ci "^2.0.0" - mkdirp "^0.5.1" - slash "^2.0.0" - source-map "^0.6.0" - -jest-validate@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" - integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== - dependencies: - "@jest/types" "^24.9.0" - camelcase "^5.3.1" - chalk "^2.0.1" - jest-get-type "^24.9.0" - leven "^3.1.0" - pretty-format "^24.9.0" - -jest-watcher@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" - integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== - dependencies: - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/yargs" "^13.0.0" - ansi-escapes "^3.0.0" - chalk "^2.0.1" - jest-util "^24.9.0" - string-length "^2.0.0" - -jest-worker@^24.6.0, jest-worker@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" - integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== - dependencies: - merge-stream "^2.0.0" - supports-color "^6.1.0" - -jest@^24.8.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" - integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== - dependencies: - import-local "^2.0.0" - jest-cli "^24.9.0" - -js-base64@^2.1.8: - version "2.5.1" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121" - integrity sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw== - -js-levenshtein@^1.1.3: - version "1.1.6" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" - integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== - -"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= - -jscodeshift@^0.6.4: - version "0.6.4" - resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.6.4.tgz#e19ab86214edac86a75c4557fc88b3937d558a8e" - integrity sha512-+NF/tlNbc2WEhXUuc4WEJLsJumF84tnaMUZW2hyJw3jThKKRvsPX4sPJVgO1lPE28z0gNL+gwniLG9d8mYvQCQ== - dependencies: - "@babel/core" "^7.1.6" - "@babel/parser" "^7.1.6" - "@babel/plugin-proposal-class-properties" "^7.1.0" - "@babel/plugin-proposal-object-rest-spread" "^7.0.0" - "@babel/preset-env" "^7.1.6" - "@babel/preset-flow" "^7.0.0" - "@babel/preset-typescript" "^7.1.0" - "@babel/register" "^7.0.0" - babel-core "^7.0.0-bridge.0" - colors "^1.1.2" - flow-parser "0.*" - graceful-fs "^4.1.11" - micromatch "^3.1.10" - neo-async "^2.5.0" - node-dir "^0.1.17" - recast "^0.16.1" - temp "^0.8.1" - write-file-atomic "^2.3.0" - -jsdom@^11.5.1: - version "11.12.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" - integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== - dependencies: - abab "^2.0.0" - acorn "^5.5.3" - acorn-globals "^4.1.0" - array-equal "^1.0.0" - cssom ">= 0.3.2 < 0.4.0" - cssstyle "^1.0.0" - data-urls "^1.0.0" - domexception "^1.0.1" - escodegen "^1.9.1" - html-encoding-sniffer "^1.0.2" - left-pad "^1.3.0" - nwsapi "^2.0.7" - parse5 "4.0.0" - pn "^1.1.0" - request "^2.87.0" - request-promise-native "^1.0.5" - sax "^1.2.4" - symbol-tree "^3.2.2" - tough-cookie "^2.3.4" - w3c-hr-time "^1.0.1" - webidl-conversions "^4.0.2" - whatwg-encoding "^1.0.3" - whatwg-mimetype "^2.1.0" - whatwg-url "^6.4.1" - ws "^5.2.0" - xml-name-validator "^3.0.0" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -jsesc@~0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" - integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= - -json-buffer@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" - integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg= - -json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" - integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= - -json3@^3.3.2: - version "3.3.3" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" - integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA== - -json5@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" - integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= - -json5@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" - integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== - dependencies: - minimist "^1.2.0" - -json5@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" - integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== - dependencies: - minimist "^1.2.0" - -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" - -keyv@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.0.0.tgz#44923ba39e68b12a7cec7df6c3268c031f2ef373" - integrity sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA== - dependencies: - json-buffer "3.0.0" - -killable@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/killable/-/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892" - integrity sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg== - -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= - dependencies: - is-buffer "^1.1.5" - -kind-of@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= - dependencies: - is-buffer "^1.1.5" - -kind-of@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" - integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== - -kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" - integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== - -kleur@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== - -lcid@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" - integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= - dependencies: - invert-kv "^1.0.0" - -lcid@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" - integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== - dependencies: - invert-kv "^2.0.0" - -left-pad@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" - integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== - -leven@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" - integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== - -levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -load-json-file@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" - integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - pinkie-promise "^2.0.0" - strip-bom "^2.0.0" - -load-json-file@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" - integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= - dependencies: - graceful-fs "^4.1.2" - parse-json "^4.0.0" - pify "^3.0.0" - strip-bom "^3.0.0" - -loader-runner@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" - integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== - -loader-utils@1.2.3, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7" - integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA== - dependencies: - big.js "^5.2.2" - emojis-list "^2.0.0" - json5 "^1.0.1" - -loader-utils@^0.2.16: - version "0.2.17" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" - integrity sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g= - dependencies: - big.js "^3.1.3" - emojis-list "^2.0.0" - json5 "^0.5.0" - object-assign "^4.0.1" - -locate-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" - integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== - dependencies: - p-locate "^3.0.0" - path-exists "^3.0.0" - -lodash.sortby@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" - integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= - -lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.2, lodash@^4.17.3, lodash@~4.17.10: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== - -log-symbols@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" - integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== - dependencies: - chalk "^2.0.1" - -loglevel@^1.6.4: - version "1.6.4" - resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.4.tgz#f408f4f006db8354d0577dcf6d33485b3cb90d56" - integrity sha512-p0b6mOGKcGa+7nnmKbpzR6qloPbrgLcnio++E+14Vo/XffOGwZtRpUhr8dTH/x2oCMmEoIU0Zwm3ZauhvYD17g== - -loose-envify@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" - integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - -loud-rejection@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" - integrity sha1-W0b4AUft7leIcPCG0Eghz5mOVR8= - dependencies: - currently-unhandled "^0.4.1" - signal-exit "^3.0.0" - -lower-case@^1.1.1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" - integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= - -lowercase-keys@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306" - integrity sha1-TjNms55/VFfjXxMkvfb4jQv8cwY= - -lowercase-keys@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" - integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== - -lru-cache@^4.0.1, lru-cache@^4.1.2: - version "4.1.5" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" - integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - -lru-cache@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" - integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== - dependencies: - yallist "^3.0.2" - -make-dir@^1.1.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" - integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== - dependencies: - pify "^3.0.0" - -make-dir@^2.0.0, make-dir@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" - integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== - dependencies: - pify "^4.0.1" - semver "^5.6.0" - -makeerror@1.0.x: - version "1.0.11" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" - integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= - dependencies: - tmpl "1.0.x" - -mamacro@^0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4" - integrity sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA== - -map-age-cleaner@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== - dependencies: - p-defer "^1.0.0" - -map-cache@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" - integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= - -map-obj@^1.0.0, map-obj@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" - integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= - -map-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" - integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= - dependencies: - object-visit "^1.0.0" - -md5.js@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" - integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= - -mem-fs-editor@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/mem-fs-editor/-/mem-fs-editor-5.1.0.tgz#51972241640be8567680a04f7adaffe5fc603667" - integrity sha512-2Yt2GCYEbcotYbIJagmow4gEtHDqzpq5XN94+yAx/NT5+bGqIjkXnm3KCUQfE6kRfScGp9IZknScoGRKu8L78w== - dependencies: - commondir "^1.0.1" - deep-extend "^0.6.0" - ejs "^2.5.9" - glob "^7.0.3" - globby "^8.0.1" - isbinaryfile "^3.0.2" - mkdirp "^0.5.0" - multimatch "^2.0.0" - rimraf "^2.2.8" - through2 "^2.0.0" - vinyl "^2.0.1" - -mem-fs@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/mem-fs/-/mem-fs-1.1.3.tgz#b8ae8d2e3fcb6f5d3f9165c12d4551a065d989cc" - integrity sha1-uK6NLj/Lb10/kWXBLUVRoGXZicw= - dependencies: - through2 "^2.0.0" - vinyl "^1.1.0" - vinyl-file "^2.0.0" - -mem@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" - integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== - dependencies: - map-age-cleaner "^0.1.1" - mimic-fn "^2.0.0" - p-is-promise "^2.0.0" - -memory-fs@^0.4.0, memory-fs@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" - integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= - dependencies: - errno "^0.1.3" - readable-stream "^2.0.1" - -memory-fs@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.5.0.tgz#324c01288b88652966d161db77838720845a8e3c" - integrity sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA== - dependencies: - errno "^0.1.3" - readable-stream "^2.0.1" - -meow@^3.7.0: - version "3.7.0" - resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" - integrity sha1-cstmi0JSKCkKu/qFaJJYcwioAfs= - dependencies: - camelcase-keys "^2.0.0" - decamelize "^1.1.2" - loud-rejection "^1.0.0" - map-obj "^1.0.1" - minimist "^1.1.3" - normalize-package-data "^2.3.4" - object-assign "^4.0.1" - read-pkg-up "^1.0.1" - redent "^1.0.0" - trim-newlines "^1.0.0" - -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= - -merge-source-map@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646" - integrity sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw== - dependencies: - source-map "^0.6.1" - -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -merge2@^1.2.3: - version "1.3.0" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" - integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== - -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= - -micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: - version "3.1.10" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" - -miller-rabin@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" - integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== - dependencies: - bn.js "^4.0.0" - brorand "^1.0.1" - -mime-db@1.40.0: - version "1.40.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" - integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== - -"mime-db@>= 1.40.0 < 2": - version "1.42.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac" - integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ== - -mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24: - version "2.1.24" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" - integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== - dependencies: - mime-db "1.40.0" - -mime@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - -mime@^2.4.4: - version "2.4.4" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" - integrity sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== - -mimic-fn@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" - integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== - -mimic-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -mimic-response@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" - integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= - -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4, minimatch@~3.0.2: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - -minimist@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.1.0.tgz#99df657a52574c21c9057497df742790b2b4c0de" - integrity sha1-md9lelJXTCHJBXSX33QnkLK0wN4= - -minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= - -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= - -minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - -minizlib@^1.2.1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - -mississippi@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" - integrity sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA== - dependencies: - concat-stream "^1.5.0" - duplexify "^3.4.2" - end-of-stream "^1.1.0" - flush-write-stream "^1.0.0" - from2 "^2.1.0" - parallel-transform "^1.1.0" - pump "^3.0.0" - pumpify "^1.3.3" - stream-each "^1.1.0" - through2 "^2.0.0" - -mixin-deep@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" - integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== - dependencies: - for-in "^1.0.2" - is-extendable "^1.0.1" - -"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" - -move-concurrently@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" - integrity sha1-viwAX9oy4LKa8fBdfEszIUxwH5I= - dependencies: - aproba "^1.1.1" - copy-concurrently "^1.0.0" - fs-write-stream-atomic "^1.0.8" - mkdirp "^0.5.1" - rimraf "^2.5.4" - run-queue "^1.0.3" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= - -ms@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== - -ms@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -multicast-dns-service-types@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz#899f11d9686e5e05cb91b35d5f0e63b773cfc901" - integrity sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE= - -multicast-dns@^6.0.1: - version "6.2.3" - resolved "https://registry.yarnpkg.com/multicast-dns/-/multicast-dns-6.2.3.tgz#a0ec7bd9055c4282f790c3c82f4e28db3b31b229" - integrity sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g== - dependencies: - dns-packet "^1.3.1" - thunky "^1.0.2" - -multimatch@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-2.1.0.tgz#9c7906a22fb4c02919e2f5f75161b4cdbd4b2a2b" - integrity sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis= - dependencies: - array-differ "^1.0.0" - array-union "^1.0.1" - arrify "^1.0.0" - minimatch "^3.0.0" - -mute-stream@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= - -nan@^2.12.1, nan@^2.13.2: - version "2.14.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" - integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== - -nanomatch@^1.2.9: - version "1.2.13" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" - integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - define-property "^2.0.2" - extend-shallow "^3.0.2" - fragment-cache "^0.2.1" - is-windows "^1.0.2" - kind-of "^6.0.2" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= - -needle@^2.2.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" - integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== - dependencies: - debug "^3.2.6" - iconv-lite "^0.4.4" - sax "^1.2.4" - -negotiator@0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" - integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== - -neo-async@^2.5.0, neo-async@^2.6.0, neo-async@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" - integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== - -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - -no-case@^2.2.0: - version "2.3.2" - resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" - integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ== - dependencies: - lower-case "^1.1.1" - -node-dir@^0.1.17: - version "0.1.17" - resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" - integrity sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU= - dependencies: - minimatch "^3.0.2" - -node-forge@0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" - integrity sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ== - -node-gyp@^3.8.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.8.0.tgz#540304261c330e80d0d5edce253a68cb3964218c" - integrity sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA== - dependencies: - fstream "^1.0.0" - glob "^7.0.3" - graceful-fs "^4.1.2" - mkdirp "^0.5.0" - nopt "2 || 3" - npmlog "0 || 1 || 2 || 3 || 4" - osenv "0" - request "^2.87.0" - rimraf "2" - semver "~5.3.0" - tar "^2.0.0" - which "1" - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= - -node-libs-browser@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.1.tgz#b64f513d18338625f90346d27b0d235e631f6425" - integrity sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q== - dependencies: - assert "^1.1.1" - browserify-zlib "^0.2.0" - buffer "^4.3.0" - console-browserify "^1.1.0" - constants-browserify "^1.0.0" - crypto-browserify "^3.11.0" - domain-browser "^1.1.1" - events "^3.0.0" - https-browserify "^1.0.0" - os-browserify "^0.3.0" - path-browserify "0.0.1" - process "^0.11.10" - punycode "^1.2.4" - querystring-es3 "^0.2.0" - readable-stream "^2.3.3" - stream-browserify "^2.0.1" - stream-http "^2.7.2" - string_decoder "^1.0.0" - timers-browserify "^2.0.4" - tty-browserify "0.0.0" - url "^0.11.0" - util "^0.11.0" - vm-browserify "^1.0.1" - -node-modules-regexp@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" - integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= - -node-notifier@^5.4.2: - version "5.4.3" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" - integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== - dependencies: - growly "^1.3.0" - is-wsl "^1.1.0" - semver "^5.5.0" - shellwords "^0.1.1" - which "^1.3.0" - -node-pre-gyp@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149" - integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4" - -node-releases@^1.1.38: - version "1.1.39" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.39.tgz#c1011f30343aff5b633153b10ff691d278d08e8d" - integrity sha512-8MRC/ErwNCHOlAFycy9OPca46fQYUjbJRDcZTHVWIGXIjYLM73k70vv3WkYutVnM4cCo4hE0MqBVVZjP6vjISA== - dependencies: - semver "^6.3.0" - -node-sass@^4.13.0: - version "4.13.0" - resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.13.0.tgz#b647288babdd6a1cb726de4545516b31f90da066" - integrity sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA== - dependencies: - async-foreach "^0.1.3" - chalk "^1.1.1" - cross-spawn "^3.0.0" - gaze "^1.0.0" - get-stdin "^4.0.1" - glob "^7.0.3" - in-publish "^2.0.0" - lodash "^4.17.15" - meow "^3.7.0" - mkdirp "^0.5.1" - nan "^2.13.2" - node-gyp "^3.8.0" - npmlog "^4.0.0" - request "^2.88.0" - sass-graph "^2.2.4" - stdout-stream "^1.4.0" - "true-case-path" "^1.0.2" - -"nopt@2 || 3": - version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" - integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= - dependencies: - abbrev "1" - -nopt@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" - integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= - dependencies: - abbrev "1" - osenv "^0.1.4" - -normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" - integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== - dependencies: - hosted-git-info "^2.1.4" - resolve "^1.10.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -normalize-path@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= - dependencies: - remove-trailing-separator "^1.0.1" - -normalize-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -normalize-url@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-2.0.1.tgz#835a9da1551fa26f70e92329069a23aa6574d7e6" - integrity sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw== - dependencies: - prepend-http "^2.0.0" - query-string "^5.0.1" - sort-keys "^2.0.0" - -normalize.css@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/normalize.css/-/normalize.css-8.0.1.tgz#9b98a208738b9cc2634caacbc42d131c97487bf3" - integrity sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg== - -npm-bundled@^1.0.1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.6.tgz#e7ba9aadcef962bb61248f91721cd932b3fe6bdd" - integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== - -npm-packlist@^1.1.6: - version "1.4.6" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.6.tgz#53ba3ed11f8523079f1457376dd379ee4ea42ff4" - integrity sha512-u65uQdb+qwtGvEJh/DgQgW1Xg7sqeNbmxYyrvlNznaVTjV3E5P6F/EFjM+BVHXl7JJlsdG8A64M0XI8FI/IOlg== - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= - dependencies: - path-key "^2.0.0" - -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -nth-check@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c" - integrity sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg== - dependencies: - boolbase "~1.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= - -nwsapi@^2.0.7: - version "2.2.0" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" - integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -object-copy@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= - dependencies: - copy-descriptor "^0.1.0" - define-property "^0.2.5" - kind-of "^3.0.3" - -object-inspect@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" - integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== - -object-is@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6" - integrity sha1-CqYOyZiaCz7Xlc9NBvYs8a1lObY= - -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== - -object-visit@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= - dependencies: - isobject "^3.0.0" - -object.assign@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== - dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" - -object.getownpropertydescriptors@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" - integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= - dependencies: - define-properties "^1.1.2" - es-abstract "^1.5.1" - -object.pick@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" - integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= - dependencies: - isobject "^3.0.1" - -obuf@^1.0.0, obuf@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" - integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== - -on-finished@~2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" - integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= - dependencies: - ee-first "1.1.1" - -on-headers@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" - integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== - -once@^1.3.0, once@^1.3.1, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -onetime@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" - integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= - dependencies: - mimic-fn "^1.0.0" - -opn@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" - integrity sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA== - dependencies: - is-wsl "^1.1.0" - -optimist@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" - integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= - dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" - -optionator@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" - integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.4" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - wordwrap "~1.0.0" - -original@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/original/-/original-1.0.2.tgz#e442a61cffe1c5fd20a65f3261c26663b303f25f" - integrity sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg== - dependencies: - url-parse "^1.4.3" - -os-browserify@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" - integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= - -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= - -os-locale@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" - integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk= - dependencies: - lcid "^1.0.0" - -os-locale@^3.0.0, os-locale@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" - integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== - dependencies: - execa "^1.0.0" - lcid "^2.0.0" - mem "^4.0.0" - -os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= - -osenv@0, osenv@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - -p-cancelable@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" - integrity sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw== - -p-cancelable@^0.4.0: - version "0.4.1" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.4.1.tgz#35f363d67d52081c8d9585e37bcceb7e0bbcb2a0" - integrity sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ== - -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= - -p-each-series@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" - integrity sha1-kw89Et0fUOdDRFeiLNbwSsatf3E= - dependencies: - p-reduce "^1.0.0" - -p-finally@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" - integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= - -p-is-promise@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-1.1.0.tgz#9c9456989e9f6588017b0434d56097675c3da05e" - integrity sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4= - -p-is-promise@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" - integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== - -p-limit@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" - integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== - dependencies: - p-try "^2.0.0" - -p-locate@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" - integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== - dependencies: - p-limit "^2.0.0" - -p-map@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" - integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== - -p-reduce@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" - integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= - -p-retry@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-3.0.1.tgz#316b4c8893e2c8dc1cfa891f406c4b422bebf328" - integrity sha512-XE6G4+YTTkT2a0UWb2kjZe8xNwf8bIbnqpc/IS/idOBVhyves0mK5OJgeocjx7q5pvX/6m23xuzVPYT1uGM73w== - dependencies: - retry "^0.12.0" - -p-timeout@^1.1.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-1.2.1.tgz#5eb3b353b7fce99f101a1038880bb054ebbea386" - integrity sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y= - dependencies: - p-finally "^1.0.0" - -p-timeout@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-2.0.1.tgz#d8dd1979595d2dc0139e1fe46b8b646cb3cdf038" - integrity sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA== - dependencies: - p-finally "^1.0.0" - -p-try@^2.0.0, p-try@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - -pako@~1.0.5: - version "1.0.10" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" - integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== - -parallel-transform@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.2.0.tgz#9049ca37d6cb2182c3b1d2c720be94d14a5814fc" - integrity sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg== - dependencies: - cyclist "^1.0.1" - inherits "^2.0.3" - readable-stream "^2.1.5" - -param-case@2.1.x: - version "2.1.1" - resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247" - integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc= - dependencies: - no-case "^2.2.0" - -parse-asn1@^5.0.0: - version "5.1.5" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.5.tgz#003271343da58dc94cace494faef3d2147ecea0e" - integrity sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ== - dependencies: - asn1.js "^4.0.0" - browserify-aes "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.0" - pbkdf2 "^3.0.3" - safe-buffer "^5.1.1" - -parse-json@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" - integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= - dependencies: - error-ex "^1.2.0" - -parse-json@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" - integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= - dependencies: - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" - -parse-passwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" - integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= - -parse5@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" - integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== - -parseurl@~1.3.2, parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - -pascalcase@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" - integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= - -path-browserify@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" - integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== - -path-dirname@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" - integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= - -path-exists@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" - integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= - dependencies: - pinkie-promise "^2.0.0" - -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= - -path-key@^2.0.0, path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= - -path-parse@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== - -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= - -path-type@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" - integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= - dependencies: - graceful-fs "^4.1.2" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -path-type@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" - integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== - dependencies: - pify "^3.0.0" - -pbkdf2@^3.0.3: - version "3.0.17" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" - integrity sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== - dependencies: - create-hash "^1.1.2" - create-hmac "^1.1.4" - ripemd160 "^2.0.1" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= - -pify@^2.0.0, pify@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= - -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= - -pify@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" - integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= - -pirates@^4.0.0, pirates@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" - integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== - dependencies: - node-modules-regexp "^1.0.0" - -pkg-dir@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" - integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== - dependencies: - find-up "^3.0.0" - -pn@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" - integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== - -portfinder@^1.0.25: - version "1.0.25" - resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.25.tgz#254fd337ffba869f4b9d37edc298059cb4d35eca" - integrity sha512-6ElJnHBbxVA1XSLgBp7G1FiCkQdlqGzuF7DswL5tcea+E8UpuvPU7beVAjjRwCioTS9ZluNbu+ZyRvgTsmqEBg== - dependencies: - async "^2.6.2" - debug "^3.1.1" - mkdirp "^0.5.1" - -posix-character-classes@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" - integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= - -postcss-modules-extract-imports@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz#818719a1ae1da325f9832446b01136eeb493cd7e" - integrity sha512-LaYLDNS4SG8Q5WAWqIJgdHPJrDDr/Lv775rMBFUbgjTz6j34lUznACHcdRWroPvXANP2Vj7yNK57vp9eFqzLWQ== - dependencies: - postcss "^7.0.5" - -postcss-modules-local-by-default@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.2.tgz#e8a6561be914aaf3c052876377524ca90dbb7915" - integrity sha512-jM/V8eqM4oJ/22j0gx4jrp63GSvDH6v86OqyTHHUvk4/k1vceipZsaymiZ5PvocqZOl5SFHiFJqjs3la0wnfIQ== - dependencies: - icss-utils "^4.1.1" - postcss "^7.0.16" - postcss-selector-parser "^6.0.2" - postcss-value-parser "^4.0.0" - -postcss-modules-scope@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-2.1.0.tgz#ad3f5bf7856114f6fcab901b0502e2a2bc39d4eb" - integrity sha512-91Rjps0JnmtUB0cujlc8KIKCsJXWjzuxGeT/+Q2i2HXKZ7nBUeF9YQTZZTNvHVoNYj1AthsjnGLtqDUE0Op79A== - dependencies: - postcss "^7.0.6" - postcss-selector-parser "^6.0.0" - -postcss-modules-values@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz#5b5000d6ebae29b4255301b4a3a54574423e7f10" - integrity sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg== - dependencies: - icss-utils "^4.0.0" - postcss "^7.0.6" - -postcss-selector-parser@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz#249044356697b33b64f1a8f7c80922dddee7195c" - integrity sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ== - dependencies: - cssesc "^2.0.0" - indexes-of "^1.0.1" - uniq "^1.0.1" - -postcss-selector-parser@^6.0.0, postcss-selector-parser@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz#934cf799d016c83411859e09dcecade01286ec5c" - integrity sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg== - dependencies: - cssesc "^3.0.0" - indexes-of "^1.0.1" - uniq "^1.0.1" - -postcss-value-parser@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.2.tgz#482282c09a42706d1fc9a069b73f44ec08391dc9" - integrity sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ== - -postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.5, postcss@^7.0.6: - version "7.0.21" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.21.tgz#06bb07824c19c2021c5d056d5b10c35b989f7e17" - integrity sha512-uIFtJElxJo29QC753JzhidoAhvp/e/Exezkdhfmt8AymWT6/5B7W1WmponYWkHk2eg6sONyTch0A3nkMPun3SQ== - dependencies: - chalk "^2.4.2" - source-map "^0.6.1" - supports-color "^6.1.0" - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= - -prepend-http@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" - integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= - -prepend-http@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" - integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= - -prettier@^1.17.0, prettier@^1.18.2: - version "1.18.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" - integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== - -pretty-bytes@^5.1.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.3.0.tgz#f2849e27db79fb4d6cfe24764fc4134f165989f2" - integrity sha512-hjGrh+P926p4R4WbaB6OckyRtO0F0/lQBiT+0gnxjV+5kjPBrfVBFCsCLbMqVQeydvIoouYTCmmEURiH3R1Bdg== - -pretty-error@^2.0.2: - version "2.1.1" - resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3" - integrity sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM= - dependencies: - renderkid "^2.0.1" - utila "~0.4" - -pretty-format@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" - integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== - dependencies: - "@jest/types" "^24.9.0" - ansi-regex "^4.0.0" - ansi-styles "^3.2.0" - react-is "^16.8.4" - -private@^0.1.6, private@~0.1.5: - version "0.1.8" - resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" - integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== - -process-nextick-args@^2.0.0, process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= - -promise-inflight@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" - integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= - -prompts@^2.0.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.2.1.tgz#f901dd2a2dfee080359c0e20059b24188d75ad35" - integrity sha512-VObPvJiWPhpZI6C5m60XOzTfnYg/xc/an+r9VYymj9WJW3B/DIH+REzjpAACPf8brwPeP+7vz3bIim3S+AaMjw== - dependencies: - kleur "^3.0.3" - sisteransi "^1.0.3" - -proxy-addr@~2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" - integrity sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ== - dependencies: - forwarded "~0.1.2" - ipaddr.js "1.9.0" - -prr@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" - integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= - -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= - -psl@^1.1.24, psl@^1.1.28: - version "1.4.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" - integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== - -public-encrypt@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" - integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== - dependencies: - bn.js "^4.1.0" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - parse-asn1 "^5.0.0" - randombytes "^2.0.1" - safe-buffer "^5.1.2" - -pump@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" - integrity sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -pump@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" - integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -pumpify@^1.3.3: - version "1.5.1" - resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce" - integrity sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ== - dependencies: - duplexify "^3.6.0" - inherits "^2.0.3" - pump "^2.0.0" - -punycode@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= - -punycode@^1.2.4, punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= - -punycode@^2.1.0, punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== - -qs@6.7.0: - version "6.7.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" - integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== - -qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== - -query-string@^5.0.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" - integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== - dependencies: - decode-uri-component "^0.2.0" - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" - -querystring-es3@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" - integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= - -querystring@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= - -querystringify@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" - integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== - -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - -randomfill@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" - integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== - dependencies: - randombytes "^2.0.5" - safe-buffer "^5.1.0" - -range-parser@^1.2.1, range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" - integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== - dependencies: - bytes "3.1.0" - http-errors "1.7.2" - iconv-lite "0.4.24" - unpipe "1.0.0" - -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -react-is@^16.8.4: - version "16.11.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa" - integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw== - -read-chunk@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/read-chunk/-/read-chunk-3.2.0.tgz#2984afe78ca9bfbbdb74b19387bf9e86289c16ca" - integrity sha512-CEjy9LCzhmD7nUpJ1oVOE6s/hBkejlcJEgLQHVnQznOSilOPb+kpKktlLfFDK3/WP43+F80xkUTM2VOkYoSYvQ== - dependencies: - pify "^4.0.1" - with-open-file "^0.1.6" - -read-pkg-up@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" - integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= - dependencies: - find-up "^1.0.0" - read-pkg "^1.0.0" - -read-pkg-up@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" - integrity sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== - dependencies: - find-up "^3.0.0" - read-pkg "^3.0.0" - -read-pkg@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" - integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= - dependencies: - load-json-file "^1.0.0" - normalize-package-data "^2.3.2" - path-type "^1.0.0" - -read-pkg@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" - integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= - dependencies: - load-json-file "^4.0.0" - normalize-package-data "^2.3.2" - path-type "^3.0.0" - -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: - version "2.3.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -"readable-stream@2 || 3", readable-stream@^3.0.6, readable-stream@^3.1.1: - version "3.4.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" - integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readdirp@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" - integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== - dependencies: - graceful-fs "^4.1.11" - micromatch "^3.1.10" - readable-stream "^2.0.2" - -realpath-native@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" - integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== - dependencies: - util.promisify "^1.0.0" - -recast@^0.16.1: - version "0.16.2" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.16.2.tgz#3796ebad5fe49ed85473b479cd6df554ad725dc2" - integrity sha512-O/7qXi51DPjRVdbrpNzoBQH5dnAPQNbfoOFyRiUwreTMJfIHYOEBzwuH+c0+/BTSJ3CQyKs6ILSWXhESH6Op3A== - dependencies: - ast-types "0.11.7" - esprima "~4.0.0" - private "~0.1.5" - source-map "~0.6.1" - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= - dependencies: - resolve "^1.1.6" - -redent@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" - integrity sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94= - dependencies: - indent-string "^2.1.0" - strip-indent "^1.0.1" - -regenerate-unicode-properties@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" - integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== - dependencies: - regenerate "^1.4.0" - -regenerate@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" - integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== - -regenerator-transform@^0.14.0: - version "0.14.1" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" - integrity sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ== - dependencies: - private "^0.1.6" - -regex-not@^1.0.0, regex-not@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" - integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== - dependencies: - extend-shallow "^3.0.2" - safe-regex "^1.1.0" - -regexp.prototype.flags@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz#6b30724e306a27833eeb171b66ac8890ba37e41c" - integrity sha512-ztaw4M1VqgMwl9HlPpOuiYgItcHlunW0He2fE6eNfT6E/CF2FtYi9ofOYe4mKntstYk0Fyh/rDRBdS3AnxjlrA== - dependencies: - define-properties "^1.1.2" - -regexpu-core@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" - integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== - dependencies: - regenerate "^1.4.0" - regenerate-unicode-properties "^8.1.0" - regjsgen "^0.5.0" - regjsparser "^0.6.0" - unicode-match-property-ecmascript "^1.0.4" - unicode-match-property-value-ecmascript "^1.1.0" - -regjsgen@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.1.tgz#48f0bf1a5ea205196929c0d9798b42d1ed98443c" - integrity sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg== - -regjsparser@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c" - integrity sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ== - dependencies: - jsesc "~0.5.0" - -relateurl@0.2.x: - version "0.2.7" - resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" - integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk= - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= - -renderkid@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-2.0.3.tgz#380179c2ff5ae1365c522bf2fcfcff01c5b74149" - integrity sha512-z8CLQp7EZBPCwCnncgf9C4XAi3WR0dv+uWu/PjIyhhAb5d6IJ/QZqlHFprHeKT+59//V6BNUsLbvN8+2LarxGA== - dependencies: - css-select "^1.1.0" - dom-converter "^0.2" - htmlparser2 "^3.3.0" - strip-ansi "^3.0.0" - utila "^0.4.0" - -repeat-element@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" - integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== - -repeat-string@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= - -repeating@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" - integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= - dependencies: - is-finite "^1.0.0" - -replace-ext@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" - integrity sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ= - -replace-ext@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb" - integrity sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs= - -request-promise-core@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.3.tgz#e9a3c081b51380dfea677336061fea879a829ee9" - integrity sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ== - dependencies: - lodash "^4.17.15" - -request-promise-native@^1.0.5: - version "1.0.8" - resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.8.tgz#a455b960b826e44e2bf8999af64dff2bfe58cb36" - integrity sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ== - dependencies: - request-promise-core "1.1.3" - stealthy-require "^1.1.1" - tough-cookie "^2.3.3" - -request@^2.87.0, request@^2.88.0: - version "2.88.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" - integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.0" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.4.3" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= - -require-main-filename@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" - integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= - -require-main-filename@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" - integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= - -resolve-cwd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" - integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= - dependencies: - resolve-from "^3.0.0" - -resolve-dir@^1.0.0, resolve-dir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43" - integrity sha1-eaQGRMNivoLybv/nOcm7U4IEb0M= - dependencies: - expand-tilde "^2.0.0" - global-modules "^1.0.0" - -resolve-from@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" - integrity sha1-six699nWiBvItuZTM17rywoYh0g= - -resolve-url@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" - integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= - -resolve@1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" - integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= - -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.3.2: - version "1.12.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" - integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== - dependencies: - path-parse "^1.0.6" - -responselike@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" - integrity sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec= - dependencies: - lowercase-keys "^1.0.0" - -restore-cursor@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" - integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= - dependencies: - onetime "^2.0.0" - signal-exit "^3.0.2" - -ret@~0.1.10: - version "0.1.15" - resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" - integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== - -retry@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" - integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= - -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - -rimraf@~2.6.2: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== - dependencies: - glob "^7.1.3" - -ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - -rsvp@^4.8.4: - version "4.8.5" - resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" - integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== - -run-async@^2.0.0, run-async@^2.2.0, run-async@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" - integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= - dependencies: - is-promise "^2.1.0" - -run-queue@^1.0.0, run-queue@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" - integrity sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec= - dependencies: - aproba "^1.1.1" - -rxjs@^6.4.0: - version "6.5.3" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" - integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== - dependencies: - tslib "^1.9.0" - -safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" - integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== - -safe-regex@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" - integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= - dependencies: - ret "~0.1.10" - -"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -sane@^4.0.3: - version "4.1.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" - integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== - dependencies: - "@cnakazawa/watch" "^1.0.3" - anymatch "^2.0.0" - capture-exit "^2.0.0" - exec-sh "^0.3.2" - execa "^1.0.0" - fb-watchman "^2.0.0" - micromatch "^3.1.4" - minimist "^1.1.1" - walker "~1.0.5" - -sass-graph@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.4.tgz#13fbd63cd1caf0908b9fd93476ad43a51d1e0b49" - integrity sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k= - dependencies: - glob "^7.0.0" - lodash "^4.0.0" - scss-tokenizer "^0.2.3" - yargs "^7.0.0" - -sass-loader@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-8.0.0.tgz#e7b07a3e357f965e6b03dd45b016b0a9746af797" - integrity sha512-+qeMu563PN7rPdit2+n5uuYVR0SSVwm0JsOUsaJXzgYcClWSlmX0iHDnmeOobPkf5kUglVot3QS6SyLyaQoJ4w== - dependencies: - clone-deep "^4.0.1" - loader-utils "^1.2.3" - neo-async "^2.6.1" - schema-utils "^2.1.0" - semver "^6.3.0" - -sax@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== - -schema-utils@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" - integrity sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g== - dependencies: - ajv "^6.1.0" - ajv-errors "^1.0.0" - ajv-keywords "^3.1.0" - -schema-utils@^2.0.0, schema-utils@^2.0.1, schema-utils@^2.1.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.5.0.tgz#8f254f618d402cc80257486213c8970edfd7c22f" - integrity sha512-32ISrwW2scPXHUSusP8qMg5dLUawKkyV+/qIEV9JdXKx+rsM6mi8vZY8khg2M69Qom16rtroWXD3Ybtiws38gQ== - dependencies: - ajv "^6.10.2" - ajv-keywords "^3.4.1" - -scoped-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/scoped-regex/-/scoped-regex-1.0.0.tgz#a346bb1acd4207ae70bd7c0c7ca9e566b6baddb8" - integrity sha1-o0a7Gs1CB65wvXwMfKnlZra63bg= - -scss-tokenizer@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1" - integrity sha1-jrBtualyMzOCTT9VMGQRSYR85dE= - dependencies: - js-base64 "^2.1.8" - source-map "^0.4.2" - -select-hose@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" - integrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo= - -selfsigned@^1.10.7: - version "1.10.7" - resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-1.10.7.tgz#da5819fd049d5574f28e88a9bcc6dbc6e6f3906b" - integrity sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA== - dependencies: - node-forge "0.9.0" - -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - -semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== - -semver@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= - -send@0.17.1: - version "0.17.1" - resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" - integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== - dependencies: - debug "2.6.9" - depd "~1.1.2" - destroy "~1.0.4" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "~1.7.2" - mime "1.6.0" - ms "2.1.1" - on-finished "~2.3.0" - range-parser "~1.2.1" - statuses "~1.5.0" - -serialize-javascript@^1.7.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.9.1.tgz#cfc200aef77b600c47da9bb8149c943e798c2fdb" - integrity sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A== - -serve-index@^1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" - integrity sha1-03aNabHn2C5c4FD/9bRTvqEqkjk= - dependencies: - accepts "~1.3.4" - batch "0.6.1" - debug "2.6.9" - escape-html "~1.0.3" - http-errors "~1.6.2" - mime-types "~2.1.17" - parseurl "~1.3.2" - -serve-static@1.14.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" - integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.17.1" - -set-blocking@^2.0.0, set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= - -set-value@^2.0.0, set-value@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" - integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" - -setimmediate@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= - -setprototypeof@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" - integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== - -setprototypeof@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" - integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== - -sha.js@^2.4.0, sha.js@^2.4.8: - version "2.4.11" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -shallow-clone@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" - integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== - dependencies: - kind-of "^6.0.2" - -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= - dependencies: - shebang-regex "^1.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= - -shelljs@^0.8.0: - version "0.8.3" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097" - integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A== - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -shellwords@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" - integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== - -signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= - -sisteransi@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.3.tgz#98168d62b79e3a5e758e27ae63c4a053d748f4eb" - integrity sha512-SbEG75TzH8G7eVXFSN5f9EExILKfly7SUvVY5DhhYLvfhKqhDFY0OzevWa/zwak0RLRfWS5AvfMWpd9gJvr5Yg== - -slash@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" - integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= - -slash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" - integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== - -snapdragon-node@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" - integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== - dependencies: - define-property "^1.0.0" - isobject "^3.0.0" - snapdragon-util "^3.0.1" - -snapdragon-util@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" - integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== - dependencies: - kind-of "^3.2.0" - -snapdragon@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" - integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== - dependencies: - base "^0.11.1" - debug "^2.2.0" - define-property "^0.2.5" - extend-shallow "^2.0.1" - map-cache "^0.2.2" - source-map "^0.5.6" - source-map-resolve "^0.5.0" - use "^3.1.0" - -sockjs-client@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.4.0.tgz#c9f2568e19c8fd8173b4997ea3420e0bb306c7d5" - integrity sha512-5zaLyO8/nri5cua0VtOrFXBPK1jbL4+1cebT/mmKA1E1ZXOvJrII75bPu0l0k843G/+iAbhEqzyKr0w/eCCj7g== - dependencies: - debug "^3.2.5" - eventsource "^1.0.7" - faye-websocket "~0.11.1" - inherits "^2.0.3" - json3 "^3.3.2" - url-parse "^1.4.3" - -sockjs@0.3.19: - version "0.3.19" - resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.19.tgz#d976bbe800af7bd20ae08598d582393508993c0d" - integrity sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw== - dependencies: - faye-websocket "^0.10.0" - uuid "^3.0.1" - -sort-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128" - integrity sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg= - dependencies: - is-plain-obj "^1.0.0" - -source-list-map@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" - integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== - -source-map-resolve@^0.5.0: - version "0.5.2" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" - integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== - dependencies: - atob "^2.1.1" - decode-uri-component "^0.2.0" - resolve-url "^0.2.1" - source-map-url "^0.4.0" - urix "^0.1.0" - -source-map-support@^0.5.16, source-map-support@^0.5.6, source-map-support@~0.5.12: - version "0.5.16" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" - integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map-url@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" - integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= - -source-map@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" - integrity sha1-66T12pwNyZneaAMti092FzZSA2s= - dependencies: - amdefine ">=0.0.4" - -source-map@^0.5.0, source-map@^0.5.6: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= - -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -spdx-correct@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" - integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -spdx-exceptions@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" - integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== - -spdx-expression-parse@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" - integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== - dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.5" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" - integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== - -spdy-transport@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdy-transport/-/spdy-transport-3.0.0.tgz#00d4863a6400ad75df93361a1608605e5dcdcf31" - integrity sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw== - dependencies: - debug "^4.1.0" - detect-node "^2.0.4" - hpack.js "^2.1.6" - obuf "^1.1.2" - readable-stream "^3.0.6" - wbuf "^1.7.3" - -spdy@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/spdy/-/spdy-4.0.1.tgz#6f12ed1c5db7ea4f24ebb8b89ba58c87c08257f2" - integrity sha512-HeZS3PBdMA+sZSu0qwpCxl3DeALD5ASx8pAX0jZdKXSpPWbQ6SYGnlg3BBmYLx5LtiZrmkAZfErCm2oECBcioA== - dependencies: - debug "^4.1.0" - handle-thing "^2.0.0" - http-deceiver "^1.2.7" - select-hose "^2.0.0" - spdy-transport "^3.0.0" - -split-string@^3.0.1, split-string@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" - integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== - dependencies: - extend-shallow "^3.0.0" - -sshpk@^1.7.0: - version "1.16.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" - integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - -ssri@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" - integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA== - dependencies: - figgy-pudding "^3.5.1" - -stack-utils@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" - integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== - -static-extend@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" - integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= - dependencies: - define-property "^0.2.5" - object-copy "^0.1.0" - -"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@~1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" - integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= - -stdout-stream@^1.4.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/stdout-stream/-/stdout-stream-1.4.1.tgz#5ac174cdd5cd726104aa0c0b2bd83815d8d535de" - integrity sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA== - dependencies: - readable-stream "^2.0.1" - -stealthy-require@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" - integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= - -stream-browserify@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" - integrity sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg== - dependencies: - inherits "~2.0.1" - readable-stream "^2.0.2" - -stream-each@^1.1.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" - integrity sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw== - dependencies: - end-of-stream "^1.1.0" - stream-shift "^1.0.0" - -stream-http@^2.7.2: - version "2.8.3" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.3.tgz#b2d242469288a5a27ec4fe8933acf623de6514fc" - integrity sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw== - dependencies: - builtin-status-codes "^3.0.0" - inherits "^2.0.1" - readable-stream "^2.3.6" - to-arraybuffer "^1.0.0" - xtend "^4.0.0" - -stream-shift@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" - integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= - -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" - integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= - -string-length@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" - integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= - dependencies: - astral-regex "^1.0.0" - strip-ansi "^4.0.0" - -string-template@~0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add" - integrity sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0= - -string-width@^1.0.1, string-width@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string-width@^3.0.0, string-width@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" - integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== - dependencies: - emoji-regex "^7.0.1" - is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.1.0" - -string.prototype.trimleft@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" - integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== - dependencies: - define-properties "^1.1.3" - function-bind "^1.1.1" - -string.prototype.trimright@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" - integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== - dependencies: - define-properties "^1.1.3" - function-bind "^1.1.1" - -string_decoder@^1.0.0, string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= - dependencies: - ansi-regex "^3.0.0" - -strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== - dependencies: - ansi-regex "^4.1.0" - -strip-bom-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz#f87db5ef2613f6968aa545abfe1ec728b6a829ca" - integrity sha1-+H217yYT9paKpUWr/h7HKLaoKco= - dependencies: - first-chunk-stream "^2.0.0" - strip-bom "^2.0.0" - -strip-bom@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" - integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= - dependencies: - is-utf8 "^0.2.0" - -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= - -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= - -strip-indent@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" - integrity sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI= - dependencies: - get-stdin "^4.0.1" - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= - -style-loader@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.0.0.tgz#1d5296f9165e8e2c85d24eee0b7caf9ec8ca1f82" - integrity sha512-B0dOCFwv7/eY31a5PCieNwMgMhVGFe9w+rh7s/Bx8kfFkrth9zfTZquoYvdw8URgiqxObQKcpW51Ugz1HjfdZw== - dependencies: - loader-utils "^1.2.3" - schema-utils "^2.0.1" - -supports-color@6.1.0, supports-color@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" - integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== - dependencies: - has-flag "^3.0.0" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -symbol-tree@^3.2.2: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - -tapable@^1.0.0, tapable@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" - integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== - -tar@^2.0.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.2.tgz#0ca8848562c7299b8b446ff6a4d60cdbb23edc40" - integrity sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA== - dependencies: - block-stream "*" - fstream "^1.0.12" - inherits "2" - -tar@^4: - version "4.4.13" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" - integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== - dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.8.6" - minizlib "^1.2.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.3" - -temp@^0.8.1: - version "0.8.4" - resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.4.tgz#8c97a33a4770072e0a05f919396c7665a7dd59f2" - integrity sha512-s0ZZzd0BzYv5tLSptZooSjK8oj6C+c19p7Vqta9+6NPOf7r+fxq0cJe6/oN4LTC79sy5NY8ucOJNgwsKCSbfqg== - dependencies: - rimraf "~2.6.2" - -terser-webpack-plugin@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4" - integrity sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg== - dependencies: - cacache "^12.0.2" - find-cache-dir "^2.1.0" - is-wsl "^1.1.0" - schema-utils "^1.0.0" - serialize-javascript "^1.7.0" - source-map "^0.6.1" - terser "^4.1.2" - webpack-sources "^1.4.0" - worker-farm "^1.7.0" - -terser@^4.1.2: - version "4.3.9" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.9.tgz#e4be37f80553d02645668727777687dad26bbca8" - integrity sha512-NFGMpHjlzmyOtPL+fDw3G7+6Ueh/sz4mkaUYa4lJCxOPTNzd0Uj0aZJOmsDYoSQyfuVoWDMSWTPU3huyOm2zdA== - dependencies: - commander "^2.20.0" - source-map "~0.6.1" - source-map-support "~0.5.12" - -test-exclude@^5.2.3: - version "5.2.3" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" - integrity sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g== - dependencies: - glob "^7.1.3" - minimatch "^3.0.4" - read-pkg-up "^4.0.0" - require-main-filename "^2.0.0" - -text-table@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= - -textextensions@^2.4.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-2.5.0.tgz#e21d3831dafa37513dd80666dff541414e314293" - integrity sha512-1IkVr355eHcomgK7fgj1Xsokturx6L5S2JRT5WcRdA6v5shk9sxWuO/w/VbpQexwkXJMQIa/j1dBi3oo7+HhcA== - -throat@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" - integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= - -through2@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" - integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== - dependencies: - readable-stream "~2.3.6" - xtend "~4.0.1" - -through2@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/through2/-/through2-3.0.1.tgz#39276e713c3302edf9e388dd9c812dd3b825bd5a" - integrity sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww== - dependencies: - readable-stream "2 || 3" - -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= - -thunky@^1.0.2: - version "1.1.0" - resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" - integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== - -timed-out@^4.0.0, timed-out@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" - integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= - -timers-browserify@^2.0.4: - version "2.0.11" - resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.11.tgz#800b1f3eee272e5bc53ee465a04d0e804c31211f" - integrity sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ== - dependencies: - setimmediate "^1.0.4" - -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== - dependencies: - os-tmpdir "~1.0.2" - -tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= - -to-arraybuffer@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" - integrity sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= - -to-object-path@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= - dependencies: - kind-of "^3.0.2" - -to-regex-range@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" - integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= - dependencies: - is-number "^3.0.0" - repeat-string "^1.6.1" - -to-regex@^3.0.1, to-regex@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" - integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== - dependencies: - define-property "^2.0.2" - extend-shallow "^3.0.2" - regex-not "^1.0.2" - safe-regex "^1.1.0" - -toidentifier@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" - integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== - -toposort@^1.0.0: - version "1.0.7" - resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" - integrity sha1-LmhELZ9k7HILjMieZEOsbKqVACk= - -tough-cookie@^2.3.3, tough-cookie@^2.3.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - -tough-cookie@~2.4.3: - version "2.4.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" - integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== - dependencies: - psl "^1.1.24" - punycode "^1.4.1" - -tr46@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" - integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= - dependencies: - punycode "^2.1.0" - -trim-newlines@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" - integrity sha1-WIeWa7WCpFA6QetST301ARgVphM= - -"true-case-path@^1.0.2": - version "1.0.3" - resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-1.0.3.tgz#f813b5a8c86b40da59606722b144e3225799f47d" - integrity sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew== - dependencies: - glob "^7.1.2" - -tslib@^1.9.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" - integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== - -tty-browserify@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" - integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY= - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= - dependencies: - prelude-ls "~1.1.2" - -type-is@~1.6.17, type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= - -typescript@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== - -uglify-js@3.4.x: - version "3.4.10" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f" - integrity sha512-Y2VsbPVs0FIshJztycsO2SfPk7/KAF/T72qzv9u5EpQ4kB2hQoHlhNQTsNyy6ul7lQtqJN/AoWeS23OzEiEFxw== - dependencies: - commander "~2.19.0" - source-map "~0.6.1" - -uglify-js@^3.1.4: - version "3.6.7" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.7.tgz#15f49211df6b8a01ee91322bbe46fa33223175dc" - integrity sha512-4sXQDzmdnoXiO+xvmTzQsfIiwrjUCSA95rSP4SEd8tDb51W2TiDOlL76Hl+Kw0Ie42PSItCW8/t6pBNCF2R48A== - dependencies: - commander "~2.20.3" - source-map "~0.6.1" - -unicode-canonical-property-names-ecmascript@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" - integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== - -unicode-match-property-ecmascript@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" - integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== - dependencies: - unicode-canonical-property-names-ecmascript "^1.0.4" - unicode-property-aliases-ecmascript "^1.0.4" - -unicode-match-property-value-ecmascript@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz#5b4b426e08d13a80365e0d657ac7a6c1ec46a277" - integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g== - -unicode-property-aliases-ecmascript@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz#a9cc6cc7ce63a0a3023fc99e341b94431d405a57" - integrity sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw== - -union-value@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" - integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== - dependencies: - arr-union "^3.1.0" - get-value "^2.0.6" - is-extendable "^0.1.1" - set-value "^2.0.1" - -uniq@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" - integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8= - -unique-filename@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" - integrity sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ== - dependencies: - unique-slug "^2.0.0" - -unique-slug@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c" - integrity sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w== - dependencies: - imurmurhash "^0.1.4" - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= - -unset-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" - integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= - dependencies: - has-value "^0.3.1" - isobject "^3.0.0" - -untildify@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9" - integrity sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA== - -upath@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" - integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== - -upper-case@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" - integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg= - -uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== - dependencies: - punycode "^2.1.0" - -urix@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" - integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= - -url-parse-lax@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" - integrity sha1-evjzA2Rem9eaJy56FKxovAYJ2nM= - dependencies: - prepend-http "^1.0.1" - -url-parse-lax@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c" - integrity sha1-FrXK/Afb42dsGxmZF3gj1lA6yww= - dependencies: - prepend-http "^2.0.0" - -url-parse@^1.4.3: - version "1.4.7" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278" - integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -url-to-options@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9" - integrity sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k= - -url@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= - dependencies: - punycode "1.3.2" - querystring "0.2.0" - -use@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" - integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== - -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - -util.promisify@1.0.0, util.promisify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" - integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== - dependencies: - define-properties "^1.1.2" - object.getownpropertydescriptors "^2.0.3" - -util@0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= - dependencies: - inherits "2.0.1" - -util@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/util/-/util-0.11.1.tgz#3236733720ec64bb27f6e26f421aaa2e1b588d61" - integrity sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ== - dependencies: - inherits "2.0.3" - -utila@^0.4.0, utila@~0.4: - version "0.4.0" - resolved "https://registry.yarnpkg.com/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" - integrity sha1-ihagXURWV6Oupe7MWxKk+lN5dyw= - -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= - -uuid@^3.0.1, uuid@^3.3.2: - version "3.3.3" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" - integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== - -v8-compile-cache@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz#00f7494d2ae2b688cfe2899df6ed2c54bef91dbe" - integrity sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w== - -validate-npm-package-license@^3.0.1: - version "3.0.4" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" - integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== - dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - -vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -vinyl-file@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/vinyl-file/-/vinyl-file-2.0.0.tgz#a7ebf5ffbefda1b7d18d140fcb07b223efb6751a" - integrity sha1-p+v1/779obfRjRQPyweyI++2dRo= - dependencies: - graceful-fs "^4.1.2" - pify "^2.3.0" - pinkie-promise "^2.0.0" - strip-bom "^2.0.0" - strip-bom-stream "^2.0.0" - vinyl "^1.1.0" - -vinyl@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-1.2.0.tgz#5c88036cf565e5df05558bfc911f8656df218884" - integrity sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ= - dependencies: - clone "^1.0.0" - clone-stats "^0.0.1" - replace-ext "0.0.1" - -vinyl@^2.0.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.2.0.tgz#d85b07da96e458d25b2ffe19fece9f2caa13ed86" - integrity sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg== - dependencies: - clone "^2.1.1" - clone-buffer "^1.0.0" - clone-stats "^1.0.0" - cloneable-readable "^1.0.0" - remove-trailing-separator "^1.0.1" - replace-ext "^1.0.0" - -vm-browserify@^1.0.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" - integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== - -vue-hot-reload-api@^2.3.0: - version "2.3.4" - resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2" - integrity sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog== - -vue-loader@^15.7.2: - version "15.7.2" - resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.7.2.tgz#cc89e2716df87f70fe656c9da9d7f8bec06c73d6" - integrity sha512-H/P9xt/nkocyu4hZKg5TzPqyCT1oKOaCSk9zs0JCbJuy0Q8KtR0bjJpnT/5R5x/Ckd1GFkkLQnQ1C4x6xXeLZg== - dependencies: - "@vue/component-compiler-utils" "^3.0.0" - hash-sum "^1.0.2" - loader-utils "^1.1.0" - vue-hot-reload-api "^2.3.0" - vue-style-loader "^4.1.0" - -vue-style-loader@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8" - integrity sha512-0ip8ge6Gzz/Bk0iHovU9XAUQaFt/G2B61bnWa2tCcqqdgfHs1lF9xXorFbE55Gmy92okFT+8bfmySuUOu13vxQ== - dependencies: - hash-sum "^1.0.2" - loader-utils "^1.0.2" - -vue-template-compiler@^2.6.10: - version "2.6.10" - resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.10.tgz#323b4f3495f04faa3503337a82f5d6507799c9cc" - integrity sha512-jVZkw4/I/HT5ZMvRnhv78okGusqe0+qH2A0Em0Cp8aq78+NK9TII263CDVz2QXZsIT+yyV/gZc/j/vlwa+Epyg== - dependencies: - de-indent "^1.0.2" - he "^1.1.0" - -vue-template-es2015-compiler@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825" - integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw== - -vue@^2.6.10: - version "2.6.10" - resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637" - integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ== - -w3c-hr-time@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" - integrity sha1-gqwr/2PZUOqeMYmlimViX+3xkEU= - dependencies: - browser-process-hrtime "^0.1.2" - -walker@^1.0.7, walker@~1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" - integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= - dependencies: - makeerror "1.0.x" - -watchpack@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00" - integrity sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA== - dependencies: - chokidar "^2.0.2" - graceful-fs "^4.1.2" - neo-async "^2.5.0" - -wbuf@^1.1.0, wbuf@^1.7.3: - version "1.7.3" - resolved "https://registry.yarnpkg.com/wbuf/-/wbuf-1.7.3.tgz#c1d8d149316d3ea852848895cb6a0bfe887b87df" - integrity sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA== - dependencies: - minimalistic-assert "^1.0.0" - -webidl-conversions@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" - integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== - -webpack-cli@^3.3.10: - version "3.3.10" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.10.tgz#17b279267e9b4fb549023fae170da8e6e766da13" - integrity sha512-u1dgND9+MXaEt74sJR4PR7qkPxXUSQ0RXYq8x1L6Jg1MYVEmGPrH6Ah6C4arD4r0J1P5HKjRqpab36k0eIzPqg== - dependencies: - chalk "2.4.2" - cross-spawn "6.0.5" - enhanced-resolve "4.1.0" - findup-sync "3.0.0" - global-modules "2.0.0" - import-local "2.0.0" - interpret "1.2.0" - loader-utils "1.2.3" - supports-color "6.1.0" - v8-compile-cache "2.0.3" - yargs "13.2.4" - -webpack-dev-middleware@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.2.tgz#0019c3db716e3fa5cecbf64f2ab88a74bab331f3" - integrity sha512-1xC42LxbYoqLNAhV6YzTYacicgMZQTqRd27Sim9wn5hJrX3I5nxYy1SxSd4+gjUFsz1dQFj+yEe6zEVmSkeJjw== - dependencies: - memory-fs "^0.4.1" - mime "^2.4.4" - mkdirp "^0.5.1" - range-parser "^1.2.1" - webpack-log "^2.0.0" - -webpack-dev-server@^3.1.10, webpack-dev-server@^3.9.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.9.0.tgz#27c3b5d0f6b6677c4304465ac817623c8b27b89c" - integrity sha512-E6uQ4kRrTX9URN9s/lIbqTAztwEPdvzVrcmHE8EQ9YnuT9J8Es5Wrd8n9BKg1a0oZ5EgEke/EQFgUsp18dSTBw== - dependencies: - ansi-html "0.0.7" - bonjour "^3.5.0" - chokidar "^2.1.8" - compression "^1.7.4" - connect-history-api-fallback "^1.6.0" - debug "^4.1.1" - del "^4.1.1" - express "^4.17.1" - html-entities "^1.2.1" - http-proxy-middleware "0.19.1" - import-local "^2.0.0" - internal-ip "^4.3.0" - ip "^1.1.5" - is-absolute-url "^3.0.3" - killable "^1.0.1" - loglevel "^1.6.4" - opn "^5.5.0" - p-retry "^3.0.1" - portfinder "^1.0.25" - schema-utils "^1.0.0" - selfsigned "^1.10.7" - semver "^6.3.0" - serve-index "^1.9.1" - sockjs "0.3.19" - sockjs-client "1.4.0" - spdy "^4.0.1" - strip-ansi "^3.0.1" - supports-color "^6.1.0" - url "^0.11.0" - webpack-dev-middleware "^3.7.2" - webpack-log "^2.0.0" - ws "^6.2.1" - yargs "12.0.5" - -webpack-log@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/webpack-log/-/webpack-log-2.0.0.tgz#5b7928e0637593f119d32f6227c1e0ac31e1b47f" - integrity sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg== - dependencies: - ansi-colors "^3.0.0" - uuid "^3.3.2" - -webpack-sources@^1.4.0, webpack-sources@^1.4.1: - version "1.4.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933" - integrity sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ== - dependencies: - source-list-map "^2.0.0" - source-map "~0.6.1" - -webpack@4.x.x, webpack@^4.41.2: - version "4.41.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.2.tgz#c34ec76daa3a8468c9b61a50336d8e3303dce74e" - integrity sha512-Zhw69edTGfbz9/8JJoyRQ/pq8FYUoY0diOXqW0T6yhgdhCv6wr0hra5DwwWexNRns2Z2+gsnrNcbe9hbGBgk/A== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-module-context" "1.8.5" - "@webassemblyjs/wasm-edit" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - acorn "^6.2.1" - ajv "^6.10.2" - ajv-keywords "^3.4.1" - chrome-trace-event "^1.0.2" - enhanced-resolve "^4.1.0" - eslint-scope "^4.0.3" - json-parse-better-errors "^1.0.2" - loader-runner "^2.4.0" - loader-utils "^1.2.3" - memory-fs "^0.4.1" - micromatch "^3.1.10" - mkdirp "^0.5.1" - neo-async "^2.6.1" - node-libs-browser "^2.2.1" - schema-utils "^1.0.0" - tapable "^1.1.3" - terser-webpack-plugin "^1.4.1" - watchpack "^1.6.0" - webpack-sources "^1.4.1" - -websocket-driver@>=0.5.1: - version "0.7.3" - resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.3.tgz#a2d4e0d4f4f116f1e6297eba58b05d430100e9f9" - integrity sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg== - dependencies: - http-parser-js ">=0.4.0 <0.4.11" - safe-buffer ">=5.1.0" - websocket-extensions ">=0.1.1" - -websocket-extensions@>=0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" - integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== - -whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: - version "1.0.5" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" - integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== - dependencies: - iconv-lite "0.4.24" - -whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" - integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== - -whatwg-url@^6.4.1: - version "6.5.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" - integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== - dependencies: - lodash.sortby "^4.7.0" - tr46 "^1.0.1" - webidl-conversions "^4.0.2" - -whatwg-url@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" - integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg== - dependencies: - lodash.sortby "^4.7.0" - tr46 "^1.0.1" - webidl-conversions "^4.0.2" - -which-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" - integrity sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8= - -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= - -which@1, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== - dependencies: - isexe "^2.0.0" - -wide-align@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== - dependencies: - string-width "^1.0.2 || 2" - -with-open-file@^0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/with-open-file/-/with-open-file-0.1.6.tgz#0bc178ecab75f6baac8ae11c85e07445d690ea50" - integrity sha512-SQS05JekbtwQSgCYlBsZn/+m2gpn4zWsqpCYIrCHva0+ojXcnmUEPsBN6Ipoz3vmY/81k5PvYEWSxER2g4BTqA== - dependencies: - p-finally "^1.0.0" - p-try "^2.1.0" - pify "^4.0.1" - -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= - -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= - -worker-farm@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8" - integrity sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw== - dependencies: - errno "~0.1.7" - -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - -wrap-ansi@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" - integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== - dependencies: - ansi-styles "^3.2.0" - string-width "^3.0.0" - strip-ansi "^5.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -write-file-atomic@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" - integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - signal-exit "^3.0.2" - -write-file-atomic@^2.3.0: - version "2.4.3" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" - integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - signal-exit "^3.0.2" - -ws@^5.2.0: - version "5.2.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" - integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== - dependencies: - async-limiter "~1.0.0" - -ws@^6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" - integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== - dependencies: - async-limiter "~1.0.0" - -xml-name-validator@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" - integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== - -xtend@^4.0.0, xtend@~4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - -y18n@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" - integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= - -"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== - -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" - integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= - -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== - -yargs-parser@^11.1.1: - version "11.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" - integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -yargs-parser@^13.1.0, yargs-parser@^13.1.1: - version "13.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" - integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -yargs-parser@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" - integrity sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo= - dependencies: - camelcase "^3.0.0" - -yargs@12.0.5: - version "12.0.5" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" - integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== - dependencies: - cliui "^4.0.0" - decamelize "^1.2.0" - find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^3.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^11.1.1" - -yargs@13.2.4: - version "13.2.4" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.2.4.tgz#0b562b794016eb9651b98bd37acf364aa5d6dc83" - integrity sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg== - dependencies: - cliui "^5.0.0" - find-up "^3.0.0" - get-caller-file "^2.0.1" - os-locale "^3.1.0" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^3.0.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^13.1.0" - -yargs@^13.3.0: - version "13.3.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" - integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== - dependencies: - cliui "^5.0.0" - find-up "^3.0.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^3.0.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^13.1.1" - -yargs@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" - integrity sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg= - dependencies: - camelcase "^3.0.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^1.4.0" - read-pkg-up "^1.0.1" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^1.0.2" - which-module "^1.0.0" - y18n "^3.2.1" - yargs-parser "^5.0.0" - -yargs@~1.2.6: - version "1.2.6" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-1.2.6.tgz#9c7b4a82fd5d595b2bf17ab6dcc43135432fe34b" - integrity sha1-nHtKgv1dWVsr8Xq23MQxNUMv40s= - dependencies: - minimist "^0.1.0" - -yeoman-environment@^2.0.5, yeoman-environment@^2.3.4: - version "2.6.0" - resolved "https://registry.yarnpkg.com/yeoman-environment/-/yeoman-environment-2.6.0.tgz#db884c778946fec9a41e8980a6b3aa94fe41302d" - integrity sha512-Hl0LBs9/mKun8XyJ6gFiUNhZwjN/eezn+E9IFWz6KtXg/3wsnztF2lgtE8eIjfhWYtvY4yMq9iizi1Ei5JJ+7A== - dependencies: - chalk "^2.4.1" - cross-spawn "^6.0.5" - debug "^3.1.0" - diff "^3.5.0" - escape-string-regexp "^1.0.2" - globby "^8.0.1" - grouped-queue "^0.3.3" - inquirer "^6.0.0" - is-scoped "^1.0.0" - lodash "^4.17.10" - log-symbols "^2.2.0" - mem-fs "^1.1.0" - strip-ansi "^4.0.0" - text-table "^0.2.0" - untildify "^3.0.3" - -yeoman-generator@^3.1.1: - version "3.2.0" - resolved "https://registry.yarnpkg.com/yeoman-generator/-/yeoman-generator-3.2.0.tgz#02077d2d7ff28fedc1ed7dad7f9967fd7c3604cc" - integrity sha512-iR/qb2je3GdXtSfxgvOXxUW0Cp8+C6LaZaNlK2BAICzFNzwHtM10t/QBwz5Ea9nk6xVDQNj4Q889TjCXGuIv8w== - dependencies: - async "^2.6.0" - chalk "^2.3.0" - cli-table "^0.3.1" - cross-spawn "^6.0.5" - dargs "^6.0.0" - dateformat "^3.0.3" - debug "^4.1.0" - detect-conflict "^1.0.0" - error "^7.0.2" - find-up "^3.0.0" - github-username "^4.0.0" - istextorbinary "^2.2.1" - lodash "^4.17.10" - make-dir "^1.1.0" - mem-fs-editor "^5.0.0" - minimist "^1.2.0" - pretty-bytes "^5.1.0" - read-chunk "^3.0.0" - read-pkg-up "^4.0.0" - rimraf "^2.6.2" - run-async "^2.0.0" - shelljs "^0.8.0" - text-table "^0.2.0" - through2 "^3.0.0" - yeoman-environment "^2.0.5" diff --git a/oldstuff/waterbill/.gitignore b/oldstuff/waterbill/.gitignore deleted file mode 100644 index 2f7896d..0000000 --- a/oldstuff/waterbill/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target/ diff --git a/oldstuff/waterbill/Cargo.lock b/oldstuff/waterbill/Cargo.lock deleted file mode 100644 index aacbdf3..0000000 --- a/oldstuff/waterbill/Cargo.lock +++ /dev/null @@ -1,4 +0,0 @@ -[root] -name = "waterbill" -version = "0.1.0" - diff --git a/oldstuff/waterbill/Cargo.toml b/oldstuff/waterbill/Cargo.toml deleted file mode 100644 index da2bee6..0000000 --- a/oldstuff/waterbill/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "waterbill" -version = "0.1.0" -authors = ["Dan Buch "] - -[dependencies] diff --git a/oldstuff/waterbill/src/main.rs b/oldstuff/waterbill/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/oldstuff/waterbill/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/oldstuff/whothis/main.go b/oldstuff/whothis/main.go deleted file mode 100644 index 8eaef59..0000000 --- a/oldstuff/whothis/main.go +++ /dev/null @@ -1,12 +0,0 @@ -package main - -import ( - "fmt" - "os" - "path/filepath" -) - -func main() { - fmt.Printf("args: %#v\n", os.Args) - fmt.Printf("prog: %s\n", filepath.Base(os.Args[0])) -} diff --git a/oldstuff/why/metaid/attr_abort.rb b/oldstuff/why/metaid/attr_abort.rb deleted file mode 100644 index f5b90d6..0000000 --- a/oldstuff/why/metaid/attr_abort.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Class - def attr_abort(*args) - abort "Please no more attributes today." - end -end - -class MyNewClass - attr_abort :id, :diagram, :telegram -end diff --git a/oldstuff/why/metaid/happy_truck.rb b/oldstuff/why/metaid/happy_truck.rb deleted file mode 100644 index a35051c..0000000 --- a/oldstuff/why/metaid/happy_truck.rb +++ /dev/null @@ -1,5 +0,0 @@ -require_relative 'mail_truck' - -class HappyTruck < MailTruck - company "Happy's -- We Bring the Mail, and That's It!" -end diff --git a/oldstuff/why/metaid/mail_truck.rb b/oldstuff/why/metaid/mail_truck.rb deleted file mode 100644 index 283a0fd..0000000 --- a/oldstuff/why/metaid/mail_truck.rb +++ /dev/null @@ -1,15 +0,0 @@ -require_relative 'metaid' - -class MailTruck - attr_accessor :driver, :route - - def initialize(driver, route) - @driver, @route = driver, route - end - - def self.company(name) - meta_def :company do - name - end - end -end diff --git a/oldstuff/why/metaid/metaid.rb b/oldstuff/why/metaid/metaid.rb deleted file mode 100644 index c4ff082..0000000 --- a/oldstuff/why/metaid/metaid.rb +++ /dev/null @@ -1,19 +0,0 @@ -class Object - def metaclass - class << self - self - end - end - - def meta_eval(&block) - metaclass.instance_eval(&block) - end - - def meta_def(name, &block) - meta_eval { define_method(name, &block) } - end - - def class_def(name, &block) - class_eval { define_method(name, &block) } - end -end diff --git a/oldstuff/youtube-api-poking/.gitignore b/oldstuff/youtube-api-poking/.gitignore deleted file mode 100644 index 0b40a1f..0000000 --- a/oldstuff/youtube-api-poking/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -client_id.json -.env -subscriptions.json -exchange_auth.json diff --git a/oldstuff/youtube-api-poking/create-grant-url b/oldstuff/youtube-api-poking/create-grant-url deleted file mode 100755 index 5a733a1..0000000 --- a/oldstuff/youtube-api-poking/create-grant-url +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -main() { - [[ "${OOM_CLIENT_ID}" ]] || { - echo "Missing \$OOM_CLIENT_ID" - exit 1 - } - - local url='https://accounts.google.com/o/oauth2/auth' - - url="${url}?client_id=${OOM_CLIENT_ID}" - url="${url}&redirect_uri=urn:ietf:wg:oauth:2.0:oob" - url="${url}&scope=https://www.googleapis.com/auth/youtube" - url="${url}&response_type=code&access_type=offline" - - echo "${url}" -} - -main "$@" diff --git a/oldstuff/youtube-api-poking/exchange-auth-code b/oldstuff/youtube-api-poking/exchange-auth-code deleted file mode 100755 index c20029b..0000000 --- a/oldstuff/youtube-api-poking/exchange-auth-code +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -main() { - local single_use_token="${1}" - - [[ "${single_use_token}" ]] || { - echo "Missing single use token arg" - exit 1 - } - - [[ "${OOM_CLIENT_ID}" ]] || { - echo "Missing \$OOM_CLIENT_ID" - exit 1 - } - - [[ "${OOM_CLIENT_SECRET}" ]] || { - echo "Missing \$OOM_CLIENT_SECRET" - exit 1 - } - - curl \ - -X POST \ - -sSL \ - -d "client_id=${OOM_CLIENT_ID}" \ - -d "code=${single_use_token}" \ - -d "client_secret=${OOM_CLIENT_SECRET}" \ - -d 'redirect_uri=urn:ietf:wg:oauth:2.0:oob' \ - -d 'grant_type=authorization_code' \ - 'https://accounts.google.com/o/oauth2/token' -} - -main "$@" diff --git a/oldstuff/youtube-api-poking/functions.bash b/oldstuff/youtube-api-poking/functions.bash deleted file mode 100644 index 09e2dfe..0000000 --- a/oldstuff/youtube-api-poking/functions.bash +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -__fetch_access_token() { - local client_id="${1}" - local client_secret="${2}" - local refresh_token="${3}" - local oauth2_token_url="${4}" - : "${oauth2_token_url:=https://accounts.google.com/o/oauth2/token}" - - curl \ - -sSL \ - -X POST \ - -d "client_id=${client_id}" \ - -d "client_secret=${client_secret}" \ - -d "refresh_token=${refresh_token}" \ - -d 'grant_type=refresh_token' \ - "${oauth2_token_url}" \ - | jq -r '.access_token' -} - -__googleapis_http() { - local client_id="${1}" - shift - local client_secret="${1}" - shift - local refresh_token="${1}" - shift - local verb="${1}" - shift - local path="${1}" - shift - - local qs='' - local first=1 - - for param in "${@}"; do - if [[ "${first}" = '1' ]]; then - qs="${param}" - first=0 - continue - fi - qs="${qs}&${param}" - done - - local access_token - access_token="$( - __fetch_access_token \ - "${client_id}" \ - "${client_secret}" \ - "${refresh_token}" - )" - - local curl_opts - if [[ "${DEBUG}" ]]; then - curl_opts=-vvvv - fi - curl \ - -sSL ${curl_opts} \ - -X "${verb}" \ - -H "Authorization: Bearer ${access_token}" \ - "https://www.googleapis.com${path}?${qs}" \ - | jq . -} diff --git a/oldstuff/youtube-api-poking/list-channels b/oldstuff/youtube-api-poking/list-channels deleted file mode 100755 index b523052..0000000 --- a/oldstuff/youtube-api-poking/list-channels +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -main() { - source "$(dirname "${BASH_SOURCE[0]}")/functions.bash" - - __googleapis_http \ - "${OOM_CLIENT_ID}" \ - "${OOM_CLIENT_SECRET}" \ - "${OOM_YOUTUBE_REFRESH_TOKEN}" \ - GET /youtube/v3/channels \ - part=contentDetails mine=true maxResults=50 -} - -main "$@" diff --git a/oldstuff/youtube-api-poking/list-playlistitems b/oldstuff/youtube-api-poking/list-playlistitems deleted file mode 100755 index 00fe456..0000000 --- a/oldstuff/youtube-api-poking/list-playlistitems +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -main() { - local playlist_id="${1}" - - source "$(dirname "${BASH_SOURCE[0]}")/functions.bash" - - __googleapis_http \ - "${OOM_CLIENT_ID}" \ - "${OOM_CLIENT_SECRET}" \ - "${OOM_YOUTUBE_REFRESH_TOKEN}" \ - GET /youtube/v3/playlistItems \ - part=snippet mine=true maxResults=50 id=${playlist_id} -} - -main "$@" diff --git a/oldstuff/youtube-api-poking/list-playlists b/oldstuff/youtube-api-poking/list-playlists deleted file mode 100755 index c822c1d..0000000 --- a/oldstuff/youtube-api-poking/list-playlists +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -main() { - source "$(dirname "${BASH_SOURCE[0]}")/functions.bash" - - __googleapis_http \ - "${OOM_CLIENT_ID}" \ - "${OOM_CLIENT_SECRET}" \ - "${OOM_YOUTUBE_REFRESH_TOKEN}" \ - GET /youtube/v3/playlists \ - part=contentDetails mine=true maxResults=50 -} - -main "$@" diff --git a/oldstuff/youtube-api-poking/list-subs b/oldstuff/youtube-api-poking/list-subs deleted file mode 100755 index 40a60c0..0000000 --- a/oldstuff/youtube-api-poking/list-subs +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -main() { - source "$(dirname "${BASH_SOURCE[0]}")/functions.bash" - - __googleapis_http \ - "${OOM_CLIENT_ID}" \ - "${OOM_CLIENT_SECRET}" \ - "${OOM_YOUTUBE_REFRESH_TOKEN}" \ - GET /youtube/v3/subscriptions \ - part=snippet mine=true maxResults=50 -} - -main "$@" diff --git a/oldstuff/youtube-api-poking/refresh-token b/oldstuff/youtube-api-poking/refresh-token deleted file mode 100755 index 7ec67b1..0000000 --- a/oldstuff/youtube-api-poking/refresh-token +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -main() { - [[ "${OOM_YOUTUBE_ACCESS_TOKEN}" ]] || { - echo "Missing \$OOM_YOUTUBE_ACCESS_TOKEN" - exit 1 - } - - [[ "${OOM_CLIENT_SECRET}" ]] || { - echo "Missing \$OOM_CLIENT_SECRET" - exit 1 - } - - [[ "${OOM_CLIENT_ID}" ]] || { - echo "Missing \$OOM_CLIENT_ID" - exit 1 - } - - curl \ - -vvvv \ - -X POST \ - -sSL \ - -d client_id="${OOM_CLIENT_ID}" \ - -d client_secret="${OOM_CLIENT_SECRET}" \ - -d refresh_token="${OOM_YOUTUBE_ACCESS_TOKEN}" \ - -d grant_type=refresh_token \ - 'https://accounts.google.com/o/oauth2/token' -} - -main "$@" diff --git a/oldstuff/zeromq/.gitignore b/oldstuff/zeromq/.gitignore deleted file mode 100644 index e36b962..0000000 --- a/oldstuff/zeromq/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -hwserver -hwclient -wuserver -wuclient -taskvent -taskwork -tasksink diff --git a/oldstuff/zeromq/Makefile b/oldstuff/zeromq/Makefile deleted file mode 100644 index ade6e01..0000000 --- a/oldstuff/zeromq/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -CFLAGS += -I. -I/usr/local/include -LDFLAGS += -lstdc++ -lpthread -luuid -lrt -LIBZMQ := /usr/local/lib/libzmq.a -TARGETS := hwserver hwclient wuserver wuclient taskvent taskwork tasksink - - -%:%.c - $(CC) $(CFLAGS) -o $@ $^ $(LIBZMQ) $(LDFLAGS) - - -all: $(TARGETS) - - -clean: - rm -vf $(TARGETS) - - -.PHONY: all clean diff --git a/oldstuff/zeromq/hwclient.c b/oldstuff/zeromq/hwclient.c deleted file mode 100644 index 16c600c..0000000 --- a/oldstuff/zeromq/hwclient.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include - -int main(void) -{ - void *context = zmq_init(1); - - printf("Connecting to hello world server.\n"); - void *requester = zmq_socket(context, ZMQ_REQ); - zmq_connect(requester, "tcp://localhost:5555"); - - int request_nbr; - for (request_nbr = 0; request_nbr != 10; request_nbr++) { - zmq_msg_t request; - zmq_msg_init_size(&request, 5); - memcpy(zmq_msg_data(&request), "Hello", 5); - printf("Sending Hello %d...\n", request_nbr); - zmq_send(requester, &request, 0); - zmq_msg_close(&request); - - zmq_msg_t reply; - zmq_msg_init(&reply); - zmq_recv(requester, &reply, 0); - printf("Received World %d\n", request_nbr); - zmq_msg_close(&reply); - } - zmq_close(requester); - zmq_term(context); - return 0; -} diff --git a/oldstuff/zeromq/hwclient.rb b/oldstuff/zeromq/hwclient.rb deleted file mode 100644 index 0096283..0000000 --- a/oldstuff/zeromq/hwclient.rb +++ /dev/null @@ -1,29 +0,0 @@ -# vim:fileencoding=utf-8:expandtab - -require 'zmq' - -def main - context = ZMQ::Context.new(1) - - puts "Connecting to hello world server…" - requester = context.socket(ZMQ::REQ) - requester.connect("tcp://localhost:5555") - puts "requester is a #{requester.class.inspect}" - - 0.upto(9) do |request_nbr| - puts "Sending request #{request_nbr}…" - if requester.send("Hello") - puts "Sent request, now receiving reply" - reply = requester.recv - puts "Received reply #{request_nbr}: [#{reply}]" - end - end - - puts "Outside of loop now. Closing socket..." - requester.close -end - - -if $0 == __FILE__ - main -end diff --git a/oldstuff/zeromq/hwserver.c b/oldstuff/zeromq/hwserver.c deleted file mode 100644 index 3e9cea2..0000000 --- a/oldstuff/zeromq/hwserver.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include -#include -#include - -#define BIND_ADDR "tcp://*:5555" - -int main(void) -{ - void *context = zmq_init(1); - - void *responder = zmq_socket(context, ZMQ_REP); - printf("Binding server to %s\n", BIND_ADDR); - printf("pid=%d\n", getpid()); - zmq_bind(responder, BIND_ADDR); - - printf("Starting loop.\n"); - while(1) { - zmq_msg_t request; - zmq_msg_init(&request); - zmq_recv(responder, &request, 0); - printf("Received Hello\n"); - zmq_msg_close(&request); - - sleep(1); - - zmq_msg_t reply; - zmq_msg_init_size(&reply, 5); - memcpy(zmq_msg_data(&reply), "World", 5); - zmq_send(responder, &reply, 0); - zmq_msg_close(&reply); - } - - zmq_close(responder); - zmq_term(context); - return 0; -} diff --git a/oldstuff/zeromq/hwserver.py b/oldstuff/zeromq/hwserver.py deleted file mode 100644 index e47e799..0000000 --- a/oldstuff/zeromq/hwserver.py +++ /dev/null @@ -1,35 +0,0 @@ -# vim:fileencoding=utf-8 -from __future__ import print_function - -import sys -import time - -import zmq - - -BIND_ADDR = 'tcp://*:5555' - - -def main(): - context = zmq.Context(1) - responder = context.socket(zmq.REP) - - print('Binding server to {}'.format(BIND_ADDR)) - responder.bind(BIND_ADDR) - - print('Starting loop.') - try: - while True: - responder.recv() - print('Received Hello') - time.sleep(0.25) - responder.send("World") - - except KeyboardInterrupt: - responder.close() - context.term() - return 0 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/oldstuff/zeromq/tasksink.c b/oldstuff/zeromq/tasksink.c deleted file mode 100644 index b3277d2..0000000 --- a/oldstuff/zeromq/tasksink.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "zhelpers.h" - -int main(void) -{ - void *context = zmq_init(1); - void *receiver = zmq_socket(context, ZMQ_PULL); - zmq_bind(receiver, "tcp://*:5558"); - - char *string = s_recv(receiver); - free(string); - - int64_t start_time = s_clock(); - - int task_nbr; - for (task_nbr = 0; task_nbr < 100; task_nbr++) { - char *string = s_recv(receiver); - free(string); - if ((task_nbr / 10) * 10 == task_nbr) { - printf(":"); - } else { - printf("."); - } - fflush(stdout); - } - - printf("\nTotal elapsed time: %d msec\n", - (int) (s_clock() - start_time)); - - zmq_close(receiver); - zmq_term(context); - return 0; -} diff --git a/oldstuff/zeromq/taskvent.c b/oldstuff/zeromq/taskvent.c deleted file mode 100644 index da938d3..0000000 --- a/oldstuff/zeromq/taskvent.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "zhelpers.h" - -int main(void) -{ - void *context = zmq_init(1); - - void *sender = zmq_socket(context, ZMQ_PUSH); - zmq_bind(sender, "tcp://*:5557"); - - void *sink = zmq_socket(context, ZMQ_PUSH); - zmq_connect(sink, "tcp://localhost:5558"); - - printf("Press Enter when the workers are ready: "); - getchar(); - printf("Sending tasks to workers...\n"); - - s_send(sink, "0"); - srandom((unsigned) time(NULL)); - - int task_nbr; - int total_msec = 0; - for (task_nbr = 0; task_nbr < 100; task_nbr++) { - int workload; - workload = randof(100) + 1; - total_msec += workload; - char string[10]; - sprintf(string, "%d", workload); - s_send(sender, string); - } - printf("Total expected cost: %d msec\n", total_msec); - sleep(1); - - zmq_close(sink); - zmq_close(sender); - zmq_term(context); - return 0; -} diff --git a/oldstuff/zeromq/taskwork.c b/oldstuff/zeromq/taskwork.c deleted file mode 100644 index 547691b..0000000 --- a/oldstuff/zeromq/taskwork.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "zhelpers.h" - -int main(void) -{ - void *context = zmq_init(1); - - void *receiver = zmq_socket(context, ZMQ_PULL); - zmq_connect(receiver, "tcp://localhost:5557"); - - void *sender = zmq_socket(context, ZMQ_PUSH); - zmq_connect(sender, "tcp://localhost:5558"); - - while (1) { - char *string = s_recv(receiver); - fflush(stdout); - printf("%s.", string); - - s_sleep(atoi(string)); - free(string); - - s_send(sender, ""); - } - zmq_close(receiver); - zmq_close(sender); - zmq_term(context); - return 0; -} diff --git a/oldstuff/zeromq/wuclient.c b/oldstuff/zeromq/wuclient.c deleted file mode 100644 index d4acb33..0000000 --- a/oldstuff/zeromq/wuclient.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "zhelpers.h" - -int main(int argc, char *argv[]) -{ - void *context = zmq_init(1); - - printf("Collecting updates from weather server...\n"); - void *subscriber = zmq_socket(context, ZMQ_SUB); - zmq_connect(subscriber, "tcp://localhost:5556"); - - // Subscribe to zipcode, default is NYC, 10001 - char *filter = (argc > 1) ? argv[1]: "10001"; - zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, filter, strlen(filter)); - - int update_nbr; - long total_temp = 0; - for (update_nbr = 0; update_nbr < 100; update_nbr++) { - char *string = s_recv(subscriber); - int zipcode, temperature, relhumidity; - sscanf(string, "%d %d %d", &zipcode, &temperature, &relhumidity); - total_temp += temperature; - free(string); - } - - printf("Average temperature for zipcode '%s' was %dF\n", - filter, (int)(total_temp / update_nbr)); - zmq_close(subscriber); - zmq_term(context); - return 0; -} diff --git a/oldstuff/zeromq/wuclient.py b/oldstuff/zeromq/wuclient.py deleted file mode 100644 index db20776..0000000 --- a/oldstuff/zeromq/wuclient.py +++ /dev/null @@ -1,32 +0,0 @@ -# vim:fileencoding=utf-8 - -from __future__ import print_function - -import sys -import zmq - - -def main(sysargs=sys.argv[:]): - context = zmq.Context() - socket = context.socket(zmq.SUB) - - print("Collecting updates from weather server…") - socket.connect("tcp://localhost:5556") - - target_zipcode = sysargs[1] if len(sysargs) > 1 else '10001' - socket.setsockopt(zmq.SUBSCRIBE, target_zipcode) - - total_temp = 0 - for update_nbr in range(100): - string = socket.recv() - total_temp += int(string.split()[1]) - - print("Average temperature for zipcode '{}' was {}F".format( - target_zipcode, total_temp / update_nbr - )) - - return 0 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/oldstuff/zeromq/wuserver.c b/oldstuff/zeromq/wuserver.c deleted file mode 100644 index 0fbea45..0000000 --- a/oldstuff/zeromq/wuserver.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "zhelpers.h" - -int main(void) -{ - void *context = zmq_init(1); - void *publisher = zmq_socket(context, ZMQ_PUB); - zmq_bind(publisher, "tcp://*:5556"); - zmq_bind(publisher, "ipc://weather.ipc"); - - srandom((unsigned) time (NULL)); - while (1) { - int zipcode, temperature, relhumidity; - zipcode = randof(100000); - temperature = randof(215) - 80; - relhumidity = randof(50) + 10; - - char update[20]; - sprintf(update, "%05d %d %d", zipcode, temperature, relhumidity); - s_send(publisher, update); - } - zmq_close(publisher); - zmq_term(context); - return 0; -} diff --git a/oldstuff/zeromq/zhelpers.h b/oldstuff/zeromq/zhelpers.h deleted file mode 100644 index e28d1f6..0000000 --- a/oldstuff/zeromq/zhelpers.h +++ /dev/null @@ -1,191 +0,0 @@ -/* ===================================================================== - zhelpers.h - - Helper header file for example applications. - ===================================================================== -*/ - -#ifndef __ZHELPERS_H_INCLUDED__ -#define __ZHELPERS_H_INCLUDED__ - -// Include a bunch of headers that we will need in the examples - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Version checking, and patch up missing constants to match 2.1 -#if ZMQ_VERSION_MAJOR == 2 -# if ZMQ_VERSION_MINOR == 0 -# error "Please upgrade to ZeroMQ/2.1 stable for these examples" -# endif -#elif ZMQ_VERSION_MAJOR == 3 -# error "Please stick with ZeroMQ/2.1 stable for these examples" -#endif -#ifndef ZMQ_ROUTER -# define ZMQ_ROUTER ZMQ_ROUTER -#endif -#ifndef ZMQ_DEALER -# define ZMQ_DEALER ZMQ_DEALER -#endif - - -// Provide random number from 0..(num-1) -#if (defined (__WINDOWS__)) -# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) -#else -# define randof(num) (int) ((float) (num) * random () / (RAND_MAX + 1.0)) -#endif - - -// Receive 0MQ string from socket and convert into C string -// Caller must free returned string. Returns NULL if the context -// is being terminated. -static char * -s_recv (void *socket) { - zmq_msg_t message; - zmq_msg_init (&message); - if (zmq_recv (socket, &message, 0)) - return (NULL); - int size = zmq_msg_size (&message); - char *string = malloc (size + 1); - memcpy (string, zmq_msg_data (&message), size); - zmq_msg_close (&message); - string [size] = 0; - return (string); -} - -// Convert C string to 0MQ string and send to socket -static int -s_send (void *socket, char *string) { - int rc; - zmq_msg_t message; - zmq_msg_init_size (&message, strlen (string)); - memcpy (zmq_msg_data (&message), string, strlen (string)); - rc = zmq_send (socket, &message, 0); - zmq_msg_close (&message); - return (rc); -} - -// Sends string as 0MQ string, as multipart non-terminal -static int -s_sendmore (void *socket, char *string) { - int rc; - zmq_msg_t message; - zmq_msg_init_size (&message, strlen (string)); - memcpy (zmq_msg_data (&message), string, strlen (string)); - rc = zmq_send (socket, &message, ZMQ_SNDMORE); - zmq_msg_close (&message); - return (rc); -} - -// Receives all message parts from socket, prints neatly -// -static void -s_dump (void *socket) -{ - puts ("----------------------------------------"); - while (1) { - // Process all parts of the message - zmq_msg_t message; - zmq_msg_init (&message); - zmq_recv (socket, &message, 0); - - // Dump the message as text or binary - char *data = zmq_msg_data (&message); - int size = zmq_msg_size (&message); - int is_text = 1; - int char_nbr; - for (char_nbr = 0; char_nbr < size; char_nbr++) - if ((unsigned char) data [char_nbr] < 32 - || (unsigned char) data [char_nbr] > 127) - is_text = 0; - - printf ("[%03d] ", size); - for (char_nbr = 0; char_nbr < size; char_nbr++) { - if (is_text) - printf ("%c", data [char_nbr]); - else - printf ("%02X", (unsigned char) data [char_nbr]); - } - printf ("\n"); - - int64_t more; // Multipart detection - size_t more_size = sizeof (more); - zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); - zmq_msg_close (&message); - if (!more) - break; // Last message part - } -} - -// Set simple random printable identity on socket -// -static void -s_set_id (void *socket) -{ - char identity [10]; - sprintf (identity, "%04X-%04X", randof (0x10000), randof (0x10000)); - zmq_setsockopt (socket, ZMQ_IDENTITY, identity, strlen (identity)); -} - - -// Sleep for a number of milliseconds -static void -s_sleep (int msecs) -{ -#if (defined (__WINDOWS__)) - Sleep (msecs); -#else - struct timespec t; - t.tv_sec = msecs / 1000; - t.tv_nsec = (msecs % 1000) * 1000000; - nanosleep (&t, NULL); -#endif -} - -// Return current system clock as milliseconds -static int64_t -s_clock (void) -{ -#if (defined (__WINDOWS__)) - SYSTEMTIME st; - GetSystemTime (&st); - return (int64_t) st.wSecond * 1000 + st.wMilliseconds; -#else - struct timeval tv; - gettimeofday (&tv, NULL); - return (int64_t) (tv.tv_sec * 1000 + tv.tv_usec / 1000); -#endif -} - -// Print formatted string to stdout, prefixed by date/time and -// terminated with a newline. - -static void -s_console (const char *format, ...) -{ - time_t curtime = time (NULL); - struct tm *loctime = localtime (&curtime); - char *formatted = malloc (20); - strftime (formatted, 20, "%y-%m-%d %H:%M:%S ", loctime); - printf ("%s", formatted); - free (formatted); - - va_list argptr; - va_start (argptr, format); - vprintf (format, argptr); - va_end (argptr); - printf ("\n"); -} - -#endif // __ZHELPERS_H_INCLUDED__ diff --git a/oldstuff/zzz/.gitignore b/oldstuff/zzz/.gitignore deleted file mode 100644 index dafab74..0000000 --- a/oldstuff/zzz/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/fizzbuzz.txt -/fizzbuzz/fizzbuzz -/best -/fizzbuzz.txt.real diff --git a/oldstuff/zzz/Makefile b/oldstuff/zzz/Makefile deleted file mode 100644 index 80bd244..0000000 --- a/oldstuff/zzz/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -all: build golden - -build: - @cd fizzbuzz && go build - -golden: build best fizzbuzz.txt fizzbuzz.txt.real - @diff -u fizzbuzz.txt fizzbuzz.txt.real - @export CUR=$$(echo "$$(wc -c fizzbuzz/main.go | awk '{ print $$1 }') - 43" | bc) ; \ - export BEST=$$(cat best) ; \ - echo $$CUR > best ; \ - echo $$CUR '<=' $$BEST ; \ - test $$CUR -le $$BEST ; \ - echo "scale=2; (200.0 - $$CUR) / 10.0" | bc - -fizzbuzz.txt.real: - ./fizzbuzz/fizzbuzz > $@ - -best: - echo 400 > $@ - -fizzbuzz.txt: - curl -O http://cdn.hackerrank.com/fizzbuzz.txt - -.PHONY: all build golden diff --git a/oldstuff/zzz/baseline.go b/oldstuff/zzz/baseline.go deleted file mode 100644 index ab6ddb6..0000000 --- a/oldstuff/zzz/baseline.go +++ /dev/null @@ -1,5 +0,0 @@ -package main -import "fmt" - -func main() { -} diff --git a/oldstuff/zzz/fizzbuzz/main.go b/oldstuff/zzz/fizzbuzz/main.go deleted file mode 100644 index ebe28f4..0000000 --- a/oldstuff/zzz/fizzbuzz/main.go +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import "fmt" - -func main() { - for i := 1; i < 101; i++ { - s := fmt.Sprintf("%d", i) - if i%3 == 0 { - s = "Fizz" - if i%5 == 0 { - s += "Buzz" - } - } else if i%5 == 0 { - s = "Buzz" - } - fmt.Println(s) - } -}