Skip to content

Instantly share code, notes, and snippets.

@pinglamb
pinglamb / README.md
Last active December 21, 2015 20:38 — forked from yachi/install.sh
  • $ brew install git-flow
  • $ brew uninstall git
  • $ brew install git --without-completions
  • enable git-flow in oh my zsh plugin
  • restart zsh
  • $ git flow init
  • $ git flow feature start myFeature
  • $ git commit -a
  • $ git commit -a
  • $ git flow feature finish myFeature
@pinglamb
pinglamb / tennison.js
Created May 5, 2014 07:37
Tennison Bookmarklet
javascript:var%20s=document.createElement('script');s.setAttribute('src',%20'http://code.jquery.com/jquery.js');document.getElementsByTagName('body')[0].appendChild(s);void(s);$("img").attr("src", "http://lh4.googleusercontent.com/-RmrZDM1BSbk/U2bwuAKC6VI/AAAAAAAAD_I/PgK91Uc24xM/w456-h335-no/20140502_202731_852.jpg");
@pinglamb
pinglamb / constant_helper.rb
Created January 27, 2015 02:32
Rspec Constant Redefine Helper
module ConstantHelper
def redefine_constant(namespace, const_name, new_value)
namespace.send(:remove_const, const_name) if namespace.const_defined?(const_name)
namespace.const_set(const_name, new_value)
end
end
@pinglamb
pinglamb / changelog.rb
Created February 26, 2015 10:21
Changelog class for per user changes dialog
class Changelog
# Put your available versions in the array, in reverse release order, e.g. %w(1.1 1.0 0.9.9999999)
VERSIONS = %w().freeze
class << self
# e.g. Changelog.after('1.0')
def after(version)
changes = Changelog.new
if index = VERSIONS.index(version)
VERSIONS[0...index].collect {|v| changes[v] }.flatten
@pinglamb
pinglamb / reproduction.diff
Last active August 29, 2015 14:16
Rails Issue #19192 - reproduction script diff
diff --git a/produce.rb b/produce.rb
index 9c531f3..ad34718 100644
--- a/produce.rb
+++ b/produce.rb
@@ -31,10 +31,11 @@ ActiveRecord::Schema.define do
create_table :post_tags, force: true do |t|
t.integer :post_id
t.integer :tag_id
+ t.datetime :created_at
end
@pinglamb
pinglamb / ddns-start
Created June 12, 2016 11:00
Cloudflare ASUS Custom DDNS Script
#!/bin/sh
EMAIL= # Your Email
ZONEID= # Your zone id, hex16 string
RECORDID= # You DNS record ID, hex16 string
RECORDNAME= # Your DNS record name, e.g. sub.example.com
API= # Cloudflare API Key
IP=${1}
curl -fs -o /dev/null -XPUT "https://api.cloudflare.com/client/v4/zones/$ZONEID/dns_records/$RECORDID" \
@pinglamb
pinglamb / rails_server
Last active June 21, 2016 10:00
Control remote app like a charm
#!/usr/bin/env bash
# Dependencies:
# - inotify-tools
MY_PIDFILE=tmp/pids/my.pid
PUMA_PIDFILE=tmp/pids/puma.pid
case $1 in
"start")
@pinglamb
pinglamb / data.json
Last active July 25, 2016 19:24
happypotter.io
{
"import_token": "4hSPTrQia5GqfmKm442Rzy7c",
"data": [
{
"sku": "P300-1",
"name": "T-Shirt",
"category": "Fashion",
"price": 399,
"stock": 24
},
@pinglamb
pinglamb / Dockerfile
Created August 8, 2016 03:01
Rails Docker Deployment
FROM ensogo/passenger-ruby23:0.9.18
MAINTAINER developers@ensogo.com
ENV HOME /root
CMD ["/sbin/my_init"]
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN apt-get update
# Upgrade Passenger