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
| # | |
| # bash completion support for core Git. | |
| # | |
| # Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
| # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
| # Distributed under the GNU General Public License, version 2.0. | |
| # | |
| # The contained completion routines provide support for completing: | |
| # | |
| # *) local and remote branch names |
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
| git_check_changes () | |
| { | |
| git status | sed -n ' | |
| 1h | |
| 1!H | |
| $ { | |
| g | |
| s/Untracked files:/\?/ | |
| s/Changed but not updated/\*/ |
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 run_cmd(cmd) | |
| puts "\nRunning: #{cmd}" | |
| raise "#{cmd} failed" unless system cmd | |
| end | |
| def current_branch | |
| `git status`.gsub(/On branch (.+)/) do | |
| return $1 | |
| 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
| def foo | |
| f = Proc.new { return "return from foo from inside proc" } | |
| f.call # control leaves foo here | |
| return "return from foo" | |
| end | |
| def bar | |
| f = lambda { return "return from lambda" } | |
| f.call # control does not leave bar here | |
| return "return from bar" |
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
| # Linux | |
| openssl rand -base64 1024 -out /dev/stdout | sed -r 's/[^a-zA-Z0-9]//g' | tr -d '\n' | |
| # Mac OSX | |
| openssl rand -base64 1024 -out /dev/stdout | sed 's/[^a-zA-Z0-9]//g' | tr -d '\n' |
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 'bundler' | |
| ENV['BUNDLE_GEMFILE']="/path/to/Gemfile" | |
| Bundler.require |
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
| ActiveRecord::Base.logger = Logger.new(STDOUT) | |
| reload! |
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
| @i = 0 | |
| a = "" | |
| def ao | |
| puts @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
| require 'rubygems' | |
| require 'rest_client' | |
| require 'json' | |
| require 'logger' | |
| require 'pp' | |
| class VhackDemo | |
| def self.request(method, path, request_params) | |
| RestClient.log = Logger.new(STDOUT) | |
| url = ['https://', 'demo.socialcast.com', path].join |
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
| // Java example | |
| import java.io.BufferedReader; | |
| import java.io.OutputStreamWriter; | |
| import java.io.InputStream; | |
| import java.io.InputStreamReader; | |
| import java.net.Authenticator; | |
| import java.net.PasswordAuthentication; | |
| import java.net.URL; | |
| import java.net.HttpURLConnection; |
OlderNewer