Skip to content

Instantly share code, notes, and snippets.

// Bonfire: Exact Change
// Author: @vmlinz
// Challenge: http://www.freecodecamp.com/challenges/bonfire-exact-change?solution=function%20drawer(price%2C%20cash%2C%20cid)%20%7B%0A%20%20var%20cashes%20%3D%20%5B%5B%22PENNY%22%2C%200.01%5D%2C%20%5B%22NICKEL%22%2C%200.05%5D%2C%20%5B%22DIME%22%2C%200.10%5D%2C%20%5B%22QUARTER%22%2C%200.25%5D%2C%20%5B%22ONE%22%2C%201.00%5D%2C%20%5B%22FIVE%22%2C%205.00%5D%2C%20%5B%22TEN%22%2C%2010.00%5D%2C%20%5B%22TWENTY%22%2C%2020.00%5D%2C%20%5B%22ONE%20HUNDRED%22%2C%20100.00%5D%5D.reduce(function%20(hash%2C%20elem%2C%20index)%20%7B%0A%20%20%20%20hash%5Belem%5B0%5D%5D%20%3D%20elem%5B1%5D%3B%0A%20%20%20%20return%20hash%3B%0A%20%20%7D%2C%20%7B%7D)%3B%0A%20%20var%20change%3B%0A%20%20%2F%2F%20Here%20is%20your%20change%2C%20ma%27am.%0A%20%20var%20result%20%3D%20cash%20-%20price%3B%0A%20%20var%20total%20%3D%20cid.reduce(function%20(p%2C%20c)%20%7B%0A%20%20%20%20return%20p%20%2B%20c%5B1%5D%3B%0A%20%20%7D%2C%200.0).toFixed(2)%3B%0A%0A%20%20if%20(result%20%3E%20total)%0A%20%20%20%20return%20
@vmlinz
vmlinz / osx-10.9-setup.md
Created October 29, 2015 04:35 — forked from kevinelliott/osx-10.9-setup.md
Clean Install – Mac OS X 10.9 Mavericks

Mac OS X 10.9 Mavericks

Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store

@vmlinz
vmlinz / gist:28f01682ed46c020568b
Created October 23, 2015 14:06 — forked from jordelver/gist:3073101
Set the Mac OS X SOCKS proxy on the command line

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

@vmlinz
vmlinz / README.md
Created October 8, 2015 13:35
LNMP + docker compose split

Docker Compose up to three containers - Bolt.cm example

Make sure to check out ross's approach!

Docker let's you overcome hypervisors. So let's check it out:

## docker-compose.yml
php:
  image: doerty/fpm  # see below
@vmlinz
vmlinz / wporg-theme-developer-handbook-intro.md
Last active September 21, 2015 14:12 — forked from philiparthurmoore/wporg-theme-developer-handbook-intro.md
The WordPress.org Theme Developer Handbook Introduction

[Note: The style that follows is what I would consider "somewhat conversational American English". Please feel free to edit at will to fit the overall needs of the Theme Developer Handbook introduction.]

[Note: It might make sense to put the "Your First Theme" section just underneath the "Getting Started with WordPress Theme Development" introduction text to give new theme developers an immediate sense of accomplishment for making their first theme.]

Getting Started with WordPress Theme Development

[TODO: Introduction Text]

The GPL

@vmlinz
vmlinz / introrx.md
Last active August 27, 2015 05:11 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
@vmlinz
vmlinz / 1readme.md
Last active August 29, 2015 14:26 — forked from jszmajda/1readme.md
Data Serialization: JSON, MsgPack, ProtoBufs
@vmlinz
vmlinz / .editorconfig
Last active August 29, 2015 14:25 — forked from rafamaciel/.editorconfig
Basic configuration of editorconfig to work with python
;
; Global Editor Config for Adaptive Labbers
;
; This is an ini style configuration. See http://editorconfig.org/ for more information on this file.
;
; Top level editor config.
root = true
; Always use Unix style new lines with new line ending on every file and trim whitespace
[*]
end_of_line = lf
@vmlinz
vmlinz / IPSecDemo.m
Last active August 29, 2015 14:22 — forked from zqqf16/IPSecDemo.m
- (void)viewDidLoad
{
[super viewDidLoad];
// init VPN manager
self.vpnManager = [NEVPNManager sharedManager];
// load config from perference
[_vpnManager loadFromPreferencesWithCompletionHandler:^(NSError *error) {