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
@mietek
mietek / set-up-l2tp-ipsec-vpn-on-debian.md
Last active October 22, 2023 12:25
Set up L2TP/IPsec VPN on Debian

Set up L2TP/IPsec VPN on Debian

Set up IPsec

Set up networking

@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)
@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 / 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

@yyx990803
yyx990803 / starcounter.js
Last active March 24, 2024 05:25
Count your total stars!
var https = require('https'),
user = process.argv[2],
opts = parseOpts(process.argv.slice(3))
request('/users/' + user, function (res) {
if (!res.public_repos) {
console.log(res.message)
return
}
var pages = Math.ceil(res.public_repos / 100),
@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: {}
};
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@afair
afair / tmux.cheat
Last active October 11, 2023 13:48
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &