Skip to content

Instantly share code, notes, and snippets.

View mixmix's full-sized avatar

mix irving mixmix

View GitHub Profile
@mixmix
mixmix / gist:27cf191e80d5751f9611
Last active August 29, 2015 14:23
Webpunch snippets
heroku pg:backups capture -a webpunch
curl -o latest.dump `heroku pg:backups public-url -a webpunch`
dropdb webpunch_development
createdb webpunch_development
pg_restore --verbose --clean --no-acl --no-owner -d webpunch_development latest.dump
------
def call
data_lines.each do |line|
line_cols = split_line_into_cols(line)
raise "Error!!!" if line_cols.count != column_names.count
customer_hash = build_hash(line_cols, customer_attributes)
sale_hash = build_hash(line_cols, sale_attributes)
customer = create_or_update_customer( customer_hash )
print "*" if Rails.env.development?
cr_last_week = CustomerReview.where('created_at > ?', Time.now - 7.days)
cr_naughty_location_ids = CustomerReview.where('last_response_date > ?', Date.today).where('created_at > ?', Time.now - 7.days).group(:location_id).count.keys
results = cr_naughty_location_ids.map do |loc_id|
crs = cr_last_week.where(location_id: loc_id)
naughty_crs = crs.where('last_response_date > ?', Date.today)
[Location.find(loc_id).full_name, naughty_crs.count, crs.count]
end
[154371, 154372, 154373, 156108, 156109, 156110, 155707, 155766, 155767, 155768, 155769, 155885, 155886, 155887, 155888, 155889, 155890, 155891, 155892, 155893, 155894, 155895, 155896, 155897, 155898, 155899, 155900, 155901, 155902, 155903, 155904, 155905, 155906, 156017, 156018, 156078, 156079, 156080, 156081, 156082, 156083, 156084, 156085, 156086, 156087, 156088, 156089, 156090, 156091, 156092, 156093, 154325, 154326, 154327, 154328, 154329, 154330, 154331, 154332, 154333, 154334, 154335, 154336, 154337, 154338, 154339, 154340, 154341, 154342, 154370, 154343, 154344, 154345, 154346, 154347, 154348, 154349, 154350, 154351, 154352, 154353, 154354, 154355, 154356, 154357, 154358, 154359, 154360, 154361, 154362, 154363, 154364, 154365, 154366, 154367, 154368, 154369, 154374, 154375, 154376, 154377, 154378, 154379, 154410, 154380, 154381, 154382, 154383, 154384, 154385, 154386, 154387, 154388, 154389, 154390, 154391, 154392, 154393, 154394, 154395, 154396, 154397, 154398, 154399, 154400, 154401, 154402, 154403,
@mixmix
mixmix / retreat.md
Last active October 22, 2015 00:45

The next Enspiral retreat is about taking it to a whole new level!

castle point photo

A summer festival! See: retreat.enspiral.com

This ongoing savings bucket is about saving to make sure the retreat is awesome and affordable - we've already saved $820 out of $2250 needed!

Examples of things this will help make happen :

@mixmix
mixmix / mixit.rb
Created November 4, 2015 06:07
for processing tsv form responses into a more useful csv
file_name = "./Tech for Non-tech (Responses) - Form responses 1.tsv"
file = File.new(file_name, "r")
lines = file.each_line.to_a
file.close
new_cols = []
lines.each do |line|
next if line =~ /^Timestamp/
selections = line.split(/\t/)[2].

run this script in rails console:

admin_email = EMAIL_ADDRESS_ASSOCIATED_WITH_ONE_OF_YOUR_ADMIN_ACCOUNTS
user_email = ONE_OF_YOUR_ALTERNATE_EMAIL_ADDRESSES

## mix's case :
admin_email = '[email protected]' 
user_email = '[email protected]'
@mixmix
mixmix / bash
Created April 18, 2016 00:06
linux node dev env
sudo apt-get update && apt-get install git curl zsh
# get oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# make sure zsh is the default shell
# get nvm: https://github.com/creationix/nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
# copy the nvm stuff to your .zshrc
@mixmix
mixmix / node_dev_env.md
Last active November 21, 2016 22:49
node dev env

linux

install basic tools. In terminal :

sudo apt-get update
sudo apt-get install curl git zsh build-essential

SOMETHING TO SAY #YES# TO

Platform Society

Economy w/ an internet > an internet w/ economy Yet along a familiar curve: https://is.gd/tpsz1E

Where are we along it now?