Skip to content

Instantly share code, notes, and snippets.

View marclundgren's full-sized avatar

Marc Lundgren marclundgren

View GitHub Profile
@marclundgren
marclundgren / fibonacci-iterative.js
Last active November 23, 2016 03:18
fibonacci algorithms (recursive and iterative)
function fib(num) {
if (num === 0) {
return 0
}
if (num === 1 || num === 2) {
return 1
}
let a = 1
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
clickOutside(event) {
const $target = Ember.$(event.target);
const clickedOutside = typeof $target.data('outside') !== 'undefined';
alert("Clicked outside: " + (clickedOutside ? "yes" : "no"));
},
// IFEE
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript#Functions
var message = 'hello IFEE';
(function(arg1) {
console.log(arg1);
});
#!/usr/bin/env python
from subprocess import call
import sys
# Taken from http://stackoverflow.com/questions/377017/test-if-executable-exists-in python
def which(program):
import os
def is_exe(fpath):
return os.path.exists(fpath) and os.access(fpath, os.X_OK)

Useful Shortcuts (Mac OS X)

General

Shortcut Command
@marclundgren
marclundgren / os-x-configuration.md
Last active January 2, 2016 16:09 — forked from g3d/gist:2709563
OS X Configuration
@marclundgren
marclundgren / setup-my-computer.sh
Last active January 2, 2016 01:48
setup my computer
# Download Apps
# Chrome, Sublime Text, Adium, iTerm2, Disk Inventory X
# install Xcode ... manually..
# then get Command Line Tools https://developer.apple.com/downloads/index.action
# oh my zsh
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
# node
# Set Up Your Sound Card
aplay -l &&
alsamixer
speaker-test &&
cd /etc/modprobe.d &&
echo "Look for this line && comment out: options snd-usb-audio index=-2"
sudo nano alsa-base.conf
@marclundgren
marclundgren / 3gods.js
Last active December 29, 2015 03:39
3 gods, true, false, random
/*
Three gods A, B, and C are called, in no particular order, True, False, and Random.
True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a completely random matter.
The gods understand English, but will answer all questions in their own language, in which the words for yes and no are da and ja, in some order. You do not know which word means which.
*/
(function() {
.-'---`-.
,' `.
| \
| \
\ _ \
,\ _ ,'-,/-)\
( * \ \,' ,' ,'-)
`._,) -',-')
\/ ''/
) / /