Skip to content

Instantly share code, notes, and snippets.

View RaVbaker's full-sized avatar
drinking coffee

Rafal Piekarski RaVbaker

drinking coffee
View GitHub Profile
@kenrett
kenrett / Selenium Cheat Sheet.md
Last active July 31, 2024 20:56
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@benmj
benmj / geocoder-service.js
Created August 29, 2013 16:38
An AngularJS Service for intelligently geocoding addresses using Google's API. Makes use of localStorage (via the ngStorage package) to avoid unnecessary trips to the server. Queries Google's API synchronously to avoid `google.maps.GeocoderStatus.OVER_QUERY_LIMIT`
/*global angular: true, google: true, _ : true */
'use strict';
angular.module('geocoder', ['ngStorage']).factory('Geocoder', function ($localStorage, $q, $timeout) {
var locations = $localStorage.locations ? JSON.parse($localStorage.locations) : {};
var queue = [];
// Amount of time (in milliseconds) to pause between each trip to the
@jelbourn
jelbourn / api-provider.js
Last active February 25, 2024 12:51
Example of using an angular provider to build an api service. Subject of August 20th 2013 talk at the NYC AngularJS Meetup. http://www.meetup.com/AngularJS-NYC/events/134578452/See in jsbin: http://jsbin.com/iWUlANe/5/editSlides: https://docs.google.com/presentation/d/1RMbddKB7warqbPOlluC7kP0y16kbWqGzcAAP6TYchdw
/**
* Example of using an angular provider to build an api service.
* @author Jeremy Elbourn (@jelbourn)
*/
/** Namespace for the application. */
var app = {};
/******************************************************************************/
@mfojtik
mfojtik / rack_profile.rb
Created October 18, 2012 15:46
Prototype of rack-profiler - a Rack middlerware to track Ruby malloc_allocations
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
require 'tracer'
Tracer.add_filter do |event, file, line, id, binding, klass, *rest|
@thibautsacreste
thibautsacreste / rack_show_session.rb
Last active March 12, 2021 13:43
Ruby: decode rack session cookie
require 'base64'
require 'cgi'
def show_session(cookie)
Marshal.load(Base64.decode64(CGI.unescape(cookie.split("\n").join).split('--').first))
end
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 15, 2025 05:11
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@yashke
yashke / gist:2134480
Created March 20, 2012 12:03
google spreadsheet example
require 'rubygems'
require 'google_spreadsheet'
session = GoogleSpreadsheet.login("[email protected]", "kakadada")
spreadsheet = session.spreadsheet_by_key("0AlG-njvmBdlJdENlMzlVR3hTYUo1ZGhnck1NSm0yT3c")
ws = spreadsheet.worksheets[0]
ws[1, 1] = "Cześć"
ws[1, 2] = "Czołgiem"
ws.save
@jewilmeer
jewilmeer / RubyTest.sublime-build
Created January 6, 2012 12:08
Sublime 2 with .rvmrc loading
// This file lives @ /Library/Application Support/Sublime Text 2/Packages/User/RubyTest.sublime-build
{
"ruby_unit_exec": "~/bin/rvm_ruby ruby -Itest",
"ruby_cucumber_exec": "~/bin/rvm_ruby cucumber --no-color",
"ruby_rspec_exec": "~/bin/rvm_ruby rspec",
"ruby_unit_folder": "test",
"ruby_cucumber_folder": "features",
"ruby_rspec_folder": "spec"
}
@RaVbaker
RaVbaker / iOS5_update_checker.command
Created October 12, 2011 15:40
iOS5 software update notifier
#! /bin/csh
while (1)
curl -s -L http://phobos.apple.com/version | grep -i Restore | grep -i "\(iPhone\|iPad\|iPod\)" | grep -i "5\.0"
if ($? == 1) then
echo "Nothing yet..."`date`
else
say "iOS FIVE POINT OH FIRMWARE IS NOW AVAILABLE"
endif
sleep 13
end