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
require 'digest' | |
# From activestorage | |
def compute_checksum_in_chunks(io) | |
Digest::MD5.new.tap do |checksum| | |
while chunk = io.read(5242880) | |
checksum << chunk | |
end | |
io.rewind | |
end.base64digest |
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 ObjectComparisonHelper | |
def deep_hash_diff(obj1, obj2, path = 'root', differences = []) | |
if obj1.class != obj2.class | |
differences << "object types differ at #{path}: #{obj1.class} vs #{obj2.class}" | |
else | |
case obj1 | |
when Hash, HashWithIndifferentAccess | |
differences << "key sets differ at #{path}: #{obj1.keys.inspect} vs #{obj2.keys.inspect}" if obj1.keys.to_set != obj2.keys.to_set | |
obj1.each do |key, value| | |
deep_hash_diff(value, obj2[key], "#{path}.#{key}", differences) |
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
2.1.2 :004 > pp Google::Contacts.new(client).contacts | |
[{:emails=>{:other=>{:address=>"fake@gmail.com", :primary=>true}}, | |
:phone_numbers=> | |
{:main=>"(555) 123-1234", :home=>"123-123-1234", :mobile=>"555-555-5555"}, | |
:handles=> | |
{:home=>{:address=>"something", :protocol=>"AIM"}, | |
:other=>{:address=>"something-else", :protocol=>"AIM"}}, | |
:nickname=>nil, | |
:websites=>[], |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
# Every Vagrant development environment requires a box. You can search for | |
# boxes at https://atlas.hashicorp.com/search. | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.network "forwarded_port", guest: 3000, host: 3000 | |
config.vm.provision "shell", privileged: false, inline: <<-SHELL |
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
[][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]][([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]]+([][[]]+[])[+[[+!+[]]]]+(![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[+!+[]]]]+([][[]]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[ |
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
package main | |
import "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
pic := make([][]uint8, dx) | |
for i := range(pic) { | |
pic[i] = make([]uint8, dy) | |
for j := range(pic[i]) { | |
pic[i][j] = uint8((i + j)/2) |
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 ruby | |
require "rubygems" | |
require "my_obfuscate" | |
obfuscator = MyObfuscate.new({ | |
:people => { | |
:email => { :type => :email, :skip_regexes => [/^[\w\.\_]+@my_company\.com$/i] }, | |
:ethnicity => :keep, | |
:crypted_password => { :type => :fixed, :string => "SOME_FIXED_PASSWORD_FOR_EASE_OF_DEBUGGING" }, | |
:salt => { :type => :fixed, :string => "SOME_THING" }, |
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 Utilities | |
@findPos: (obj) -> | |
obj = obj.get(0) if obj.html? | |
curLeft = curTop = 0 | |
if obj.offsetParent | |
loop | |
curLeft += obj.offsetLeft | |
curTop += obj.offsetTop | |
break unless obj = obj.offsetParent | |
{ x: curLeft, y: curTop } |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<filetype binary="false" default_extension="" description="CoffeeScript" name="CoffeeScript"> | |
<highlighting> | |
<options> | |
<option name="LINE_COMMENT" value="#" /> | |
<option name="COMMENT_START" value="`" /> | |
<option name="COMMENT_END" value="`" /> | |
<option name="HEX_PREFIX" value="" /> | |
<option name="NUM_POSTFIXES" value="" /> | |
<option name="HAS_BRACKETS" value="true" /> |
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
#!/bin/sh | |
if [ ! `which rlwrap` ]; then | |
echo "Please sudo port install rlwrap" | |
exit | |
fi | |
rlwrap coffee -i |
NewerOlder