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
| " freakin sweet iterpolation | |
| let g:surround_{char2nr("#")} = "#{\r}" |
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
| Proc.new { |env| | |
| status, headers, body = | |
| begin | |
| @app.call(env) | |
| rescue => boom | |
| raise | |
| end | |
| [status, headers, body] | |
| } |
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
| def get_input | |
| print ">>" | |
| STDOUT.flush | |
| response = STDIN.gets.chomp | |
| case response | |
| when "exit" | |
| puts "bye!" | |
| @running = false | |
| when "time" | |
| puts "The Time is:#{Time.now}" |
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
| #!/bin/sh | |
| BRANCHES=`git branch` | |
| if [ $? != 0 ]; then | |
| exit | |
| fi | |
| GIT_SVN=0 | |
| git branch -r | grep 'git-svn' > /dev/null | |
| if [ $? = 0 ]; then | |
| GIT_SVN=1 |
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> | |
| //usage cat javascript.js | minifier > javascript.mini.js | |
| int main(int argc, char const* argv[]) | |
| { | |
| int c; | |
| while ((c=getchar()) != EOF) { | |
| if (c!= '\n' && c!='\t' && c!='\r') | |
| putchar(c); | |
| } | |
| return 0; |
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
| def hexlify(msg) | |
| msg.split("").collect { |c| c[0].to_s(16) }.join | |
| end | |
| def unhexlify(msg) | |
| msg.scan(/../).collect { |c| c.to_i(16).chr }.join | |
| end | |
| puts hexlify("Hello World") |
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
| require 'rubygems' | |
| require 'json' | |
| require 'mash' | |
| file = File.read("./widget.json") | |
| mash = Mash.new(JSON.parse(file)) | |
| mash.tracks.each do |track| | |
| `curl #{track.stream_url} > "~/immi/#{track.permalink}"` | |
| 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
| Factory.define :hot_model do |f| | |
| f.sequence(:unique_attr) {|i| "heidi_klum#{i}" } | |
| 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
| # be sure to gem install httparty, its a GREAT gem for | |
| # working with these types of RESTful This is just a starting point. | |
| # You will probably want to add a few more methods to the class that | |
| # sets the account_sid, and account_token. | |
| require "httparty" | |
| class TwilioCall | |
| include HTTParty | |
| base_uri "https://api.twilio.com/" | |
| #this is just your account credentials, replace them with your credentials | |
| basic_auth ACCOUNT_SID, ACCOUNT_TOKEN |
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
| it "should be ok" do | |
| get "/api/fakeguid/events" | |
| Rails.logger.info "#{response.inspect}" | |
| response.should be_ok | |
| end | |
| # results of response.inspect | |
| #<Rack::MockResponse:0x36a6898 @headers={"Content-Type"=>"text/html", "Content-Length"=>"414"}, @errors="", @original_headers={"Content-Type"=>"text/html", "Content-Length"=>"414"}, @body="<!DOCTYPE html>\n<html>\n<head>\n <style type=\"text/css\">\n body { text-align:center;font-family:helvetica,arial;font-size:22px;\n color:#888;margin:20px}\n #c {margin:0 auto;width:500px;text-align:left}\n </style>\n</head>\n<body>\n <h2>Sinatra doesn't know this ditty.</h2>\n <img src='/__sinatra__/404.png'>\n <div id=\"c\">\n Try this:\n <pre>get '/hello' do\n \"Hello World\"\nend</pre>\n </div>\n</body>\n</html>\n", @status=404> |