Skip to content

Instantly share code, notes, and snippets.

View dharamgollapudi's full-sized avatar

Dharam Gollapudi dharamgollapudi

  • Atlassian
  • San Francisco Bay Area, CA
View GitHub Profile

Capybara

save_and_open_page

Matchers

have_button(locator)
@dharamgollapudi
dharamgollapudi / README.md
Created October 12, 2013 19:48 — forked from nikcub/README.md
fb index.php and search.php
@dharamgollapudi
dharamgollapudi / Bench
Created October 12, 2013 23:28 — forked from joaodrp/Bench
(sinatra + thin) vs. goliath
# Simple web service that looks for an image metadata record on a MySQL db given its ID and sends it back in JSON
#
# Ruby 1.9.3
# All gems updated to the most recent version
# MBP i5 8gb Lion
#
# See source code above, combo is:
# Sinatra + Thin:
# - mysql_db.rb # mysql2 api class
# - sinatra_thin_server.rb
@dharamgollapudi
dharamgollapudi / gist:7258885
Last active December 27, 2015 03:19 — forked from philfreo/gist:7257723
(https://gist.github.com/philfreo/7257723) Facebook Perl source code from 2005. When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains…
#!/usr/bin/perl
use Mysql;
use strict;
use vars qw($school_name);
use vars qw($pass);
require "./cgi-lib.pl";
ENV["WATCHR"] = "1"
system 'clear'
def growl(message)
growlnotify = `which growlnotify`.chomp
title = "Watchr Test Results"
puts message
image = message.match(/\s0\s(errors|failures)/) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)
# Typically in Rails to use VCR we setup the RSpec config like so:
RSpec.configure do |config|
config.extend VCR::RSpec::Macros #deprecated
end
# This gives us access to the use_vcr_cassette method:
describe Reviewed::Article do
use_vcr_cassette 'article/grill'
end
module Saucelabs
SAUCE_USERNAME = ''
SAUCE_TOKEN = ''
def self.setup_saucelabs_connection!(driver=nil)
WebMock.allow_net_connect!
driver ||= {
capability: :chrome,
platform: 'Windows 8',
version: '',
namespace :routes do
desc "Writes doc/routes.html. Requires Graphviz (dot)"
task :visualizer => :environment do
File.open(Rails.root.join('doc', 'routes.html'), 'wb') do |f|
f.write Rails.application.routes.router.visualizer
end
end
end

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dharamgollapudi
dharamgollapudi / gist:1cd1da821b9a1aa908d3
Created October 7, 2015 18:24 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat