This file contains hidden or 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 'bigdecimal'; | |
class Integer | |
def factorial | |
f = 1; for i in 1..self; f *= i; end; f | |
end | |
end |
This file contains hidden or 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(window,undefined){ | |
// Prepare our Variables | |
var | |
History = window.History, | |
$ = window.jQuery, | |
document = window.document; | |
// Check to see if History.js is enabled for our Browser | |
if ( !History.enabled ) { |
This file contains hidden or 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 is a simple helper for uploading files to a server | |
# By default it randomises the filename (but preserves the extension) | |
# Supply -p to maintain original filename | |
require 'optparse' | |
require 'digest/md5' | |
require 'net/scp' |
This file contains hidden or 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
name=$1 | |
#random=$RANDOM + $RANDOM + $RANDOM | |
md5name=`md5 -s "${name}" | grep -o "[a-z0-9]\{32\}"` | |
md5name="${md5name}.png" | |
echo "http://r.46bit.com/${md5name}" | |
scp "$name" user@server:"/path/to/destination/${md5name}" | |
#echo "http://host/${md5name}" |
This file contains hidden or 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 'optparse' | |
options = { } | |
optparse = OptionParser.new do |opts| | |
opts.banner = "Plan your day through the cli.\n" | |
opts.banner += "Usage: plan [-e|--edit]" | |
options[:edit] = false |
This file contains hidden or 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 'twitter' | |
Twitter.configure do |config| | |
# See https://dev.twitter.com/apps | |
config.consumer_key = "" | |
config.consumer_secret = "" | |
config.oauth_token = "" | |
config.oauth_token_secret = "" |
This file contains hidden or 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
// Add this to your layout file as the <body> tag: | |
<body data-page="<%= "#{controller.controller_name}##{controller.method_name}" %>"> | |
// Now save this to /app/assets/javascript/bootloader.js (requires jQuery): | |
var app = { | |
actions: [], | |
action: function (page, callback) { | |
this.actions[page] = this.actions[page] || []; | |
this.actions[page].push(callback); | |
return this; |
This file contains hidden or 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 <stdio.h> | |
// Welcome back to C | |
// Handy to ever explain simple C to a friend | |
int main (int argc, char const *argv[]) { | |
printf("%s\n", "Welcome to Count!"); | |
printf("%s %s %s %s%s\n\n", "Printing from", argv[1], "for", argv[2], "."); | |
int count_from = atoi(argv[1]); | |
int count_for = atoi(argv[2]); |
This file contains hidden or 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 'optparse' | |
require 'digest/md5' | |
require 'net/scp' | |
require "fileutils" | |
options = { } | |
optparse = OptionParser.new do |opts| | |
opts.banner = "Usage: b_upload [-p|--preserve|-d|--delete-local] file" |
This file contains hidden or 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
PROMPT='%{$fg_bold[magenta]%}%n%{$reset_color%}\ | |
%{$fg[magenta]%}@%{$reset_color%}\ | |
%{$fg_bold[magenta]%}%m%{$reset_color%}:\ | |
%{$fg_bold[cyan]%}%c\ | |
%{$fg_bold[red]%} ∴ %{$reset_color%}' |
OlderNewer