assorted-commits Mailing List for Assorted projects
Brought to you by:
yangzhang
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(9) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(86) |
Feb
(265) |
Mar
(96) |
Apr
(47) |
May
(136) |
Jun
(28) |
Jul
(57) |
Aug
(42) |
Sep
(20) |
Oct
(67) |
Nov
(37) |
Dec
(34) |
| 2009 |
Jan
(39) |
Feb
(85) |
Mar
(96) |
Apr
(24) |
May
(82) |
Jun
(13) |
Jul
(10) |
Aug
(8) |
Sep
(2) |
Oct
(20) |
Nov
(31) |
Dec
(17) |
| 2010 |
Jan
(16) |
Feb
(11) |
Mar
(17) |
Apr
(53) |
May
(31) |
Jun
(13) |
Jul
(3) |
Aug
(6) |
Sep
(11) |
Oct
(4) |
Nov
(17) |
Dec
(17) |
| 2011 |
Jan
(3) |
Feb
(19) |
Mar
(5) |
Apr
(17) |
May
(3) |
Jun
(4) |
Jul
(14) |
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
(3) |
Dec
(2) |
| 2012 |
Jan
(3) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
(4) |
Aug
(5) |
Sep
(2) |
Oct
(3) |
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
(9) |
Apr
(5) |
May
|
Jun
(2) |
Jul
(1) |
Aug
(10) |
Sep
(1) |
Oct
(2) |
Nov
|
Dec
|
| 2014 |
Jan
(1) |
Feb
(3) |
Mar
(3) |
Apr
(1) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2016 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <yan...@us...> - 2018-06-15 20:47:23
|
Revision: 1906
http://sourceforge.net/p/assorted/svn/1906
Author: yangzhang
Date: 2018-06-15 20:47:15 +0000 (Fri, 15 Jun 2018)
Log Message:
-----------
Tweak reconnect script
Modified Paths:
--------------
configs/trunk/src/cron/reconnect.bash
Modified: configs/trunk/src/cron/reconnect.bash
===================================================================
--- configs/trunk/src/cron/reconnect.bash 2017-12-06 20:26:05 UTC (rev 1905)
+++ configs/trunk/src/cron/reconnect.bash 2018-06-15 20:47:15 UTC (rev 1906)
@@ -1,5 +1,7 @@
-if ! ip addr | grep -q 'inet 192.168.168' ; then
- sudo modprobe -r rtl8187
+if ! ip addr | grep -q 'inet 10.1.10' ; then
+ # sudo modprobe -r rtl8187
+ sudo modprobe -r rt2x00lib
sleep 1
- sudo modprobe rtl8187
+ # sudo modprobe rtl8187
+ sudo modprobe rt2x00lib
fi &>> /tmp/reconnect.log
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-12-06 20:26:07
|
Revision: 1905
http://sourceforge.net/p/assorted/svn/1905
Author: yangzhang
Date: 2017-12-06 20:26:05 +0000 (Wed, 06 Dec 2017)
Log Message:
-----------
Add async demo
Added Paths:
-----------
sandbox/trunk/src/node/async/
sandbox/trunk/src/node/async/index.html
sandbox/trunk/src/node/async/index.js
sandbox/trunk/src/node/async/package.json
Added: sandbox/trunk/src/node/async/index.html
===================================================================
--- sandbox/trunk/src/node/async/index.html (rev 0)
+++ sandbox/trunk/src/node/async/index.html 2017-12-06 20:26:05 UTC (rev 1905)
@@ -0,0 +1,4 @@
+<script>
+const process = {argv: [null,null,5]};
+</script>
+<script src='index.js'></script>
Copied: sandbox/trunk/src/node/async/index.js (from rev 1904, sandbox/trunk/src/node/native-promises/index.js)
===================================================================
--- sandbox/trunk/src/node/async/index.js (rev 0)
+++ sandbox/trunk/src/node/async/index.js 2017-12-06 20:26:05 UTC (rev 1905)
@@ -0,0 +1,28 @@
+const mode = process.argv[2];
+console.log('mode', mode);
+function sleep() {
+ return new Promise(resolve => setTimeout(resolve, 1));
+}
+async function thrower() {
+ await sleep();
+ throw '!';
+}
+if (mode == 0) {
+} else if (mode == 1) {
+} else if (mode == 2) {
+} else if (mode == 3) {
+} else if (mode == 4) {
+ thrower();
+} else if (mode == 5) {
+ // Does not break!
+ (async function() {
+ await thrower();
+ })();
+} else if (mode == 6) {
+ async function wrap() {
+ //await new Promise(resolve => thrower().then(resolve));
+ await new Promise(resolve => thrower());
+ }
+ wrap();
+} else if (mode == 7) {
+}
Added: sandbox/trunk/src/node/async/package.json
===================================================================
--- sandbox/trunk/src/node/async/package.json (rev 0)
+++ sandbox/trunk/src/node/async/package.json 2017-12-06 20:26:05 UTC (rev 1905)
@@ -0,0 +1,6 @@
+{
+ "name": "async",
+ "version": "1.0.0",
+ "main": "index.js",
+ "license": "MIT"
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-12-06 05:22:02
|
Revision: 1904
http://sourceforge.net/p/assorted/svn/1904
Author: yangzhang
Date: 2017-12-06 05:22:01 +0000 (Wed, 06 Dec 2017)
Log Message:
-----------
Add native-promises demo
Added Paths:
-----------
sandbox/trunk/src/node/native-promises/
sandbox/trunk/src/node/native-promises/README
sandbox/trunk/src/node/native-promises/go.bash
sandbox/trunk/src/node/native-promises/index.js
sandbox/trunk/src/node/native-promises/package.json
Added: sandbox/trunk/src/node/native-promises/README
===================================================================
--- sandbox/trunk/src/node/native-promises/README (rev 0)
+++ sandbox/trunk/src/node/native-promises/README 2017-12-06 05:22:01 UTC (rev 1904)
@@ -0,0 +1,35 @@
+mode 0
+(node:16987) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): !
+(node:16987) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+====================
+mode 1
+got error !
+====================
+mode 2
+(node:16989) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): !
+(node:16989) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+====================
+mode 3
+got error !
+====================
+mode 4
+
+/Users/yang/proj/assorted-svn/sandbox/trunk/src/node/native-promises/index.js:12
+ new Promise(resolve => setTimeout(() => {throw '!'}, 1));
+ ^
+!
+====================
+mode 5
+
+/Users/yang/proj/assorted-svn/sandbox/trunk/src/node/native-promises/index.js:14
+ new Promise(resolve => setTimeout(() => {throw '!'}, 1)).catch(err => console.log('got error', err));
+ ^
+!
+====================
+mode 6
+(node:16994) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): undefined
+(node:16994) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+====================
+mode 7
+got error undefined
+====================
Added: sandbox/trunk/src/node/native-promises/go.bash
===================================================================
--- sandbox/trunk/src/node/native-promises/go.bash (rev 0)
+++ sandbox/trunk/src/node/native-promises/go.bash 2017-12-06 05:22:01 UTC (rev 1904)
@@ -0,0 +1 @@
+for i in {0..7}; do node index.js $i ; echo ====================; done &> README
Added: sandbox/trunk/src/node/native-promises/index.js
===================================================================
--- sandbox/trunk/src/node/native-promises/index.js (rev 0)
+++ sandbox/trunk/src/node/native-promises/index.js 2017-12-06 05:22:01 UTC (rev 1904)
@@ -0,0 +1,20 @@
+const mode = process.argv[2];
+console.log('mode', mode);
+if (mode == 0) {
+ new Promise(resolve => {throw '!'});
+} else if (mode == 1) {
+ new Promise(resolve => {throw '!'}).catch(err => console.log('got error', err));
+} else if (mode == 2) {
+ new Promise(resolve => resolve()).then(() => {throw '!'});
+} else if (mode == 3) {
+ // Only one that devtools doesn't break on!
+ new Promise(resolve => resolve()).then(() => {throw '!'}).catch(err => console.log('got error', err));
+} else if (mode == 4) {
+ new Promise(resolve => setTimeout(() => {throw '!'}, 1));
+} else if (mode == 5) {
+ new Promise(resolve => setTimeout(() => {throw '!'}, 1)).catch(err => console.log('got error', err));
+} else if (mode == 6) {
+ new Promise((resolve, reject) => reject());
+} else if (mode == 7) {
+ new Promise((resolve, reject) => reject()).catch(err => console.log('got error', err));
+}
Added: sandbox/trunk/src/node/native-promises/package.json
===================================================================
--- sandbox/trunk/src/node/native-promises/package.json (rev 0)
+++ sandbox/trunk/src/node/native-promises/package.json 2017-12-06 05:22:01 UTC (rev 1904)
@@ -0,0 +1,6 @@
+{
+ "name": "native-promises",
+ "version": "1.0.0",
+ "main": "index.js",
+ "license": "MIT"
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-06-28 00:18:40
|
Revision: 1903
http://sourceforge.net/p/assorted/svn/1903
Author: yangzhang
Date: 2017-06-28 00:18:39 +0000 (Wed, 28 Jun 2017)
Log Message:
-----------
Do not bitrot partycat over LAN (very slow)
Modified Paths:
--------------
configs/trunk/src/cron/bitrot.bash
Modified: configs/trunk/src/cron/bitrot.bash
===================================================================
--- configs/trunk/src/cron/bitrot.bash 2017-05-12 22:00:12 UTC (rev 1902)
+++ configs/trunk/src/cron/bitrot.bash 2017-06-28 00:18:39 UTC (rev 1903)
@@ -2,7 +2,7 @@
workon bitrot
-for dir in /media/yang/ /media/mybook/ /mnt/store/yang/ /mnt/partycat/media/store/ ; do
+for dir in /media/yang/ /media/mybook/ /mnt/store/yang/ ; do
( cd "$dir"; echo "$dir" >> /tmp/bitrot.log; nice -n19 ionice -c3 bitrot --quiet; )
done
wait
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-05-12 22:00:14
|
Revision: 1902
http://sourceforge.net/p/assorted/svn/1902
Author: yangzhang
Date: 2017-05-12 22:00:12 +0000 (Fri, 12 May 2017)
Log Message:
-----------
Add pandas vs pydataframe benchmark
Added Paths:
-----------
sandbox/trunk/src/py/pandasvsdataframe.py
Added: sandbox/trunk/src/py/pandasvsdataframe.py
===================================================================
--- sandbox/trunk/src/py/pandasvsdataframe.py (rev 0)
+++ sandbox/trunk/src/py/pandasvsdataframe.py 2017-05-12 22:00:12 UTC (rev 1902)
@@ -0,0 +1,38 @@
+import numpy as np
+import pandas
+import pydataframe as pdf
+import random
+import timeit
+
+r = random.Random()
+r.seed(0)
+
+words=set(open('/usr/share/dict/words').read().split('\n')[:-1])
+xs = r.sample(words,10)
+vals = np.array([r.choice(xs) for i in xrange(100000)])
+
+cat = pandas.Categorical(vals)
+df = pandas.DataFrame(dict(name=cat),index=range(len(cat)))
+df['name2'] = cat.labels
+
+fac = pdf.Factor(vals)
+DF = pdf.DataFrame({'name':fac})
+
+print timeit.repeat(lambda: pandas.Categorical(vals), number=100)
+print timeit.repeat(lambda: pdf.Factor(vals), number=100)
+# [1.7276630401611328, 1.7099509239196777, 1.699409008026123]
+# [5.793086051940918, 5.864365100860596, 5.855109930038452]
+
+print timeit.repeat(lambda: (vals == 'Kane').sum(), number=100)
+print timeit.repeat(lambda: (cat == 'Kane').sum(), number=100)
+print timeit.repeat(lambda: (fac == 'Kane').sum(), number=100)
+# [0.17582988739013672, 0.1752328872680664, 0.1806349754333496]
+# [0.0377810001373291, 0.038002967834472656, 0.03856086730957031]
+# [0.038198232650756836, 0.0375368595123291, 0.03746795654296875]
+
+print timeit.repeat(lambda: (df['name'] == 'Kane').sum(), number=100)
+print timeit.repeat(lambda: (df['name2'] == 1).sum(), number=100)
+print timeit.repeat(lambda: (DF.get_column('name') == 'Kane').sum(), number=100)
+# [1.3420658111572266, 1.3421308994293213, 1.3467140197753906]
+# [0.22314882278442383, 0.22048115730285645, 0.22372817993164062]
+# [0.03833794593811035, 0.03797793388366699, 0.03791189193725586]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-05-12 21:58:43
|
Revision: 1901
http://sourceforge.net/p/assorted/svn/1901
Author: yangzhang
Date: 2017-05-12 21:58:42 +0000 (Fri, 12 May 2017)
Log Message:
-----------
Add timing sandbox test
Added Paths:
-----------
sandbox/trunk/src/cc/timing.cc
Added: sandbox/trunk/src/cc/timing.cc
===================================================================
--- sandbox/trunk/src/cc/timing.cc (rev 0)
+++ sandbox/trunk/src/cc/timing.cc 2017-05-12 21:58:42 UTC (rev 1901)
@@ -0,0 +1,25 @@
+#include <ctime>
+#include <iostream>
+#include <sys/time.h>
+#include <sys/timeb.h>
+using namespace std;
+unsigned long usec() {
+ timeval t;
+ gettimeofday(&t, 0);
+ return 1000000 * t.tv_sec + t.tv_usec;
+}
+int main() {
+ struct timeb start, end;
+ ftime(&start);
+ cout << time(0) << endl;
+ cout << clock() << endl;
+ cout << usec() << endl;
+ usleep(5000);
+ ftime(&end);
+ int diff = (int) (1000.0 * (end.time - start.time) + (end.millitm - start.millitm));
+ cout << time(0) << endl;
+ cout << clock() << endl;
+ cout << usec() << endl;
+ cout << diff << endl;
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-05-12 21:57:52
|
Revision: 1900
http://sourceforge.net/p/assorted/svn/1900
Author: yangzhang
Date: 2017-05-12 21:57:50 +0000 (Fri, 12 May 2017)
Log Message:
-----------
Add ssl sandbox test
Added Paths:
-----------
sandbox/trunk/src/c/ssl.c
Added: sandbox/trunk/src/c/ssl.c
===================================================================
--- sandbox/trunk/src/c/ssl.c (rev 0)
+++ sandbox/trunk/src/c/ssl.c 2017-05-12 21:57:50 UTC (rev 1900)
@@ -0,0 +1,176 @@
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <openssl/rand.h>
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+
+// Simple structure to keep track of the handle, and
+// of what needs to be freed later.
+typedef struct {
+ int socket;
+ SSL *sslHandle;
+ SSL_CTX *sslContext;
+} connection;
+
+// For this example, we'll be testing on openssl.org
+#define SERVER "www.slice-data.com"
+#define PORT 443
+
+// Establish a regular tcp connection
+int tcpConnect ()
+{
+ int error, handle;
+ struct hostent *host;
+ struct sockaddr_in server;
+
+ host = gethostbyname (SERVER);
+ handle = socket (AF_INET, SOCK_STREAM, 0);
+ if (handle == -1)
+ {
+ perror ("Socket");
+ handle = 0;
+ }
+ else
+ {
+ server.sin_family = AF_INET;
+ server.sin_port = htons (PORT);
+ server.sin_addr = *((struct in_addr *) host->h_addr);
+ bzero (&(server.sin_zero), 8);
+
+ error = connect (handle, (struct sockaddr *) &server,
+ sizeof (struct sockaddr));
+ if (error == -1)
+ {
+ perror ("Connect");
+ handle = 0;
+ }
+ }
+
+ return handle;
+}
+
+// Establish a connection using an SSL layer
+connection *sslConnect (void)
+{
+ connection *c;
+
+ c = malloc (sizeof (connection));
+ c->sslHandle = NULL;
+ c->sslContext = NULL;
+
+ c->socket = tcpConnect ();
+ if (c->socket)
+ {
+ // Register the error strings for libcrypto & libssl
+ SSL_load_error_strings ();
+ // Register the available ciphers and digests
+ SSL_library_init ();
+
+ // New context saying we are a client, and using SSL 2 or 3
+ c->sslContext = SSL_CTX_new (SSLv23_client_method ());
+ if (c->sslContext == NULL)
+ ERR_print_errors_fp (stderr);
+
+ // Create an SSL struct for the connection
+ c->sslHandle = SSL_new (c->sslContext);
+ if (c->sslHandle == NULL)
+ ERR_print_errors_fp (stderr);
+
+ // Connect the SSL struct to our connection
+ if (!SSL_set_fd (c->sslHandle, c->socket))
+ ERR_print_errors_fp (stderr);
+
+ // Initiate SSL handshake
+ if (SSL_connect (c->sslHandle) != 1)
+ ERR_print_errors_fp (stderr);
+ }
+ else
+ {
+ perror ("Connect failed");
+ }
+
+ return c;
+}
+
+// Disconnect & free connection struct
+void sslDisconnect (connection *c)
+{
+ if (c->socket)
+ close (c->socket);
+ if (c->sslHandle)
+ {
+ SSL_shutdown (c->sslHandle);
+ SSL_free (c->sslHandle);
+ }
+ if (c->sslContext)
+ SSL_CTX_free (c->sslContext);
+
+ free (c);
+}
+
+// Read all available text from the connection
+char *sslRead (connection *c)
+{
+ const int readSize = 1024;
+ char *rc = NULL;
+ int received, count = 0;
+ char buffer[1024];
+
+ if (c)
+ {
+ while (1)
+ {
+ if (!rc)
+ rc = malloc (readSize * sizeof (char) + 1);
+ else
+ rc = realloc (rc, (count + 1) *
+ readSize * sizeof (char) + 1);
+
+ received = SSL_read (c->sslHandle, buffer, readSize);
+ buffer[received] = '\0';
+
+ if (received > 0)
+ strcat (rc, buffer);
+
+ if (received < readSize)
+ break;
+ count++;
+ }
+ }
+
+ return rc;
+}
+
+// Write text to the connection
+void sslWrite (connection *c, char *text)
+{
+ if (c)
+ SSL_write (c->sslHandle, text, strlen (text));
+}
+
+// Very basic main: we send GET / and print the response.
+int main (int argc, char **argv)
+{
+ connection *c;
+ char *response;
+
+ c = sslConnect ();
+
+ sslWrite (c, "GET /\r\n\r\n");
+ response = sslRead (c);
+
+ printf ("%s\n", response);
+
+ sslDisconnect (c);
+ free (response);
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-05-12 21:57:03
|
Revision: 1899
http://sourceforge.net/p/assorted/svn/1899
Author: yangzhang
Date: 2017-05-12 21:57:02 +0000 (Fri, 12 May 2017)
Log Message:
-----------
Add reconnect.bash
Added Paths:
-----------
configs/trunk/src/cron/reconnect.bash
Added: configs/trunk/src/cron/reconnect.bash
===================================================================
--- configs/trunk/src/cron/reconnect.bash (rev 0)
+++ configs/trunk/src/cron/reconnect.bash 2017-05-12 21:57:02 UTC (rev 1899)
@@ -0,0 +1,5 @@
+if ! ip addr | grep -q 'inet 192.168.168' ; then
+ sudo modprobe -r rtl8187
+ sleep 1
+ sudo modprobe rtl8187
+fi &>> /tmp/reconnect.log
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-05-12 21:56:45
|
Revision: 1898
http://sourceforge.net/p/assorted/svn/1898
Author: yangzhang
Date: 2017-05-12 21:56:43 +0000 (Fri, 12 May 2017)
Log Message:
-----------
Tweak bitrot.bash
Modified Paths:
--------------
configs/trunk/src/cron/bitrot.bash
Modified: configs/trunk/src/cron/bitrot.bash
===================================================================
--- configs/trunk/src/cron/bitrot.bash 2017-03-14 18:43:36 UTC (rev 1897)
+++ configs/trunk/src/cron/bitrot.bash 2017-05-12 21:56:43 UTC (rev 1898)
@@ -3,6 +3,6 @@
workon bitrot
for dir in /media/yang/ /media/mybook/ /mnt/store/yang/ /mnt/partycat/media/store/ ; do
- ( cd "$dir"; nice -n19 ionice -c3 bitrot --quiet; )
+ ( cd "$dir"; echo "$dir" >> /tmp/bitrot.log; nice -n19 ionice -c3 bitrot --quiet; )
done
wait
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2017-03-14 18:43:39
|
Revision: 1897
http://sourceforge.net/p/assorted/svn/1897
Author: yangzhang
Date: 2017-03-14 18:43:36 +0000 (Tue, 14 Mar 2017)
Log Message:
-----------
Update disks scanned
Modified Paths:
--------------
configs/trunk/src/cron/bitrot.bash
Modified: configs/trunk/src/cron/bitrot.bash
===================================================================
--- configs/trunk/src/cron/bitrot.bash 2017-02-22 07:33:14 UTC (rev 1896)
+++ configs/trunk/src/cron/bitrot.bash 2017-03-14 18:43:36 UTC (rev 1897)
@@ -2,8 +2,7 @@
workon bitrot
-for dir in /media/yang/ /media/mybook/ /mnt/store/yang/ ; do
-#for dir in /mnt/store/yang/ ; do
+for dir in /media/yang/ /media/mybook/ /mnt/store/yang/ /mnt/partycat/media/store/ ; do
( cd "$dir"; nice -n19 ionice -c3 bitrot --quiet; )
done
wait
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2016-09-09 22:33:23
|
Revision: 1892
http://sourceforge.net/p/assorted/svn/1892
Author: yangzhang
Date: 2016-09-09 22:33:22 +0000 (Fri, 09 Sep 2016)
Log Message:
-----------
Add gmailbot feedback-pings cron job
Added Paths:
-----------
configs/trunk/src/cron/gmailbot-feedback-pings.bash
Added: configs/trunk/src/cron/gmailbot-feedback-pings.bash
===================================================================
--- configs/trunk/src/cron/gmailbot-feedback-pings.bash (rev 0)
+++ configs/trunk/src/cron/gmailbot-feedback-pings.bash 2016-09-09 22:33:22 UTC (rev 1892)
@@ -0,0 +1,5 @@
+# 09 4 * * Fri bash -l /home/yang/.cron/gmailbot-feedback-pings.bash
+
+workon gmailbot
+cd ~/gmailbot/
+python gmailbot/__init__.py ya...@in... feedback-pings jm,paul,nicole,ashley,amcintyre,travism,megi,tarpey,tomoko,zeshan,nate,jimmy,junejune,john,chad,walsh,nikhil
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2016-03-07 02:08:26
|
Revision: 1891
http://sourceforge.net/p/assorted/svn/1891
Author: yangzhang
Date: 2016-03-07 02:08:23 +0000 (Mon, 07 Mar 2016)
Log Message:
-----------
Add jsdom demo
Added Paths:
-----------
sandbox/trunk/src/node/jsdom/
sandbox/trunk/src/node/jsdom/index.html
sandbox/trunk/src/node/jsdom/package.json
sandbox/trunk/src/node/jsdom/tests.js
Added: sandbox/trunk/src/node/jsdom/index.html
===================================================================
--- sandbox/trunk/src/node/jsdom/index.html (rev 0)
+++ sandbox/trunk/src/node/jsdom/index.html 2016-03-07 02:08:23 UTC (rev 1891)
@@ -0,0 +1,6 @@
+<html>
+ <body>
+ <p><a class="the-link" href="https://github.com/tmpvar/jsdom">jsdom!</a></p>
+ <script charset='utf-8' src="build.js"></script>
+ </body>
+</html>
Added: sandbox/trunk/src/node/jsdom/package.json
===================================================================
--- sandbox/trunk/src/node/jsdom/package.json (rev 0)
+++ sandbox/trunk/src/node/jsdom/package.json 2016-03-07 02:08:23 UTC (rev 1891)
@@ -0,0 +1,17 @@
+{
+ "name": "jsdom-test",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "node tests.js",
+ "build": "browserify -o build.js tests.js"
+ },
+ "author": "",
+ "license": "ISC",
+ "devDependencies": {
+ "browserify": "^13.0.0",
+ "jquery": "^2.2.1",
+ "jsdom": "^8.1.0"
+ }
+}
Added: sandbox/trunk/src/node/jsdom/tests.js
===================================================================
--- sandbox/trunk/src/node/jsdom/tests.js (rev 0)
+++ sandbox/trunk/src/node/jsdom/tests.js 2016-03-07 02:08:23 UTC (rev 1891)
@@ -0,0 +1,12 @@
+jsdom = require('jsdom');
+jsdom.env(
+ '<p><a class="the-link" href="https://github.com/tmpvar/jsdom">jsdom!</a></p>',
+ [],
+ (err, window) => {
+ global.window = window;
+ global.document = window.document;
+ global.navigator = window.navigator;
+ $ = require('jquery');
+ console.log("contents of a.the-link:", $("a.the-link").text());
+ }
+);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2016-03-07 01:10:09
|
Revision: 1890
http://sourceforge.net/p/assorted/svn/1890
Author: yangzhang
Date: 2016-03-07 01:10:08 +0000 (Mon, 07 Mar 2016)
Log Message:
-----------
Add jest demo
Added Paths:
-----------
sandbox/trunk/src/node/jest/
sandbox/trunk/src/node/jest/__tests__/
sandbox/trunk/src/node/jest/__tests__/displayUser-test.js
sandbox/trunk/src/node/jest/__tests__/fetchCurrentUser-test.js
sandbox/trunk/src/node/jest/__tests__/sum-test.js
sandbox/trunk/src/node/jest/displayUser.js
sandbox/trunk/src/node/jest/fetchCurrentUser.js
sandbox/trunk/src/node/jest/package.json
sandbox/trunk/src/node/jest/sum.js
Added: sandbox/trunk/src/node/jest/__tests__/displayUser-test.js
===================================================================
--- sandbox/trunk/src/node/jest/__tests__/displayUser-test.js (rev 0)
+++ sandbox/trunk/src/node/jest/__tests__/displayUser-test.js 2016-03-07 01:10:08 UTC (rev 1890)
@@ -0,0 +1,41 @@
+// __tests__/displayUser-test.js
+'use strict';
+
+jest
+ .unmock('../displayUser.js')
+ .unmock('jquery');
+
+describe('displayUser', () => {
+ it('displays a user after a click', () => {
+ // Set up our document body
+ document.body.innerHTML =
+ '<div>' +
+ ' <span id="username" />' +
+ ' <button id="button" />' +
+ '</div>';
+
+ // This module has a side-effect
+ require('../displayUser');
+
+ const $ = require('jquery');
+ const fetchCurrentUser = require('../fetchCurrentUser');
+
+ // Tell the fetchCurrentUser mock function to automatically invoke
+ // its callback with some data
+ fetchCurrentUser.mockImplementation((cb) => {
+ cb({
+ loggedIn: true,
+ fullName: 'Johnny Cash',
+ });
+ });
+
+ // Use jquery to emulate a click on our button
+ $('#button').click();
+
+ // Assert that the fetchCurrentUser function was called, and that the
+ // #username span's innter text was updated as we'd it expect.
+ expect(fetchCurrentUser).toBeCalled();
+ expect($('#username').text()).toEqual('Johnny Cash - Logged In');
+ });
+});
+
Added: sandbox/trunk/src/node/jest/__tests__/fetchCurrentUser-test.js
===================================================================
--- sandbox/trunk/src/node/jest/__tests__/fetchCurrentUser-test.js (rev 0)
+++ sandbox/trunk/src/node/jest/__tests__/fetchCurrentUser-test.js 2016-03-07 01:10:08 UTC (rev 1890)
@@ -0,0 +1,46 @@
+// __tests__/fetchCurrentUser-test.js
+'use strict';
+
+jest.unmock('../fetchCurrentUser.js');
+
+describe('fetchCurrentUser', () => {
+ it('calls into $.ajax with the correct params', () => {
+ const $ = require('jquery');
+ const fetchCurrentUser = require('../fetchCurrentUser');
+
+ // Call into the function we want to test
+ const dummyCallback = () => {};
+ fetchCurrentUser(dummyCallback);
+
+ // Now make sure that $.ajax was properly called during the previous
+ // 2 lines
+ expect($.ajax).toBeCalledWith({
+ type: 'GET',
+ url: 'http://example.com/currentUser',
+ success: jasmine.any(Function),
+ });
+ });
+
+ it('calls the callback when $.ajax requests are finished', () => {
+ const $ = require('jquery');
+ const fetchCurrentUser = require('../fetchCurrentUser');
+
+ // Create a mock function for our callback
+ const callback = jest.fn();
+ fetchCurrentUser(callback);
+
+ // Now we emulate the process by which `$.ajax` would execute its own
+ // callback
+ $.ajax.mock.calls[0/*first call*/][0/*first argument*/].success({
+ firstName: 'Bobby',
+ lastName: '");DROP TABLE Users;--',
+ });
+
+ // And finally we assert that this emulated call by `$.ajax` incurred a
+ // call back into the mock function we provided as a callback
+ expect(callback.mock.calls[0/*first call*/][0/*first arg*/]).toEqual({
+ loggedIn: true,
+ fullName: 'Bobby ");DROP TABLE Users;--',
+ });
+ });
+});
Added: sandbox/trunk/src/node/jest/__tests__/sum-test.js
===================================================================
--- sandbox/trunk/src/node/jest/__tests__/sum-test.js (rev 0)
+++ sandbox/trunk/src/node/jest/__tests__/sum-test.js 2016-03-07 01:10:08 UTC (rev 1890)
@@ -0,0 +1,9 @@
+jest.unmock('../sum'); // unmock to use the actual implementation of sum
+
+describe('sum', () => {
+ it('adds 1 + 2 to equal 3', () => {
+ const sum = require('../sum');
+ expect(sum(1, 2)).toBe(3);
+ });
+});
+
Added: sandbox/trunk/src/node/jest/displayUser.js
===================================================================
--- sandbox/trunk/src/node/jest/displayUser.js (rev 0)
+++ sandbox/trunk/src/node/jest/displayUser.js 2016-03-07 01:10:08 UTC (rev 1890)
@@ -0,0 +1,13 @@
+// displayUser.js
+'use strict';
+
+const $ = require('jquery');
+const fetchCurrentUser = require('./fetchCurrentUser.js');
+
+$('#button').click(() => {
+ fetchCurrentUser(user => {
+ const loggedText = 'Logged ' + (user.loggedIn ? 'In' : 'Out');
+ $('#username').text(user.fullName + ' - ' + loggedText);
+ });
+});
+
Added: sandbox/trunk/src/node/jest/fetchCurrentUser.js
===================================================================
--- sandbox/trunk/src/node/jest/fetchCurrentUser.js (rev 0)
+++ sandbox/trunk/src/node/jest/fetchCurrentUser.js 2016-03-07 01:10:08 UTC (rev 1890)
@@ -0,0 +1,21 @@
+// fetchCurrentUser.js
+'use strict';
+
+const $ = require('jquery');
+
+function parseJSON(user) {
+ return {
+ loggedIn: true,
+ fullName: user.firstName + ' ' + user.lastName,
+ };
+}
+
+function fetchCurrentUser(callback) {
+ return $.ajax({
+ type: 'GET',
+ url: 'http://example.com/currentUser',
+ success: user => callback(parseJSON(user)),
+ });
+}
+
+module.exports = fetchCurrentUser;
Added: sandbox/trunk/src/node/jest/package.json
===================================================================
--- sandbox/trunk/src/node/jest/package.json (rev 0)
+++ sandbox/trunk/src/node/jest/package.json 2016-03-07 01:10:08 UTC (rev 1890)
@@ -0,0 +1,16 @@
+{
+ "name": "jest-test",
+ "version": "1.0.0",
+ "description": "",
+ "main": "sum.js",
+ "dependencies": {
+ "jest-cli": "^0.9.0",
+ "jquery": "^2.2.1"
+ },
+ "devDependencies": {},
+ "scripts": {
+ "test": "jest"
+ },
+ "author": "",
+ "license": "ISC"
+}
Added: sandbox/trunk/src/node/jest/sum.js
===================================================================
--- sandbox/trunk/src/node/jest/sum.js (rev 0)
+++ sandbox/trunk/src/node/jest/sum.js 2016-03-07 01:10:08 UTC (rev 1890)
@@ -0,0 +1,4 @@
+function sum(a, b) {
+ return a + b;
+}
+module.exports = sum;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2016-01-06 01:06:59
|
Revision: 1889
http://sourceforge.net/p/assorted/svn/1889
Author: yangzhang
Date: 2016-01-06 01:06:58 +0000 (Wed, 06 Jan 2016)
Log Message:
-----------
Make rtun fail fast on tunnel failure
Modified Paths:
--------------
configs/trunk/src/upstart/rtun.conf
Modified: configs/trunk/src/upstart/rtun.conf
===================================================================
--- configs/trunk/src/upstart/rtun.conf 2015-10-26 00:33:44 UTC (rev 1888)
+++ configs/trunk/src/upstart/rtun.conf 2016-01-06 01:06:58 UTC (rev 1889)
@@ -28,6 +28,6 @@
sleep 1 ;
ssh -N -S none -R1122:localhost:22 -i /home/yang/.ssh/rtun
-o BatchMode=yes -o ServerAliveInterval=300 -o TCPKeepAlive=yes
- rtun@HOST ;
+ -o ExitOnForwardFailure=yes rtun@HOST ;
sleep 5 ;
done &>> /tmp/rtun.log'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2015-10-26 00:33:46
|
Revision: 1888
http://sourceforge.net/p/assorted/svn/1888
Author: yangzhang
Date: 2015-10-26 00:33:44 +0000 (Mon, 26 Oct 2015)
Log Message:
-----------
Run bitrot nicely
Modified Paths:
--------------
configs/trunk/src/cron/bitrot.bash
Modified: configs/trunk/src/cron/bitrot.bash
===================================================================
--- configs/trunk/src/cron/bitrot.bash 2014-09-10 07:00:21 UTC (rev 1887)
+++ configs/trunk/src/cron/bitrot.bash 2015-10-26 00:33:44 UTC (rev 1888)
@@ -2,7 +2,7 @@
workon bitrot
-for dir in /media/yang/ /mnt/store/yang/ ; do
- ( cd "$dir"; bitrot; ) &
+for dir in /media/yang/ /media/mybook/ /mnt/store/yang/ ; do
+ ( cd "$dir"; nice -n19 ionice -c3 bitrot; ) &
done
wait
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-09-10 07:00:26
|
Revision: 1887
http://sourceforge.net/p/assorted/svn/1887
Author: yangzhang
Date: 2014-09-10 07:00:21 +0000 (Wed, 10 Sep 2014)
Log Message:
-----------
Tweak promises node demo
Modified Paths:
--------------
sandbox/trunk/src/node/promises/index.coffee
Modified: sandbox/trunk/src/node/promises/index.coffee
===================================================================
--- sandbox/trunk/src/node/promises/index.coffee 2014-09-10 06:56:51 UTC (rev 1886)
+++ sandbox/trunk/src/node/promises/index.coffee 2014-09-10 07:00:21 UTC (rev 1887)
@@ -5,3 +5,8 @@
console.log(1)
# 1 gets printed before 0; 0 is processed nextTick rather than
# immediately/recursively
+setTimeout(
+ -> d.promise.done (x) -> console.log(x+2)
+ 10
+)
+# 2 also gets fired, even though we've previously already fired
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-09-10 06:56:55
|
Revision: 1886
http://sourceforge.net/p/assorted/svn/1886
Author: yangzhang
Date: 2014-09-10 06:56:51 +0000 (Wed, 10 Sep 2014)
Log Message:
-----------
Add promises node demo
Added Paths:
-----------
sandbox/trunk/src/node/promises/
sandbox/trunk/src/node/promises/index.coffee
sandbox/trunk/src/node/promises/package.json
Added: sandbox/trunk/src/node/promises/index.coffee
===================================================================
--- sandbox/trunk/src/node/promises/index.coffee (rev 0)
+++ sandbox/trunk/src/node/promises/index.coffee 2014-09-10 06:56:51 UTC (rev 1886)
@@ -0,0 +1,7 @@
+Q = require 'q'
+d = Q.defer()
+d.resolve(0)
+d.promise.done (x) -> console.log(x)
+console.log(1)
+# 1 gets printed before 0; 0 is processed nextTick rather than
+# immediately/recursively
Added: sandbox/trunk/src/node/promises/package.json
===================================================================
--- sandbox/trunk/src/node/promises/package.json (rev 0)
+++ sandbox/trunk/src/node/promises/package.json 2014-09-10 06:56:51 UTC (rev 1886)
@@ -0,0 +1,14 @@
+{
+ "name": "promises",
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.coffee",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "dependencies": {
+ "coffee-script": "^1.8.0",
+ "q": "^1.0.1"
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-05-27 04:49:45
|
Revision: 1885
http://sourceforge.net/p/assorted/svn/1885
Author: yangzhang
Date: 2014-05-27 04:49:41 +0000 (Tue, 27 May 2014)
Log Message:
-----------
Add dragdrop demo
Added Paths:
-----------
sandbox/trunk/src/web/dragdrop/
sandbox/trunk/src/web/dragdrop/Makefile
sandbox/trunk/src/web/dragdrop/README
sandbox/trunk/src/web/dragdrop/bower.json
sandbox/trunk/src/web/dragdrop/index.jade
sandbox/trunk/src/web/dragdrop/package.json
Added: sandbox/trunk/src/web/dragdrop/Makefile
===================================================================
--- sandbox/trunk/src/web/dragdrop/Makefile (rev 0)
+++ sandbox/trunk/src/web/dragdrop/Makefile 2014-05-27 04:49:41 UTC (rev 1885)
@@ -0,0 +1,3 @@
+all: index.html
+%.html: %.jade
+ ./node_modules/.bin/jade $<
Added: sandbox/trunk/src/web/dragdrop/README
===================================================================
--- sandbox/trunk/src/web/dragdrop/README (rev 0)
+++ sandbox/trunk/src/web/dragdrop/README 2014-05-27 04:49:41 UTC (rev 1885)
@@ -0,0 +1,10 @@
+Findings:
+
+- for the event target itself, capture listeners are treated the same as bubble
+ listeners, executed in an arbitrary order
+ <https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener>
+- focus, blur not bubbled, but capture-able
+ <http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html>
+- key*, change, focusin, focusout bubble
+- react doesn't have focusin/focusout since its own focus/blur already support
+ bubbling <https://news.ycombinator.com/item?id=6995335>
Added: sandbox/trunk/src/web/dragdrop/bower.json
===================================================================
--- sandbox/trunk/src/web/dragdrop/bower.json (rev 0)
+++ sandbox/trunk/src/web/dragdrop/bower.json 2014-05-27 04:49:41 UTC (rev 1885)
@@ -0,0 +1,19 @@
+{
+ "name": "dragdrop",
+ "version": "0.0.0",
+ "authors": [
+ "Yang Zhang <ya...@gm...>"
+ ],
+ "license": "MIT",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ],
+ "dependencies": {
+ "jquery.event.drag-drop": "~2.2.1",
+ "jquery": "1.8.3"
+ }
+}
Added: sandbox/trunk/src/web/dragdrop/index.jade
===================================================================
--- sandbox/trunk/src/web/dragdrop/index.jade (rev 0)
+++ sandbox/trunk/src/web/dragdrop/index.jade 2014-05-27 04:49:41 UTC (rev 1885)
@@ -0,0 +1,19 @@
+doctype html
+html
+ head
+ title Events demo
+ body
+ .main
+ .draggable Drag me
+ script(src="bower_components/jquery/jquery.js")
+ script(src="bower_components/jquery.event.drag-drop/event.drag/jquery.event.drag.js")
+ script(src="bower_components/jquery.event.drag-drop/event.drag/jquery.event.drag.live.js")
+ script
+ :coffee-script
+ $('.draggable').on 'dragstart', -> console.log 'dragstart'
+ $('.draggable').on 'drag', -> console.log 'drag'
+ $('.draggable').on 'dragend', -> console.log 'dragend'
+ $('.draggable').on 'mousedown', -> console.log '.draggable mousedown'
+ # Note that the mousedown event does not bubble up!
+ $('body').on 'mousedown', -> console.log 'body mousedown'
+ $(document).on 'mousedown', -> console.log 'document mousedown'
Added: sandbox/trunk/src/web/dragdrop/package.json
===================================================================
--- sandbox/trunk/src/web/dragdrop/package.json (rev 0)
+++ sandbox/trunk/src/web/dragdrop/package.json 2014-05-27 04:49:41 UTC (rev 1885)
@@ -0,0 +1,15 @@
+{
+ "name": "events",
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "coffee-script": "^1.7.1",
+ "jade": "^1.3.1"
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-05-25 08:09:04
|
Revision: 1884
http://sourceforge.net/p/assorted/svn/1884
Author: yangzhang
Date: 2014-05-25 08:09:00 +0000 (Sun, 25 May 2014)
Log Message:
-----------
Add React events experiments
Modified Paths:
--------------
sandbox/trunk/src/web/react/index.coffee
Modified: sandbox/trunk/src/web/react/index.coffee
===================================================================
--- sandbox/trunk/src/web/react/index.coffee 2014-05-25 07:43:59 UTC (rev 1883)
+++ sandbox/trunk/src/web/react/index.coffee 2014-05-25 08:09:00 UTC (rev 1884)
@@ -76,11 +76,28 @@
######
+PassThrough = React.createClass(
+ render: -> @props.children
+)
+
+# Notes:
+# - passthrough doesn't get this event, as expected
+# - react does bubble onFocus
+EventExperiments = React.createClass(
+ render: ->
+ R.div {onFocus: => console.log 'div'},
+ PassThrough {onFocus: => console.log 'passthrough'},
+ R.input {type: 'text', onFocus: => console.log 'text'}
+)
+
+######
+
Main = React.createClass(
render: ->
R.div {},
TextExperiments {}
RefExperiments {}
+ EventExperiments {}
)
$ ->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-05-25 07:44:03
|
Revision: 1883
http://sourceforge.net/p/assorted/svn/1883
Author: yangzhang
Date: 2014-05-25 07:43:59 +0000 (Sun, 25 May 2014)
Log Message:
-----------
Add React experiments with refs
Modified Paths:
--------------
sandbox/trunk/src/web/react/index.coffee
Modified: sandbox/trunk/src/web/react/index.coffee
===================================================================
--- sandbox/trunk/src/web/react/index.coffee 2014-05-24 18:58:59 UTC (rev 1882)
+++ sandbox/trunk/src/web/react/index.coffee 2014-05-25 07:43:59 UTC (rev 1883)
@@ -33,9 +33,14 @@
R.input {type: 'text', value: @state.msg2, onChange: @handleChange2}
)
-Main = React.createClass(
+TextExperiments = React.createClass(
getInitialState: ->
counter: 0
+ componentDidMount: ->
+ setInterval(
+ => @setState(counter: @state.counter + 1)
+ 1000
+ )
render: ->
R.div {},
PropsVsState {initCount: @state.counter}
@@ -43,9 +48,40 @@
InputTextChanges()
)
+######
+
+HigherOrder = React.createClass(
+ handleClick: ->
+ alert if _.isArray(@refs.outer.props.children) then 'array' else 'object'
+ render: ->
+ R.div {},
+ R.div {ref: 'outer'}, @props.contents()
+ R.button {onClick: @handleClick}, "tell me what's in contents()"
+)
+
+RefExperiments = React.createClass(
+ render: ->
+ R.div {},
+ HigherOrder {
+ contents: -> [
+ R.label {}, 'hello'
+ R.label {}, 'world'
+ ]
+ }
+ HigherOrder {
+ contents: ->
+ R.label {}, 'hello'
+ }
+)
+
+######
+
+Main = React.createClass(
+ render: ->
+ R.div {},
+ TextExperiments {}
+ RefExperiments {}
+)
+
$ ->
main = React.renderComponent(Main(), $('.main')[0])
- setInterval(
- -> main.setState(counter: main.state.counter + 1)
- 1000
- )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-05-24 18:59:01
|
Revision: 1882
http://sourceforge.net/p/assorted/svn/1882
Author: yangzhang
Date: 2014-05-24 18:58:59 +0000 (Sat, 24 May 2014)
Log Message:
-----------
Add event propagation demo
Added Paths:
-----------
sandbox/trunk/src/web/events/
sandbox/trunk/src/web/events/Makefile
sandbox/trunk/src/web/events/README
sandbox/trunk/src/web/events/index.jade
sandbox/trunk/src/web/events/package.json
Added: sandbox/trunk/src/web/events/Makefile
===================================================================
--- sandbox/trunk/src/web/events/Makefile (rev 0)
+++ sandbox/trunk/src/web/events/Makefile 2014-05-24 18:58:59 UTC (rev 1882)
@@ -0,0 +1,3 @@
+all: index.html
+%.html: %.jade
+ ./node_modules/.bin/jade $<
Added: sandbox/trunk/src/web/events/README
===================================================================
--- sandbox/trunk/src/web/events/README (rev 0)
+++ sandbox/trunk/src/web/events/README 2014-05-24 18:58:59 UTC (rev 1882)
@@ -0,0 +1,10 @@
+Findings:
+
+- for the event target itself, capture listeners are treated the same as bubble
+ listeners, executed in an arbitrary order
+ <https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener>
+- focus, blur not bubbled, but capture-able
+ <http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html>
+- key*, change, focusin, focusout bubble
+- react doesn't have focusin/focusout since its own focus/blur already support
+ bubbling <https://news.ycombinator.com/item?id=6995335>
Added: sandbox/trunk/src/web/events/index.jade
===================================================================
--- sandbox/trunk/src/web/events/index.jade (rev 0)
+++ sandbox/trunk/src/web/events/index.jade 2014-05-24 18:58:59 UTC (rev 1882)
@@ -0,0 +1,40 @@
+doctype html
+html
+ head
+ title Events demo
+ body
+ .main
+ input(type='text')
+ script
+ :coffee-script
+ logger = (label) -> -> console.log(label)
+
+ [main] = document.getElementsByClassName('main')
+ main.addEventListener 'keydown', logger('main keydown')
+ main.addEventListener 'keydown', logger('main keydown cap'), true
+ main.addEventListener 'keypress', logger('main keypress')
+ main.addEventListener 'keypress', logger('main keypress cap'), true
+ main.addEventListener 'keyup', logger('main keyup')
+ main.addEventListener 'keyup', logger('main keyup cap'), true
+ main.addEventListener 'change', logger('main change')
+ main.addEventListener 'focus', logger('main focus')
+ main.addEventListener 'blur', logger('main blur')
+ main.addEventListener 'focus', logger('main focus cap'), true
+ main.addEventListener 'blur', logger('main blur cap'), true
+ main.addEventListener 'focusin', logger('main focusin cap')
+ main.addEventListener 'focusout', logger('main focusout cap')
+
+ [input] = document.getElementsByTagName('input')
+ input.addEventListener 'keydown', logger('input keydown')
+ input.addEventListener 'keydown', logger('input keydown cap'), true
+ input.addEventListener 'keypress', logger('input keypress')
+ input.addEventListener 'keypress', logger('input keypress cap'), true
+ input.addEventListener 'keyup', logger('input keyup')
+ input.addEventListener 'keyup', logger('input keyup cap'), true
+ input.addEventListener 'change', logger('input change')
+ input.addEventListener 'focus', logger('input focus')
+ input.addEventListener 'blur', logger('input blur')
+ input.addEventListener 'focus', logger('input focus cap'), true
+ input.addEventListener 'blur', logger('input blur cap'), true
+ input.addEventListener 'focusin', logger('input focusin cap')
+ input.addEventListener 'focusout', logger('input focusout cap')
Added: sandbox/trunk/src/web/events/package.json
===================================================================
--- sandbox/trunk/src/web/events/package.json (rev 0)
+++ sandbox/trunk/src/web/events/package.json 2014-05-24 18:58:59 UTC (rev 1882)
@@ -0,0 +1,15 @@
+{
+ "name": "events",
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "coffee-script": "^1.7.1",
+ "jade": "^1.3.1"
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-04-16 21:27:23
|
Revision: 1881
http://sourceforge.net/p/assorted/svn/1881
Author: yangzhang
Date: 2014-04-16 21:27:21 +0000 (Wed, 16 Apr 2014)
Log Message:
-----------
Fix pythonrc to tolerate ipython
Modified Paths:
--------------
configs/trunk/src/pythonrc.py
Modified: configs/trunk/src/pythonrc.py
===================================================================
--- configs/trunk/src/pythonrc.py 2014-03-23 08:45:53 UTC (rev 1880)
+++ configs/trunk/src/pythonrc.py 2014-04-16 21:27:21 UTC (rev 1881)
@@ -1,7 +1,11 @@
-from __future__ import ( generators, with_statement )
import os, sys
-#from cStringIO import *
+from cStringIO import *
from itertools import *
-import readline, rlcompleter
-readline.parse_and_bind( 'tab: complete' )
+try: get_ipython
+except NameError: in_ipython = False
+else: in_ipython = True
+
+if not in_ipython:
+ import readline, rlcompleter
+ readline.parse_and_bind( 'tab: complete' )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-03-23 08:45:55
|
Revision: 1880
http://sourceforge.net/p/assorted/svn/1880
Author: yangzhang
Date: 2014-03-23 08:45:53 +0000 (Sun, 23 Mar 2014)
Log Message:
-----------
Add input demos
Modified Paths:
--------------
sandbox/trunk/src/web/react/index.coffee
Modified: sandbox/trunk/src/web/react/index.coffee
===================================================================
--- sandbox/trunk/src/web/react/index.coffee 2014-03-22 20:27:47 UTC (rev 1879)
+++ sandbox/trunk/src/web/react/index.coffee 2014-03-23 08:45:53 UTC (rev 1880)
@@ -3,7 +3,9 @@
React = require 'react'
R = React.DOM
-Foo = React.createClass(
+# Show that props update while state remains the same.
+# See also <https://medium.com/react-tutorials/14a6d4f736f5>.
+PropsVsState = React.createClass(
getInitialState: ->
counter: @props.initCount
componentDidUpdate: ->
@@ -15,13 +17,30 @@
"counter: #{@state.counter}"
)
+# Show that value is a tightly bound property of input controls.
+# See also <http://facebook.github.io/react/docs/forms.html>.
+InputTextChanges = React.createClass(
+ handleChange: (e) -> @setState(msg: e.target.value)
+ handleChange2: (e) -> @setState(msg2: e.target.value.substr(0, 50))
+ getInitialState: ->
+ msg: 'I update bound state. I-beam will magically work.'
+ msg2: 'I-beam breaks as soon as set state value differs.'
+ render: ->
+ R.div {},
+ R.input {type: 'text', value: 'Dare you to edit me.'}
+ R.input {type: 'text', defaultValue: 'I am easily persuaded.'}
+ R.input {type: 'text', value: @state.msg, onChange: @handleChange}
+ R.input {type: 'text', value: @state.msg2, onChange: @handleChange2}
+)
+
Main = React.createClass(
getInitialState: ->
counter: 0
render: ->
R.div {},
- Foo {initCount: @state.counter}
- Foo {initCount: @state.counter + 1}
+ PropsVsState {initCount: @state.counter}
+ PropsVsState {initCount: @state.counter + 1}
+ InputTextChanges()
)
$ ->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-03-22 20:27:50
|
Revision: 1879
http://sourceforge.net/p/assorted/svn/1879
Author: yangzhang
Date: 2014-03-22 20:27:47 +0000 (Sat, 22 Mar 2014)
Log Message:
-----------
Add old React experiments
Added Paths:
-----------
sandbox/trunk/src/web/react/
sandbox/trunk/src/web/react/go.bash
sandbox/trunk/src/web/react/index.coffee
sandbox/trunk/src/web/react/index.jade
sandbox/trunk/src/web/react/package.json
Index: sandbox/trunk/src/web/react
===================================================================
--- sandbox/trunk/src/web/react 2014-03-08 23:01:49 UTC (rev 1878)
+++ sandbox/trunk/src/web/react 2014-03-22 20:27:47 UTC (rev 1879)
Property changes on: sandbox/trunk/src/web/react
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,3 ##
+index.js
+index.html
+node_modules
Added: sandbox/trunk/src/web/react/go.bash
===================================================================
--- sandbox/trunk/src/web/react/go.bash (rev 0)
+++ sandbox/trunk/src/web/react/go.bash 2014-03-22 20:27:47 UTC (rev 1879)
@@ -0,0 +1,2 @@
+./node_modules/.bin/jade index.jade
+./node_modules/.bin/watchify -v -o index.js -t coffeeify index.coffee
Added: sandbox/trunk/src/web/react/index.coffee
===================================================================
--- sandbox/trunk/src/web/react/index.coffee (rev 0)
+++ sandbox/trunk/src/web/react/index.coffee 2014-03-22 20:27:47 UTC (rev 1879)
@@ -0,0 +1,32 @@
+_ = require 'underscore'
+$ = require 'jquery'
+React = require 'react'
+R = React.DOM
+
+Foo = React.createClass(
+ getInitialState: ->
+ counter: @props.initCount
+ componentDidUpdate: ->
+ console.log 'updated', @props, @state
+ render: ->
+ R.div {},
+ "initCount: #{@props.initCount}"
+ R.br {}
+ "counter: #{@state.counter}"
+)
+
+Main = React.createClass(
+ getInitialState: ->
+ counter: 0
+ render: ->
+ R.div {},
+ Foo {initCount: @state.counter}
+ Foo {initCount: @state.counter + 1}
+)
+
+$ ->
+ main = React.renderComponent(Main(), $('.main')[0])
+ setInterval(
+ -> main.setState(counter: main.state.counter + 1)
+ 1000
+ )
Added: sandbox/trunk/src/web/react/index.jade
===================================================================
--- sandbox/trunk/src/web/react/index.jade (rev 0)
+++ sandbox/trunk/src/web/react/index.jade 2014-03-22 20:27:47 UTC (rev 1879)
@@ -0,0 +1,5 @@
+doctype html
+html
+ body
+ .main
+ script(src='index.js')
Added: sandbox/trunk/src/web/react/package.json
===================================================================
--- sandbox/trunk/src/web/react/package.json (rev 0)
+++ sandbox/trunk/src/web/react/package.json 2014-03-22 20:27:47 UTC (rev 1879)
@@ -0,0 +1,22 @@
+{
+ "name": "react-experiments",
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": "",
+ "author": "",
+ "license": "BSD",
+ "dependencies": {
+ "coffee-script": "^1.7.1",
+ "coffeeify": "^0.6.0",
+ "jade": "^1.3.0",
+ "jquery": "^2.1.0",
+ "react": "^0.10.0",
+ "underscore": "^1.6.0",
+ "underscore.string": "^2.3.3",
+ "watchify": "^0.6.3"
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yan...@us...> - 2014-03-08 23:01:51
|
Revision: 1878
http://sourceforge.net/p/assorted/svn/1878
Author: yangzhang
Date: 2014-03-08 23:01:49 +0000 (Sat, 08 Mar 2014)
Log Message:
-----------
Rename python-commons to commons
Modified Paths:
--------------
python-commons/trunk/setup.py
Modified: python-commons/trunk/setup.py
===================================================================
--- python-commons/trunk/setup.py 2014-02-26 02:32:59 UTC (rev 1877)
+++ python-commons/trunk/setup.py 2014-03-08 23:01:49 UTC (rev 1878)
@@ -8,7 +8,7 @@
pkg_info_text = """
Metadata-Version: 1.1
-Name: python-commons
+Name: commons
Version: 0.7
Author: Yang Zhang
Author-email: yaaang NOSPAM at REMOVECAPS gmail
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|