Install terminal-notifier
$ gem install terminal-notifier
Then add a new function into your .bashrc or .zshrc
function watch {
$* | set nocompatible " choose no compatibility with legacy vi | |
| set synmaxcol=120 " limit syntax highlighting to first 120 col | |
| set number " line numbers | |
| set colorcolumn=80 | |
| "" Set cursor lines in current window | |
| au WinLeave * set nocursorline nocursorcolumn | |
| au WinEnter * set cursorline cursorcolumn | |
| "" Recognize Markdown files |
Install terminal-notifier
$ gem install terminal-notifier
Then add a new function into your .bashrc or .zshrc
function watch {
$* | #!bin/bash | |
| MSG="$1" | |
| # Add JIRA hyperlinks to the end of the commmit message | |
| # Using ggrep (gnu grep) and | |
| add_JiraUrl() { | |
| # Get all the JIRA numbers from the commit heading e.g., [AIP-2024][APPS-2000] | |
| JIRA=$(cat $MSG | head -n 1 | ggrep -Po '(?<=\[)[A-Z]*[\-]\d*(?=\])') |
| { | |
| "responses.2xx": { | |
| "type": "counter", | |
| "value": 1 | |
| }, | |
| "responses.3xx": { | |
| "type": "counter", | |
| "value": 19 | |
| }, | |
| "responses.4xx": { |
When working with the SuperFeedr REST API it is important to understand the notifications that SuperFeedr will send to your server.
I am using th JSON response here, as the format is familiar and easy to parse using the Ruby API.
After successfully subscribing to a feed, SuperFeedr will send notifications to the callback URI specified during the subscription process.
| =begin | |
| Write a program that prints the numbers from 1 to 100. | |
| But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". | |
| For numbers which are multiples of both three and five print "FizzBuzz". | |
| (http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html) | |
| =end | |
| module FizzBuzz | |
| def self.fizzbuzz(n) | |
| case |
| // Konami code with jQuery. | |
| // Source: http://paulirish.com/2009/cornify-easter-egg-with-jquery/ | |
| var kkeys = [], | |
| konami = "38,38,40,40,37,39,37,39,66,65"; | |
| $(document).keydown(function(evt) { | |
| kkeys.push( evt.keyCode ); | |
| if ( kkeys.toString().indexOf( konami ) >= 0 ){ | |
| $(document).unbind('keydown',arguments.callee); |
| class Obj | |
| attr_accessor :first, :second | |
| def initialize | |
| @first = {:one => 'x',:two => 'y',:three => 'z'} | |
| @second = {[1,2]=>'x',[3,2]=>'o'} | |
| end | |
| end | |
| # Using either dup or clone doesn't make a difference, they both make shallow copies | |
| obj1 = Obj.new |
| class Card | |
| attr_reader :term, :definition | |
| def self.load(filename,cards = []) | |
| File.new(filename).each do |card| | |
| card = card.split("\t") | |
| cards << Card.add_card(card) | |
| end | |
| cards | |
| end |
| require './binary' | |
| describe 'binary_search' do | |
| let(:int_ary) { (100..200).to_a } | |
| let(:strg_ary) { %w{ swedish\ chef miss\ piggy scooter gnu animal foo-foo }.sort } | |
| let(:one_elemnt_ary) { [0] } | |
| it 'returns correct index' do | |
| binary_search(135,int_ary).should eq 35 | |
| binary_search('miss piggy',strg_ary).should eq 3 |