This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # PubSub | |
# | |
# Is a small helper to simply realize a pub/sub pattern to a coffee class. | |
# | |
# A namespaceing of the topics is also included. | |
# This means you can subscribe to `a` and also get the `a.b`. But if you subscribe to `a.b` you will not get a `a`. | |
# | |
# **required module**: `underscore` | |
# | |
class PubSub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
o = { | |
"ID": "BgQfL", | |
"jsonSettings": "{\"weight\":49,\"height\":158,\"heartrate_max\":168,\"phonebusiness\":\"03423/667840\",\"usergroups\":\"Mitglied\",\"colors\":{\"plantargets\":[],\"usergroups\":[],\"pain\":[],\"damage\":[],\"activeplan_targets\":[]},\"comment\":\"Skoliose\r\n\r\nPatientin ist hypermobil\r\n\r\nbd Clavicula gebrochen; links 2011, recht 1997\",\"plantargets\":\"Muskelaufbau,Ausdauer\"}", | |
"firstname": "Heike", | |
"lastname": "Jüttner" | |
} | |
console.log( o.jsonSettings ) | |
_json = | |
encode: ( s )-> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SortableCollection extends Collection | |
### | |
## moveAfter | |
`collections.moveAfter( model, predecessor )` | |
Move a model after another model or if `predecessor` is `null` or `0` to the top of the model list | |
@param { Model | String | Number } model The model to move, it's `id` or the `cid` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JSONreplace | |
### | |
## _jsonreplacemap | |
`_jsonreplacemap( _json, map )` | |
Replace the values of a key inside of a json string. | |
@param { String | Object } _json A Stringfied JSON or a object witch will be stringfied. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Middleware | |
constructor: -> | |
# define a shared object witch will be routed through all called methods | |
shared = {} | |
# run the middleware method to process all defined methods | |
# If one method fails by calling error the queue will be stopped | |
@middleware shared, @simpleCall, @addSomeMethods, ( err, shared )=> | |
if err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs = require( "fs" ) | |
request = require( "request" ) | |
async = require( "async" ) | |
### call this in the octocats list: | |
list = [] | |
$( "img" ).each ( i, el )-> | |
#console.log arguments | |
_src = $( @ ).data( "src" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# drop a existing test table | |
DROP TABLE IF EXISTS `test`; | |
# create the test table | |
CREATE TABLE `test` ( | |
`_h` varchar(5) NOT NULL DEFAULT '', | |
`_set` text, | |
PRIMARY KEY (`_h`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
**IMPORTANT** Make shure moment.js is available. | |
**ARGUMENTS** | |
* `timestamps` *( Array )*:An arry of timestamps. | |
* `type` *( String )*: A moment time type like `minute`, `hour`, `day` | |
* `pastCursor` *( Number )*: A number to define the maximum time to the past. If lower than `0` all given timestamps will be returned. | |
### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CRON: crontab header to run node and grunt within a cron job | |
#!/bin/sh | |
SHELL=/bin/sh | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* activate global logging and the logfile path*/ | |
SET GLOBAL general_log = 'ON'; | |
SET GLOBAL general_log_file = '/Users/mathiaspeter/logs/mysql_general.log'; | |
/* deactivate global logging */ | |
SET GLOBAL general_log = 'OFF'; | |
/* show variables */ | |
SHOW GLOBAL VARIABLES like '%log%'; |
OlderNewer