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 worstFunctionEver = function (badArg) { | |
while (1) { | |
if (badArg == "hello") { | |
console.log("worst code ever"); | |
} | |
} | |
} |
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
func test() -> String { | |
func innerTest(n: Int) -> String { | |
if n == 0 { | |
return "Blast off" | |
} | |
return innerTest(n - 1) | |
} | |
return innerTest(10) | |
} |
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
func yas(numOfAs: Int) -> String { | |
var ret = "y" | |
for i in 1...numOfAs { | |
ret += "a" | |
} | |
return ret + "s" | |
} | |
yas(10) |
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
package db | |
import ( | |
"fmt" | |
"github.com/eaigner/jet" | |
_ "github.com/lib/pq" | |
) | |
var ( | |
Db *jet.Db |
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 addTwo = function(x, y) { | |
if (typeof(x) != "number" || typeof(y) != "number") { | |
//log it and bail | |
} | |
}; |
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
// The first three are strings, the last is a number | |
"1" + "2" = "12"; | |
"1" + 2 = "12"; | |
1 + "2" = "12"; | |
1 + 2 = 3; | |
// These are all numbers | |
"1" - 2 = -1; | |
"1" - "2" = -1; | |
1 - "2" = -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
function! LicenseGenerator() | |
let date = strftime("%c") | |
call search("# encoding: utf-8") | |
return "# Created by Chuck Ha on " . date . "\n# Copyright (c) 2012 Safari Books Online, LLC. All rights reserved.\n\n" | |
endfun | |
nmap <silent> ,li "=LicenseGenerator()<CR>p |
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
function! LicenseGenerator() | |
let date = strftime("%c") | |
if &ft == "javascript" | |
return "/*jslint bitwise: true, browser: true, eqeqeq: true, immed: true, newcap: true, regexp: true, nomen: false, onevar: false, undef: true, plusplus: false, white: true, indent: 2 */\n/*global confirm define interpolate gettext console */\n\n// Created by Matthew Irish (mirish@safaribooksonline.com) on " . date . "\n/*! Copyright (c) 2012 Safari Books Online, LLC. All rights reserved.*/\n\n" | |
endif | |
if &ft == "python" | |
return "# encoding: utf-8\n\n# Created by Chuck Ha (chuck@safaribooksonline.com) on" . date . "\n# Copyright (c) 2012 Safari Books Online, LLC. All rights reserved.\n\n" | |
endif | |
endfun |
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
name "base" | |
description "A base role for all safarilab nodes" | |
run_list( | |
# Add recipes or roles here | |
"recipe[build_essential]" | |
) |
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(fizzbuzz). | |
-export([fizzbuzz/1]). | |
-define(MOD_THREE, "fizz"). | |
-define(MOD_FIVE, "buzz"). | |
% Helper function to map fizzbuzz across a sequence of numbers | |
fizzbuzz(To) -> | |
lists:map(fun nt/1, lists:seq(1, To)). |
OlderNewer