Skip to content

Instantly share code, notes, and snippets.

View jpillora's full-sized avatar
👶

Jaime Pillora jpillora

👶
View GitHub Profile
@dancannon
dancannon / listen.go
Created March 21, 2015 00:04
New channel based iterator in GoRethink v1.0
cursor, err := r.Expr([]int{1,2,3}).Run(session)
if err != nil {
panic(err)
}
ch := make(chan int)
cursor.Listen(ch)
<- ch // 1
<- ch // 2
<- ch // 3
@fatih
fatih / gist:cd1ee734803f27526f74
Created August 7, 2014 22:55
CoreOS Cloudformation with VPC
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "CoreOS on EC2: http://coreos.com/docs/running-coreos/cloud-providers/ec2/",
"Mappings" : {
"RegionMap" : {
"ap-northeast-1" : {
"AMI" : "ami-19fba518"
},
@sameersbn
sameersbn / gitlab-ce
Created July 28, 2014 14:49
gitlab-ce nginx load balance config
upstream gitlab {
server 172.17.42.1:10080;
}
## This is a normal HTTP host which redirects all traffic to the HTTPS host.
server {
listen 80;
server_name git.example.com;
server_tokens off;
root /dev/null;
@tj
tj / main.go
Last active April 10, 2017 06:58
package main
import (
"fmt"
"net/http"
"github.com/apex/go-apex"
"github.com/apex/go-apex/proxy"
)
@tj
tj / stuff.md
Last active September 30, 2017 19:13
ES6 modules

Ok so http://wiki.ecmascript.org/doku.php?id=harmony:modules looks more less the same as it did last time I looked, however that document combined with https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-06/jun-5-modules.md#do-we-need-the-module-foo-from-foo-import-syntax looks like we're conflating quite a few concepts (IMO... not trying to anger anyone).

Personally I'm in favour for removing module as mentioned in the gist. I would also remove re-exporting (export * from "crypto"), even if it's a nicety I can't say out I've done much re-exporting in the thousands and thousands of modules I've written, does anyone else do this often? (not sure)

Single exported value

Personally (barring weird edge-cases I'm not aware of?) I would love if we only had exporting a single or multiple value, with only one syntax for importing. For example the common use-case of exporting a single function or value:

ferret.js

@elwinar
elwinar / snake.go
Created November 18, 2014 11:30
ToSnake function for golang, convention-compliant
package main
import (
"unicode"
)
// ToSnake convert the given string to snake case following the Golang format:
// acronyms are converted to lower-case and preceded by an underscore.
func ToSnake(in string) string {
runes := []rune(in)
@c4milo
c4milo / yourservice.conf
Created April 25, 2011 18:05
upstart example script
# Ubuntu upstart file at /etc/init/yourservice.conf
pre-start script
mkdir -p /var/log/yourcompany/
end script
respawn
respawn limit 15 5
start on runlevel [2345]
@victorb
victorb / app.js
Created September 24, 2013 16:37
Easy AngularJS Directive for Google Places Autocomplete
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};
@abimaelmartell
abimaelmartell / default_gateway.go
Created October 19, 2016 18:52
Get default gateway by parsing RIB information using the net/route package. BSD Only.
package main
import (
"fmt"
"golang.org/x/net/route"
)
var defaultRoute = [4]byte{0, 0, 0, 0}
func main() {
@nolanlawson
nolanlawson / index.html
Created August 25, 2017 17:49
iframe blob uri src
<!doctype html>
<html lang="en">
<body>
<iframe id="theIframe" width="400" height="600" sandbox="true"></iframe>
<script>
var html = '<html><h1>hello world!</h1></html>'
var blob = new Blob([html], {type: 'text/html'})
var url = URL.createObjectURL(blob)
theIframe.src = url
</script>