Skip to content

Instantly share code, notes, and snippets.

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@igrigorik
igrigorik / github.bash
Last active December 22, 2023 23:55
Open GitHub URL for current directory/repo...
alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
@maxjacobson
maxjacobson / array_pet_peeve.rb
Last active December 29, 2015 00:09
I was always pet peeved that Array#second didn't exist when Array#first and Array#last do wouldn't this be fun? haha
# gem install numbers_in_words
require 'numbers_in_words'
require 'numbers_in_words/duck_punch'
class Array
def method_missing(m)
self[m.to_s.gsub(/\_/, ' ').in_numbers - 1]
end
end
@brendajin
brendajin / gist:8190614
Last active January 1, 2016 19:29
New Year's Resolutions for the Burgeoning Self-Taught Female Hacker

#New Year's Resolutions for the Burgeoning Self-Taught Female Hacker

Last January, I attended my first hackathon and commited to learning to code. Fast forward to May, and I landed my first full-time position as a Developer.

When people ask me how I did it, I always say that the most challenging aspect of a career transition is psychological. The technical learning can be done with elbow grease, but no career transition is possible without psychological fortitude.

Along the way, there will be self-doubt, hundreds of rejected job applications, cold recruiters, and days when you feel like your goal is too far beyond your reach. To this, I say: you can do it.

So in light of the new year, I've put together a non-prescriptive list to inspire your 2014 resolutions. If you are a burgeoning self-taught female hacker: you go, girl.

@fzakaria
fzakaria / lambda_cloudsearch.js
Last active March 13, 2024 19:15
Send CloudTrail events to CloudSearch with AWS Lambda
console.log('Loading event');
var CLOUDSEARCH_ENDPOINT = < INSERT HERE >
var async = require('async');
var jpath = require('json-path')
var zlib = require('zlib');
var aws = require('aws-sdk');
var s3 = new aws.S3({
apiVersion: '2006-03-01'
});
@ryanfitz
ryanfitz / indexAccountsToCloudsearch.js
Created July 17, 2015 18:46
index dynamodb data to cloudsearch using AWS Lambda
var AWS = require('aws-sdk');
exports.handler = function(event, context) {
var cloudsearchdomain = new AWS.CloudSearchDomain({endpoint: 'doc-dev-cinch-accounts-ltmqj5gt5mjb5hg5eyqaf2v5hu.us-east-1.cloudsearch.amazonaws.com'});
var documents = event.Records.map(function(record) {
var data = {id : record.dynamodb.Keys.id.S};
if (record.eventName === 'REMOVE') {
data.type = 'delete'
import cv2, numpy as np
FIELD_CORNERS = (
(153, 36), (456, 37),
(74, 461), (518, 460)
)
def get_ball_template():
template = np.zeros((22, 22), dtype=np.uint8)
cv2.circle(template, (11, 11), 11, 255, -1)