var s1 string // a new string identifer with its zero value ("")
var s2 string = "foo" // an identifer with a non-zero value
var i1 int // an int identifer with its zero value (0)
var i2 int = 42 // an int identifer with a non-zero value
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
require "commonmarker" | |
class HeaderWithIdRender < CommonMarker::HtmlRenderer | |
def header(node) | |
block do | |
old_stream = @stream | |
@stream = StringIO.new(String.new.force_encoding("utf-8")) | |
out(:children) | |
content = @stream.string | |
@stream = old_stream |
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 maxPage = 1; // calculate this using (activities/20 + 1) | |
var activityType = "Run"; // change to the workout type you want, or blank for all | |
var p = 1; | |
var done = 0; | |
var url; | |
var nw = window.open("workouts.html"); | |
nw.document.write("["); | |
while (p <= maxPage) { | |
url = "https://www.strava.com/athlete/training_activities" + | |
"?keywords=&activity_type=" + activityType + "&workout_type=&commute=&private_activities=" + |
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 join(gs []grid) grid { | |
n := int(math.Sqrt(float64(len(gs)))) // Number of subgrids across/down the new grid | |
sgn := len(gs[0]) // Number of values on one side of a subgrid | |
cg := newGridBySize(n * sgn) // The new, combined grid to populate | |
// Add each subgrid to the new, combined grid. | |
for i, g := range gs { | |
// Calculate the position of the top-left of the subgrid once placed in | |
// the new, combined grid. We use this plus the offset within the subgrid | |
// to place the values in the combined grid. |
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
{ | |
"project": "some-project", | |
"url": "https://github.com/someorg/some-project", | |
"description": "Some project or other for SomeOrg", | |
"releases": [ | |
{ | |
"version": "1.0.0", | |
"date": "2014-12-05", | |
"items": [ |
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
require "gviz" | |
require "optparse" | |
# Usage: $0 PINFILE [OPTIONS] | |
# | |
# -i, --highlight APPS Highlight apps that depend on these | |
# -x, --exclude APPS Exclude these apps | |
# -o, --only APPS Only show dependencies and dependants of these | |
# -s, --hide-solitary Hide apps with no dependecies or dependants | |
# -f, --out-file FILE The filename to write output to (default: out.png) |
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
.PHONY: build clean run | |
V15 := 1.5.4 | |
V16 := 1.6.3 | |
B15 := http-test-1.5 | |
B16 := http-test-1.6 | |
all: clean build run |
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 | |
# Tim's Development Environment Setup | |
# =================================== | |
# Stop immediately if anything fails | |
set -e | |
############################################ | |
# Handy functions |
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.exports = function (robot) { | |
robot.hear(/ (?:is )(\w+ ?){1,6}/i, function (msg) { | |
if (Math.random() < 0.001) { | |
var match = msg.match[0].trim().replace(/^is /,""); | |
msg.send("You're " + match); | |
} | |
}); | |
}; |
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 main | |
import ( | |
"fmt" | |
"math/rand" | |
"sync" | |
"time" | |
) | |
type person string |
NewerOlder