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
@tuples = sort { $a->[0] <=> $b->[0] } @tuples; | |
my $dates = map { $_->[0] } @tuples; | |
my $values = map { $_->[1] } @tuples; |
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
function click(theFunction) { | |
// Something happens | |
theFunction(event); | |
} | |
// Example 1 | |
$('a').click(alert('hi')); | |
// Example 2: this does the same thing as example 1 | |
alert_result = alert('hi'); |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>test</title> | |
<!-- JQUERY --> | |
<script type="text/javascript" charset="utf-8"> |
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
filter(P, [H|T]) -> | |
case P(H) of | |
true -> [H|filter(P, T)]; | |
false -> filter(P, T) | |
end; | |
filter(P, []) -> | |
[]. | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
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/ruby | |
require 'aws/s3' | |
class GitRepoArchiver | |
attr_reader :repo_name, :repo_dir, :bucket | |
def init(args) | |
# Change the current working directory |
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 Archiver | |
def initialize(directory) | |
@directory = directory | |
end | |
def tar_and_gzip | |
# Go into the directory | |
Dir.chdir @directory | |
# Since this will be the fully qualified directory |
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
/* | |
* Author: Benny Wong - http://bwong.net/ | |
* | |
* Code for this Stack Overflow question: | |
* http://stackoverflow.com/questions/819019/how-do-i-add-2-or-more-customized-uitableviewcell-to-nsmutable-array/820195 | |
* | |
*/ | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
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
NSString *id = [[UIDevice currentDevice] uniqueIdentifier]; |
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
(function($) { | |
$.fn.konami = function(callback, code) { | |
if (keySequence == undefined) | |
keySequence = "38,38,40,40,37,39,37,39,66,66"; | |
return this.each(function() { | |
var keysPress = []; | |
$(this).keydown(function(e){ | |
keysPressed.push( e.keyCode ); |
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
error do | |
exception = request.env['sinatra.error'] | |
Hoptoad::Notifier.send_error exception, params, request.env if %w(staging production).include?(ENV['RACK_ENV']) | |
erb :five_hundred | |
end |