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 parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
| } | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
| } | |
| export PS1='\u@\h \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)\n$ ' | |
| # list remote branches with committer name and email |
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
| response = RestClient.post( | |
| "https://api.surveymonkey.net/v2/surveys/get_survey_list?api_key=#{KEY}", | |
| { fields: ["title", "date_created"] }.to_json, | |
| 'Content-Type' => 'application/json', 'Authorization' => "bearer #{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
| require 'fuzzy_match' | |
| haystack = [ | |
| "Good brain, bad brain: Parkinson's disease", | |
| "Archaeology of Portus: exploring the lost harbour of ancient Rome", | |
| "The secret power of brands", | |
| "The secret power of brands" | |
| ] | |
| matcher = FuzzyMatch.new(haystack) |
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 'fuzzy_match' | |
| require 'date' | |
| require 'ostruct' | |
| haystack = [ | |
| OpenStruct.new( | |
| title: "Good brain, bad brain: Parkinson's disease", | |
| start: Date.parse('24 February 2014'), | |
| slug: 'good-brain-bad-brain-parks'), | |
| OpenStruct.new( |
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
| # put this in your ~/.irbrc | |
| def write_to_file(content, filename = "output.txt") | |
| File.open(filename, 'w') {|f| f.write(content)} | |
| puts "Wrote to #{filename}" | |
| return true | |
| end | |
| # then in an irb console you can do | |
| require 'smithy' | |
| response = ForgeProxy.get('http://some.url/') |
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
| module Cucumber | |
| module Formatter | |
| class Html | |
| def initialize | |
| end | |
| def after_features | |
| puts "original after_features" | |
| end | |
| 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
| PREFIX event: <http://purl.org/NET/c4dm/event.owl#> | |
| PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#> | |
| PREFIX po: <http://purl.org/ontology/po/> | |
| PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
| SELECT ?episode ?broadcast_start ?broadcast_end | |
| WHERE | |
| { ?episode po:version ?version . | |
| ?broadcast po:broadcast_of ?version . | |
| ?broadcast event:time ?time . | |
| ?time tl:start ?broadcast_start . |
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 'sinatra' | |
| require 'omniauth' | |
| require 'pp' | |
| use OmniAuth::Builder do | |
| provider :twitter, '<key>', '<secret>' | |
| end | |
| enable :sessions |
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 'sinatra' | |
| require 'nokogiri' | |
| get '/' do | |
| @thing = 'thing' | |
| nokogiri :index | |
| 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
| class LibbyBot < RTanque::Bot::Brain | |
| NAME = 'libby_bot' | |
| include RTanque::Bot::BrainHelper | |
| TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 1.0 | |
| def tick! | |
| self.move_randomly | |
| if (target = self.nearest_target) |
OlderNewer