Skip to content

Instantly share code, notes, and snippets.

@ewalk153
ewalk153 / feature-branch.bash
Created February 19, 2015 16:13
Steps to merge a long running feature branch, using a squash
steps to squash and merge a lot running feature branch:
# on feature branch {guest-crm}, make a clean space to play
git checkout guest-crm
git checkout -b package-guest-crm
# here, find a commit before the first you want to use in the squash
git rebase -i 1f98b7a26a9874105
# on this screen, keep the first commit as "pick", for everything below, switch pick to s or squash
# save
@ewalk153
ewalk153 / plug-ins
Last active August 29, 2015 14:16
Sublime setups
https://github.com/eddorre/SublimeERB
https://github.com/wesf90/rails-partial
https://github.com/pavelpachkovskij/sublime-html-to-haml
https://github.com/sobstel/SyncedSideBar
rubocop (maybe, can be slow)
@ewalk153
ewalk153 / fix_images.rb
Created June 5, 2015 16:21
Console script to find bad paperclip image uploads and fix them.
def head_status(u)
uri = URI(u)
Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
request = Net::HTTP::Head.new uri
response = http.request request # Net::HTTPResponse object
response.code
end
end
{ :admin =>
{
role: Role.create(name: 'admin'),
asdf: 'asdf'
}
:staff =>
{
}
:concierge =>
# http://stackoverflow.com/questions/19991445/run-an-ols-regression-with-pandas-data-frame
import pandas as pd
import statsmodels.formula.api as sm
df = pd.DataFrame({"A": [10,20,30,40,50], "B": [20, 30, 10, 40, 50], "C": [32, 234, 23, 23, 42523]})
result = sm.ols(formula="A ~ B + C", data=df).fit()
print result.params
print result.summary()
@ewalk153
ewalk153 / ca.conf
Created September 21, 2015 01:12
Setup command to generate X509 keys for Xero.
[ req ]
prompt = no
default_bits = 2048
default_keyfile = flatbook.co.key
encrypt_key = no
distinguished_name = req_distinguished_name
#string_mask = utf8only
#req_extensions = v3_req
@ewalk153
ewalk153 / array_change.go
Created July 6, 2012 14:07
Change from []Struct to []Interface in go
package main
type Box interface {
Width() int
}
type Square struct {
w int
}
@ewalk153
ewalk153 / bufioEx.go
Created July 23, 2012 07:32
Bufio example
package main
import (
"bufio"
"fmt"
"os"
"time"
)
/* simple go app showing the use of a buffered writer */
@ewalk153
ewalk153 / woot.rb
Created April 8, 2013 16:39
Https example...
require 'net/http'
require 'net/https'
class Woot
def foo
uri = URI.parse("https://www.google.fr/?q=example")
https = Net::HTTP.new(uri.host,uri.port)
https.use_ssl = true
req = Net::HTTP::Get.new(uri.path)
res = https.request(req)
@ewalk153
ewalk153 / config.ru
Last active December 16, 2015 00:09
quick script to accept post data
require 'rubygems'
require './post'
run Sinatra::Application