Skip to content

Instantly share code, notes, and snippets.

View fwg's full-sized avatar
🐒
I'm a potato.

Friedemann Altrock fwg

🐒
I'm a potato.
View GitHub Profile
@fwg
fwg / cron-test.js
Created November 18, 2009 14:09 — forked from onewland/cron-test.js
use var!!
var cron = require('./cron'), sys = require('sys');
cron.Every((2).seconds(), function() { sys.puts('Working!'); });
diff --git a/doc/api.txt b/doc/api.txt
index b3a163c..8b439cc 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -119,6 +119,11 @@ success code 0.
+process.cwd()+::
Returns the current working directory of the process.
++process.umask(mask)+ ::
+Sets the process's file mode creation mask. Child processes inherit the mask
diff --git a/src/node.js b/src/node.js
index 6882102..e9b5905 100644
--- a/src/node.js
+++ b/src/node.js
@@ -257,6 +257,9 @@ process.Promise.prototype.timeout = function(timeout) {
};
process.Promise.prototype.cancel = function() {
+ if(this._cancelled) return;
+ this._cancelled = true;
diff --git a/src/node.js b/src/node.js
index 6882102..e9b5905 100644
--- a/src/node.js
+++ b/src/node.js
@@ -314,7 +317,91 @@ process.Promise.prototype.wait = function () {
return ret;
};
+process.Promise.prototype.depend = function () {
+ var slice = Array.prototype.slice;
// ok, bot/bot/bot is probably not the best naming scheme, subject to change
var Bot = require('./bot/bot').Bot,
sys = require('sys');
// we do not give a nick, nor user nor realname, the client will
// pick a semi-random nick and 'guest' as user/realname.
var config = {host: "localhost", port: 6667, nick: ""};
var bot = new Bot(config);
@fwg
fwg / gist:271277
Created January 7, 2010 15:05 — forked from memowe/gist:271270
function drawProgress (factor) {
var progress = $('#progress');
var bar = progress.children('#bar');
var maxwidth = progress.width();
factor = factor > 1 ? 1 : factor < 0 ? 0 : factor;
bar.width( maxwidth * factor );
}
function calculate (params) {
var schwarze = new Array();
@fwg
fwg / gist:1165150
Created August 23, 2011 13:43
select magento products that have no status
SELECT
product.entity_id
FROM
catalog_product_entity product
LEFT JOIN catalog_product_entity_int status
ON (status.entity_id=product.entity_id and status.attribute_id=80)
WHERE
status.value IS NULL
@fwg
fwg / gist:1165259
Created August 23, 2011 14:24
Insert product status attribute for products that don't have it
INSERT INTO catalog_product_entity_int
(entity_type_id,attribute_id,store_id,entity_id,value)
SELECT
4 AS entity_type_id,
80 AS attribute_id,
0 AS store_id,
product.entity_id,
1 AS value
FROM
catalog_product_entity product
/*
* Stringverarbeitung.c
*/
#include <stdio.h> // for printf, fgets, stdin
int main() {
printf("String insert:");
char string[100];
fgets(&(string[0]), 100, stdin);
@fwg
fwg / .gitignore
Created January 27, 2012 13:25 — forked from line-o/PS.js
node js module to find a representation for a string with chemical elements
.idea/
*~
*.swp