Skip to content

Instantly share code, notes, and snippets.

@icholy
icholy / map_filter_reduce.go
Last active February 20, 2017 01:44
chaining channels in go
View map_filter_reduce.go
package main
import (
"unicode/utf8"
)
type Item string
type Stream chan Item
type Acc string
View freeswitch 1.6 build steps Ubuntu 14.04.sh
#add the repositories
sudo apt-get update && sudo apt-get install -y curl
curl https://files.freeswitch.org/repo/ubuntu/freeswitch-1.6/freeswitch_archive_g0.pub | apt-key add -
echo "deb http://files.freeswitch.org/repo/ubuntu/freeswitch-1.6/ trusty main" | sudo tee /etc/apt/sources.list.d/freeswitch.list
sudo apt-get update
# install dependencies
@mraible
mraible / gsutil-upload.sh
Last active September 30, 2020 22:47
Upload optimized assets to Google Cloud Storage
View gsutil-upload.sh
# Rsync to remove old files
gsutil -m rsync -x '.git*' -c -d -r dist gs://bucket/
# Upload and gzip HTML, CSS and JavaScript
gsutil -m cp -z "html,css,js" -r dist/** gs://bucket/
# Set expires headers (6 months) on JS and CSS assets
gsutil -m setmeta -h "Cache-Control: public, max-age=15552000" gs://bucket/assets/**
# Make sure there's no expiration headers on HTML files
@dspezia
dspezia / example.c
Created November 26, 2012 18:26
Example of Redis zset polling daemon
View example.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include "hiredis.h"
#include "async.h"
#include "adapters/ae.h"
#include "sha1.h"
@voter101
voter101 / Gulpfile.js
Last active November 29, 2021 01:17
Gulpfile for Rails application with replaced Sprockets with Gulp
View Gulpfile.js
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');
@jinzhu
jinzhu / main.go
Created October 1, 2015 00:07
handle postgres json with gorm
View main.go
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
func main() {
@mohamed
mohamed / build-gn.sh
Last active September 23, 2022 06:25
Build Google gn build tool standalone
View build-gn.sh
#!/usr/bin/env sh
set -euv
# Updated on April 2019 to reflect changes in GN
# See:
# https://github.com/ninja-build/ninja
# https://gn.googlesource.com/gn/
# We need a recent git
@yanmhlv
yanmhlv / example.go
Created February 8, 2016 14:49
JSONB in gorm
View example.go
package main
import (
"database/sql/driver"
"encoding/json"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts
View gist:1207002

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt