This file contains hidden or 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 hidden or 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 hidden or 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 ([email protected]) 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 ([email protected]) on" . date . "\n# Copyright (c) 2012 Safari Books Online, LLC. All rights reserved.\n\n" | |
endif | |
endfun |
This file contains hidden or 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 hidden or 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)). |
This file contains hidden or 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 | |
rm -rf dist | |
rm -rf build | |
rm -rf *.egg-info | |
python setup.py install |
This file contains hidden or 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
class Node(object): | |
"""A node to be used for a linked list""" | |
def __init__(self, data): | |
"""Create a new Node instance | |
>>> head = Node(4) | |
>>> print(head.next) | |
None | |
>>> head.data |
This file contains hidden or 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(module, $) { | |
module.thingy = function () {}; | |
}(window.module = window.module || {}, jQuery)); |
This file contains hidden or 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 GenerateAllPics() { | |
// Set the number of processors Go can use | |
runtime.GOMAXPROCS(runtime.NumCPU()) | |
// Make all the channels we need | |
rows := make(chan []string) | |
throttle := make(chan struct{}, 10) | |
doneChan := make(chan int) | |
// Start reading the CSV | |
go MustReadRowAtATime("data/training.csv", rows) | |
// Populate the throttle so that the workers can start working |
This file contains hidden or 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
def lat_sign(dec) | |
dec >= 0 ? 'N' : 'S' | |
end | |
def lon_sign(dec) | |
dec >= 0 ? 'E' : 'W' | |
end | |
def lat_to_dms(dec) | |
"#{dec_to_dms dec} #{lat_sign dec}" | |
end |
OlderNewer