- Go to Digital Ocean
- Create new droplet
- London
- Ubuntu
- No apps
- Add SSH keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# manually download and "install" a given mix dep for non-elixir environment | |
# | |
# for example, download phoenix in a frontend build stage to get JS deps | |
depname=$1 | |
version=$(grep "\"$depname\"" mix.lock | cut -d, -f 3 | sed -e 's/ *"//g') | |
echo "installing $depname version $version..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dqData=[]; | |
dqData.push({title:'Product Groups', | |
mean:0.0393, | |
dP:[ | |
['GROUP01',-0.0435,32937], | |
['GROUP10',-0.2651,132], | |
['GROUP11',-0.0694,1164], | |
['GROUP12',0.0345,17127], | |
['GROUP13',-0.0288,8858], | |
['GROUP18',-0.3741,46], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -print0 | xargs -0 ls -l | awk '{ n=int(log($5)/log(2)); if (n<10) { n=10; } size[n]++ } END { for (i in size) printf("%d %d\n", 2^i, size[i]) }' | sort -n | awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) } } { a[1]=$1; a[2]=0; human(a); printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# OMG THIS CODE IS SO UGLY | |
# but... | |
# IT WORKS!! | |
# | |
# Hacked together by http://github.com/marcinbunsch | |
# | |
# This assumes the following: | |
# - That you're on a Mac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<button id="the-button">Hey</button> | |
</div> | |
<script> | |
$(document).on('click', '#the-button', function(e) { | |
// handler is bound to document, but only fires if event originated from #the-button | |
}) | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is responsible for configuring your application | |
# and its dependencies with the aid of the Mix.Config module. | |
# | |
# This configuration file is loaded before any dependency and | |
# is restricted to this project. | |
use Mix.Config | |
# Configures the namespace used by Phoenix generators | |
config :my_app, | |
app_namespace: MyApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HideDeleted | |
def hide_deleted | |
scope :existing, -> { where(deleted_at: nil) } | |
scope :deleted, -> { where('deleted_at IS NOT NULL') } | |
define_method :deleted? do | |
deleted_at.present? | |
end | |
define_method :destroy do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# usage: | |
# ./unsafe_chrome.sh Developer #=> creates a "Google Chrome Developer" app | |
PROFILE_NAME=$1 | |
mkdir -p "/Applications/Google Chrome $1.app/Contents/MacOS" | |
F="/Applications/Google Chrome $1.app/Contents/MacOS/Google Chrome $1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
segment = Segment::TwitterFollowers.create( | |
name: "Demo Twitter Followers Segment #{ timestamp }", | |
account: account, | |
client: client, | |
definition_data: "@nike\n" | |
) | |
VS |