Skip to content

Instantly share code, notes, and snippets.

View shinzui's full-sized avatar
👨‍💻

Nadeem Bitar shinzui

👨‍💻
  • Los Angeles / San Francisco
  • X @shinzui
View GitHub Profile
#!/usr/bin/env python
# This is a trick, to output the bash commands we need to run in shell, and just execute this script inside an eval within our shell, so it imports what we need
# Possibly tie this in with https://gist.github.com/mbainter/b38a4cb411c0b5c1bae6 for MFA support
# Will need to durably store MFA access tokens, possibly in some other env vars
# Could also store all different keys/info in different vars, to reuse as needed (lots of env vars though, file may be better)
import os
import sys
import getpass
if (
process.env.NODE_ENV === 'production' &&
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ &&
Object.keys(window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers).length
) {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers = {}
}
/**
* Required Variables.
*/
variable "name" {}
variable "port" {}
variable "elb_security_group" {}
variable "elb_subnets" {}
@shinzui
shinzui / factories.rb
Created December 10, 2009 02:01 — forked from technicalpickles/factories.rb
Factory Girl Attachments
Factory.define :application do |factory|
factory.attachment(:sample, "public/samples/sample.doc", "application/msword")
end
@shinzui
shinzui / filter microsoft word special characters
Created April 24, 2010 18:23 — forked from eculver/filter microsoft word special characters
Filter microsoft word special characters
import re
def convert_1252_codes(text):
"""Convert windows-1252 characters to appropriate html entities.
@param str String to filter
@type string/unicode
@return unicode version of filtered string
Adapted from: http://effbot.org/zone/unicode-gremlins.htm
@shinzui
shinzui / postgres-upgrade-recipe.sh
Created January 21, 2016 19:14 — forked from eoinkelly/postgres-upgrade-recipe.sh
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
#!/bin/bash
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
@shinzui
shinzui / FP_Observables.js
Created January 19, 2016 21:20 — forked from yelouafi/FP_Observables.js
Observables with pure FP
// Observable is an Union Type, with the following variants
const Empty = () => ['EMPTY']
const Cons = (head, tail) => ['CONS', head, tail]
const Future = promise => ['FUTURE', promise]
// race between 2 promises; each promise will resolve to a lazy value
const lazyRace = (p1, p2) => Promise.race([p1,p2]).then(lazy => lazy())
// function composition
const compose = (...fns) => (arg) => fns.reduceRight((res, f) => f(res), arg)
@shinzui
shinzui / README.md
Created January 14, 2016 17:36 — forked from Dr-Nikson/README.md
Auth example (react + redux + react-router)
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end
=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')