Skip to content

Instantly share code, notes, and snippets.

DavidVaini / round.go
Created April 9, 2014 19:58
Arggh Golang does not include a round function in the standard math package. So I wrote a quick one.
View round.go
package main
import (
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))
chantastic / .projections.json
Last active October 19, 2017 08:05
ember-cli VIM projections
View .projections.json
"app/adapters/*.js": {
"command": "adapter",
"template": [
"// export default DS.{capitalize}Adapter.extend();",
"app/components/*.js": {
"command": "component",

Build your own private, encrypted, open-source Dropbox-esque sync folder


  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
tonyhb / main.go
Created June 20, 2013 00:19
Golang: Converting a struct to a map (to a url.Values string map)
View main.go
package main
import (
type Person struct {
kevinold / .ackrc
Created February 10, 2013 13:54 — forked from hernamesbarbara/.ackrc
View .ackrc
#ack is a tool like grep, designed for programmers with large trees of heterogeneous source code
#to install ack, see
#to use ack, launch terminal (mac osx) and type 'ack <some_keywords>'
#ack will search all files in the current directory & sub-directories
#here's how I have my config file setup. this file is located on mac osx here
# ~/.ackrc
# Always sort the files
niklas /
Created October 30, 2012 17:50
HowTo create a DS.Model from ember-data, handling server-side validation errors
# If we save a record using ember-data's RESTadapter, and it fails, Rails
# returns the validation errors of the model as JSON hash:
# {"errors":{"name":["may not be blank"]}}
# This patches the RESTadapter to add these errors to the invalid record. It
# can be removed when the following Pull Request was merged into ember-data:
tomdale / gist:3981133
Last active November 26, 2019 21:19
Ember.js Router API v2
View gist:3981133


This gist is outdated! For the most up-to-date information, please see!

It All Starts With Templates

An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars.

natew / reddit_rank.rb
Created October 16, 2012 06:23
Reddit ranking algorithm in rails
View reddit_rank.rb
# Ranking algorithm
def set_rank
find_id = matching_id || id
shared_song = Song.find(find_id) if find_id
if shared_song
favs_count = shared_song.user_broadcasts_count
time_created = shared_song.created_at
favs_count = 1
time_created = created_at
gudbergur / README.markdown
Created February 19, 2012 23:49
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things
View README.markdown

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
cpatni / app.rb
Created November 21, 2011 22:39
unique calculation using redis
View app.rb
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''