This file contains hidden or 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
| var express = require('express'), | |
| cgh = require('connect-githubhook'); | |
| var app = express.createServer(); | |
| var hook = cgh.createHook({ 'secretpath': 'https://github.com/test/test' }, function (payload) { | |
| //do whatever | |
| }); | |
| app.use(hook); |
This file contains hidden or 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
| require 'osx/cocoa' | |
| require 'optparse' | |
| include OSX | |
| OSX.require_framework 'ScriptingBridge' | |
| iTunes = SBApplication.applicationWithBundleIdentifier_('com.apple.iTunes') | |
| $opts = {} | |
| optparse = OptionParser.new do |args| | |
| args.banner = 'Usage: update-itunes.rb [opts] <path>' |
This file contains hidden or 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
| /* CLW module for ZNC | |
| * Build with znc-buildmod and load with /msg *status loadmod clw | |
| * Module triggers Wednesdays from 2PM to 4PM Pacific time, but uses UTC | |
| * and converts to make sure it works in any time zone. Will ONLY caps | |
| * messages sent to #thezone | |
| * | |
| * Changes: | |
| * 1/4/2012 | |
| * added handling of irc connected event so module is properly re-enabled | |
| * 4/30/2011 |
This file contains hidden or 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
| function _isUnique(array) { | |
| function _sort(item) { | |
| if (!item || typeof item !== 'object' || Array.isArray(item)) { | |
| return item; | |
| } | |
| var result = []; | |
| Object.keys(item).sort().forEach(function (key) { | |
| result.push({ key: key, value: _sort(item[key]) }); | |
| }); | |
| return result; |
This file contains hidden or 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
| Comment here what features/commands you want added to the bot. | |
| This is what I already have planned: | |
| * Weather, since Syber's bot sucks at it |
This file contains hidden or 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
| var http = require('http'), | |
| fs = require('fs'); | |
| var data = fs.readFileSync('./sample_request.txt'); | |
| var parser = http.parsers.alloc(); | |
| parser.reinitialize(1); | |
| console.log(parser); | |
| parser.onIncoming = function (res) { | |
| console.log('onIncoming:', res); |
This file contains hidden or 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
| function lshift(num, bits) { | |
| return num * Math.pow(2, bits); | |
| } | |
| function rshift(num, bits) { | |
| return num / Math.pow(2, bits); | |
| } | |
| function encode(num) { | |
| if (num === 0) return new Buffer([0x00]); |
This file contains hidden or 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
| function reads(buf, start, end) { | |
| var pos = start, | |
| bytes = [], | |
| byte, | |
| byte2; | |
| while (pos < end) { | |
| byte = buf[pos]; | |
| if (byte > 191 && byte < 224) { | |
| pos++; | |
| byte = ((byte & 31) << 6) | (buf[pos] & 63); |
This file contains hidden or 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
| 100,000,000 iterations of each function. lines starting with Buffer# are the core implementations, those with butils# are mine. | |
| Buffer#writeInt8: 15230ms | |
| butils#writeInt: 165ms | |
| Buffer#readInt8: 3074ms | |
| butils#readInt: 162ms | |
This file contains hidden or 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
| var client = require('simpleriak').createClient({ bucket: 'hb' }); | |
| function map(v, keydata, arg) { | |
| if (v.values[0].metadata['X-Riak-Deleted']) return []; | |
| var links = v.values[0].metadata.Links, | |
| ret = []; | |
| ret.push([v.bucket, v.key]); | |
| for (var i = 0; i < links.length; i++) { | |
| if (links[i][2] === arg) { | |
| ret.push([links[i][0], links[i][1]]); |
OlderNewer