Skip to content

Instantly share code, notes, and snippets.

@inopinatus
inopinatus / hstore_accessor.rb
Last active Feb 22, 2019
hstore accessor class method for AR
View hstore_accessor.rb
# include from an initializer
module HstoreAccessor
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def hstore_accessor(hstore_attribute, *keys)
Array(keys).flatten.each do |key|
@haveaguess
haveaguess / HSBC.js
Created Oct 8, 2016 — forked from benjie/HSBC.js
HSBC Personal Statement to CSV
View HSBC.js
/******************************
HSBC Personal Statement to CSV
v0.5
Copyright: Benjie Gillam (2012)
License: WTFPL v2.0 ( http://en.wikipedia.org/wiki/WTFPL )
Instructions:
Add the following bookmarklet to your browser:
@justinmayer
justinmayer / Menlo-for-Powerline.zip
Last active Sep 20, 2019
Menlo font, patched for Powerline. Includes regular, bold, italic, and bold italic variants.
@panuta
panuta / gist:1852087
Last active Apr 8, 2020
How to setup Django/Postgresql on OS X Mountain Lion using Homebrew
View gist:1852087

Command Line Tools for Xcode

Command line tools comes bundle with Xcode prior to 4.3 version. After 4.3, you need to install a separated command line tools yourself.

First, go to this url and login using Apple Developer account (Free to register)

https://developer.apple.com/downloads/index.action
@philipbelesky
philipbelesky / moult.py
Created Nov 23, 2015
Traverses a Grasshopper XML definition(.ghx) and extracts VB/C#/Python components to separate individual .vb/.cs/.py files
View moult.py
from xml.etree.ElementTree import ElementTree
import os
def ProcessGHXFile(definition_path, base_filename):
# Loads the file and sets up the XML parser
the_file = open(definition_path)
the_directory = os.path.dirname(definition_path)
the_tree = ElementTree()
the_tree.parse(the_file)
IsolateTheScript(the_tree, the_directory, base_filename)
@adrianhall
adrianhall / AppSyncAPI.yaml
Last active Nov 17, 2020
A CloudFormation template for DynamoDB + Cognito User Pool + AppSync API for the Notes tutorial
View AppSyncAPI.yaml
---
Description: AWS AppSync Notes API
Parameters:
APIName:
Type: String
Description: Name of the API - used to generate unique names for resources
MinLength: 3
MaxLength: 20
AllowedPattern: '^[a-zA-Z][a-zA-Z0-9_]*$'
@masyukun
masyukun / recipeTools.js
Last active Jan 3, 2021
JavaScript functions to work with exported Cronometer recipes
View recipeTools.js
/**
* Recipe Tools v0.1
*
* This version exists as a GitHub Gist at https://gist.github.com/masyukun/64a3490a464acaa3b9af6819f10dfbf4
*
* @license
* Copyright (c) 2020 Matthew Royal
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@tomysmile
tomysmile / node-setup-pm2-nginx.md
Last active Mar 6, 2021
Setup NodeJS Production with PM2, Nginx in Ubuntu 16.04
View node-setup-pm2-nginx.md

How To Set Up a Node.js Application for Production on Ubuntu 16.04

with PM2 & Nginx

Create User

as a root, run below commands on server:

# adduser tomy
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active May 6, 2021
A Ruby script for collecting phone record statistics from a Facebook user data dump
View facebook-contact-info-summary.rb
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@joeblau
joeblau / git yolo
Created Feb 3, 2014
git yolo command
View git yolo
alias gityolo='git commit -am "DEAL WITH IT" && git push -f origin master'