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
/* | |
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined | |
* in FIPS 180-1 | |
* Version 2.2-alpha Copyright Paul Johnston 2000 - 2002. | |
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
* Distributed under the BSD License | |
* See http://pajhome.org.uk/crypt/md5 for details. | |
*/ | |
/* |
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 'oily_png' | |
Dir.glob("book/**/*.png").each do |file| | |
puts file | |
image = ChunkyPNG::Image.from_file(file) | |
p image.width | |
p image.height | |
if image.width > 800 || image.height > 800 |
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
select month, months_out from ( | |
select month, | |
GENERATE_ARRAY(0, DATE_DIFF(CURRENT_DATE(), month, MONTH)) as months, | |
from UNNEST( | |
(select | |
GENERATE_DATE_ARRAY(CAST([STARTING_DATE] AS DATE), CAST(max(date_field) AS DATE), | |
INTERVAL 1 MONTH) as date | |
from [SOME_TABLE_WITH_A_DATE_FIELD]) | |
) as month | |
) CROSS JOIN UNNEST(months) as months_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
#!/usr/bin/env ruby | |
require "tempfile" | |
GIST_URL = 'http://gist.github.com/gists' | |
if ARGV.include? "-p" | |
text = `pbpaste` | |
elsif !ARGV.empty? | |
@filename = ARGV.shift | |
text = File.read(File.expand_path(@filename)) |
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
.,mlkmlkml |
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
Git is an open source, distributed version control system implemented | |
as a directed acyclic graph of commit objects pointing to snapshots | |
of content, with all data saved in it's own custom content addressable | |
filesystem by the SHA-1 checksum hash of each objects data. branches | |
are simply pointers into this directed graph of commits, identifying | |
entry points that designate the latest work on that branch, allowing | |
Git to traverse the pointers, determining a coherent history. | |
this makes branching cheap and easy, and merging simple, encouraging | |
non-linear development styles and frictionless context switching while | |
facilitating distributed development, cryptographic integrity and late |
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 'net/http' | |
require 'uri' | |
# /api/v1/:format/new | |
# /api/v1/:format/gists/:user | |
# /api/v1/:format/:gist_id | |
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'), | |
{ 'files[file1.ab]' => 'CONTNETS', | |
'files[file2.ab]' => 'contents' }) |
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 Stopwatch | |
attr_writer :splits, :max, :start, :end, :total | |
def initialize(message) | |
@message = message | |
@splits = [] | |
@max = 5 | |
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
/tmp/compare/svn$ svn commit -m 'commit me' | |
Sending what.txt | |
Transmitting file data . | |
Committed revision 13. | |
/tmp/compare/svn$ svn info | |
Path: . | |
URL: http://localhost:5203/svn | |
Repository Root: http://localhost:5203/svn | |
Repository UUID: 3b9a9e50-8ead-4325-b308-a6ad9b1ac2aa |
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 | |
# this script takes your current commit, finds all the submodules in it, | |
# makes them static files in a new tree and updates a branch called 'heroku' | |
# - this way you can push a project with submodules to heroku easily | |
# just run this, then run "git push heroku heroku:master" | |
current_commit = `git rev-parse HEAD` | |
current_tree = `git rev-parse HEAD^{tree}` | |
puts "Starting at tree #{current_tree}" |