Skip to content

Instantly share code, notes, and snippets.

View scopes.js
function f(){
// window scope
// object scope
var o = {
asmedrano / csvwrite.go
Created Feb 24, 2014
csv write in go.
View csvwrite.go
package main
func main(){
asmedrano / rediswriter.go
Last active Aug 29, 2015
Fun with Go interfaces. In this case using io.Writer
View rediswriter.go
package main
import (
asmedrano / splitfile.go
Created Mar 11, 2014
Split a file into several files of given bytesize. Try not to leave orphaned rows.
View splitfile.go
package main
import (
asmedrano / Fun with named pipes
Last active Aug 29, 2015
Fun with Named Pipes
View Fun with named pipes
Shell 1 // this will create a named pipe @ /tmp/gfifo and read from the pipe 4eva
> ./gopipe
2014/03/12 20:53:35 Created Pipe
Shell 2
> echo "ASD" > /tmp/gfifo
Shell 1 // prints bytes
> [65 83 68]
View reflection.go
package main
import (
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
View gist:3d43a424999e909b1207
package main
import "fmt"
import "encoding/json"
type My struct {
Name string
asmedrano / gist:2466271
Created Apr 22, 2012
New Twitter Bootstrap row every Nth item.
View gist:2466271
{%for item in items%}
{% if forloop.first or forloop.counter0|divisibleby:3 %}
<div class = "row">
{# We need to add a new Bootstrap row every after every third item item#}
<div class = "span4">
<h3><a href ="">{{title}}</a></h3>
<span>Posted on {{created_on}} </span>
asmedrano /
Created Apr 26, 2012
ACS2010 Census Summary Levels as a Dict
Summary Level Definitions
Defined as:
SUMLEV: (Geographies, Hierarchy(when avail))
'010':('United States', 'United States'),
View gist:2895558
// a simple addition function
function add_these(num1, num2){
$result = $num1 + $num2;
return $result;