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 Array | |
def groups_of(s) | |
resp = [] | |
g=[] | |
self.each do |i| | |
g << i | |
if g.count == s | |
resp << g | |
g= [] | |
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
# Really short hash, (no extra collisions besides the known CRC32 ) | |
# Correct term for this encoding should be "Trimmed Urlsafe Base Encoded CRC32 Hash" or TUBECH?.. two-bitch encoding, lol. | |
# String.send(:include , ShortHash) | |
# "Hello World".short_hash # => "VrEXSg" | |
module ShortHash | |
require 'base64' | |
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
' Copyright (c) 2007, Tony Ivanov | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. |
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
Element.getTransform= function (element){ | |
var properties = [ | |
'transform', | |
'WebkitTransform', | |
'MozTransform', | |
'msTransform', | |
'OTransform' | |
]; | |
var p; | |
while (p = properties.shift()) { |
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
module GravatarHelper | |
def gravatar_tag(email,*args) | |
opts = args.extract_options! | |
opts[:class]||="" | |
opts[:class]+=" gravatar" | |
size = opts.delete(:size) || 80 | |
require 'digest/md5' | |
default="" |
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
module Raumod::BufferMapper | |
# See http://ruby-doc.org/core/classes/String.html#M001112 | |
# for map types. | |
def data_map;@data_map;end | |
def data;@data;end | |
def data_entry(method) | |
offset = data_map[method][:offset] | |
type = data_map[method][:type] | |
d = data[offset..-1].unpack(type) |
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
// http://www.ietf.org/rfc/rfc1928.txt | |
// Tested with: curl http://www.google.se/ --socks5 1080 --proxy-user foo:bar | |
var States = { | |
CONNECTED:0, | |
VERIFYING:1, | |
READY:2, | |
PROXY: 3 | |
}; |
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
#include "oscilloscope.h" | |
#define ANALOG_IN 0 | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
int val = analogRead(ANALOG_IN); |
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 net = require('net'); | |
var client = net.connect(parseInt(process.argv[3]),process.argv[2],function(){ | |
client.setEncoding('utf8'); | |
console.log('Connected!!'); | |
client.on('data',function(chunk){ | |
console.log(chunk); | |
}); | |
process.stdin.resume(); // Activate STDIN | |
process.stdin.setEncoding('utf8'); // Set it to string encoding | |
process.stdin.on('data',function(chunk){ // Pipe STDIN to Socket.out |
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
window.gobmod={}; | |
window.gobmod.attachPlayer = function(elem){ | |
elem = $(elem); | |
var player = new Element('a',{'class':'modplaybutton', href: '#'}); | |
player.innerHTML='>' | |
elem.insert({top: player}); | |
// Start playback | |
var startPlayback=function(){ |
OlderNewer