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
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Xml.Serialization; | |
using ShiftIt.Http; | |
namespace Chunkyness | |
{ | |
public class ChunkyRequest |
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
#!/usr/bin/env sh | |
# | |
# Usage: send <username> <password> <accountReference> <recipient> < file | |
# eg. send john.doe@example.com secretPassword EX00000 44132133113213 < mymessage.txt | |
body=$(cat) | |
curl -X POST --user "$1:$2" -d@- "https://api.esendex.com/v1.0/messagedispatcher" <<EOS | |
<?xml version="1.0" encoding="utf-8"?> | |
<messages> |
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
// Usage: dominant < in > out | |
package main | |
import ( | |
"github.com/hawx/img/utils" | |
"github.com/hawx/rgoybiv" | |
"image" | |
"image/draw" | |
) |
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
var redis = require('redis').createClient(); | |
var app = require('express')(); | |
var total = 0, count = 0; | |
redis.on('message', function(channel, message) { | |
if (channel == "requests") { | |
var obj = JSON.parse(message); | |
total += obj.duration; |
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
#!/usr/bin/env sh | |
REPO=$1 | |
mkdir /opt/git/$REPO.git | |
git init --bare /opt/git/$REPO.git | |
cd /opt/git/$REPO.git | |
mv hooks/post-update.sample hooks/post-update |
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
// Given we have some, | |
// function el(name) { return function() { ... } } | |
var Dropdown = el('Dropdown'), | |
Menu = el('Menu'), | |
MenuItem = el('MenuItem'); | |
var dropdown = Dropdown( | |
'A dropdown list', | |
Menu( |
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
#!/usr/bin/env newlisp | |
;; Prints the nth fibonacci number | |
(define (fib n) | |
(if (< n 2) | |
1 | |
(+ (fib (- n 1)) | |
(fib (- n 2))))) | |
;; Solves equations of the form |
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
# @param args [Hash{Symbol=>Object}] | |
def run_proc_with_locals(args, proc) | |
k = Class.new | |
args.each do |sym, v| | |
k.send(:define_method, sym) { v } | |
end | |
k.new.instance_exec(&proc) | |
end | |
tha_proc = proc do |
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
# Sometimes you want to run a set of blocks before/after | |
# each/all of something. Problem solved. | |
# | |
# @example | |
# | |
# class CountDown < Runner | |
# before :all do |arr| | |
# arr.collect {|i| i + 1 } | |
# end | |
# |
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 Object | |
# A method that adds a #subclass class method allowing | |
# you to find the subclasses of a particular class. | |
# | |
# @example | |
# | |
# class String2 < String; end | |
# class String3 < String; end | |
# String.subclasses |
OlderNewer