Skip to content

Instantly share code, notes, and snippets.

default: -r features/support/env.rb -r features/support/plain.rb -r features/step_definitions features/plain --format progress features --tags ~@pending
selenium: -r features/support/env.rb -r features/support/enhanced.rb -r features/step_definitions features/enhanced features/plain --format progress features --tags ~@pending
function precmd() {
echo -ne "\033]2;${PWD##*/}\a" # set window title to the current folder
return
}
function preexec() {
if [ "$1" = "rs" ]; then
echo -ne "\033]6;1;bg;red;brightness;180\a"
echo -ne "\033]6;1;bg;green;brightness;205\a"
echo -ne "\033]6;1;bg;blue;brightness;90\a"
@glennfu
glennfu / git_cheatsheet.md
Created October 30, 2015 17:42
My Git Cheatsheet

Create a remote branch

git pull git push origin master:refs/heads/new_branch git co -b new_branch --track origin/new_branch

Create a remote branch from your current branch

git push origin localbranch:remotebranch

Delete a remote branch

git push origin :remote_branch_name

export S3_ENABLED=true
export THIS_THING="asdf"
class InventoryItem < ActiveRecord::Base
def self.update_kit_ids
search = NetSuite::Records::InventoryItem.search({
criteria: {
basic: [
{
field: 'type',
operator: 'anyOf',
type: 'SearchEnumMultiSelectField',
@glennfu
glennfu / turbolinks.js
Created June 24, 2016 17:13
turbolinks.js to go along with glennfu/turbolinks-rails
@glennfu
glennfu / geokit.rb
Last active July 13, 2016 15:54
I used this to help me parse some locations where the default Geokit wasn't enough
require 'geokit'
module Geokit
module IpGeocodeLookup
# Overriding this to only store for 2 hours instead of 30 days
def store_ip_location
return if params[:lat] && params[:lng]
unless session[:geo_location]
@glennfu
glennfu / geokit_commands.rb
Last active July 13, 2016 15:59
Ways to get data out of geokit calls to Google
def parse_stuff
geoloc = Geokit::Geocoders::GoogleGeocoder3.geocode address.gsub("\n", ", ")
placemark = JSON.parse(geoloc.to_json)
# Sometimes the most accurate entry doesn't have a city, but a less accurate version does
if city.blank? && region.present? && geoloc.respond_to?(:all)
placemark["city"] = geoloc.all.detect(&:city).try(&:city)
end
end

Keybase proof

I hereby claim:

  • I am glennfu on github.
  • I am glennfu (https://keybase.io/glennfu) on keybase.
  • I have a public key ASAVcYf3fpA81yrW6C_8vxGA37B59iFDv2SgKUvAKlXbZQo

To claim this, I am signing this object: