Skip to content

Instantly share code, notes, and snippets.

@rmoriz
rmoriz / Gemfile
Last active February 7, 2020 12:30
UUID primary keys in Rails 3
# Gemfile
gem 'uuidtools'
@lukas-vlcek
lukas-vlcek / gist:1075067
Created July 10, 2011 22:55
Test of attachments plugin
#!/bin/sh
host=localhost:9200
curl -X DELETE "${host}/test"
curl -X PUT "${host}/test" -d '{
"settings" : { "index" : { "number_of_shards" : 1, "number_of_replicas" : 0 }}
}'
@jasonrudolph
jasonrudolph / about.md
Last active January 6, 2024 07:40
Programming Achievements: How to Level Up as a Developer
@isaacsanders
isaacsanders / Equity.md
Created January 21, 2012 15:32
Joel Spolsky on Equity for Startups

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

@jboner
jboner / latency.txt
Last active April 26, 2024 03:40
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@brentjanderson
brentjanderson / adapter.js
Last active October 23, 2019 19:12
NOTE: Not updated since early 2013 - likely will not work with modern EmberData. Ember.JS, ember-data, and socket.io adapter. Not as primitive as the initial version and it supports object creation/deletion/etc. Does not support bulk updates like the first one just to keep it simple. Does support ember-data revision 11 and does support queries/f…
/*jshint browser:true */
/*global DS:true, io:true, App:true */
(function() {
'use strict';
// Initializer for Models
window.Models = {};
console.warn("Don't pollute the global namespace with Models!");
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@oriolgual
oriolgual / elastic_search_indexer.rb
Created March 22, 2013 11:01
Companion gist for my talk about using ElasticSearch with Ruby.
# Public: A module to be mixed in another class with common methods to index
# records in ElasticSearch.
#
# The host object needs to respond to 'indexed_attributes', which will return
# an array of the attributes names to be indexed.
#
# It's also recommended to override the 'save?' method to make sure only
# records that match some specifications are indexed.
#
# The type used for the ElasticSearch index will be extracted from the name of
@jsteiner
jsteiner / projections.json
Last active November 17, 2017 22:17
Example Rails.vim projections for an Ember.js project.
{
"app/assets/javascripts/models/*.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.coffee",
"template": "App.%S = DS.Model.extend"
},
"app/assets/javascripts/controllers/*_controller.coffee": {
"command": "jcontroller",
"alternate": "spec/javascripts/controllers/%s_spec.coffee",