Skip to content

Instantly share code, notes, and snippets.

@wilsonpage
wilsonpage / storage.js
Created September 11, 2015 14:25
Simple localStorage like wrapper around indexeddb
function Storage(name) {
this.ready = new Promise((resolve, reject) => {
var request = window.indexedDB.open(location.origin);
request.onupgradeneeded = e => {
this.db = e.target.result;
this.db.createObjectStore('store');
};
request.onsuccess = e => {
dependencies:
pre:
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
- wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
- sudo apt-get update
- sudo apt-get install rethinkdb=1.16.3~0precise
- sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf
- sudo /etc/init.d/rethinkdb restart
@orafaelfragoso
orafaelfragoso / home_controller_spec.rb
Created August 8, 2014 19:06
Testing a root route with Rspec
require 'rails_helper'
RSpec.describe HomeController, :type => :controller do
describe "GET index" do
it "renders the :index template" do
expect(get: root_url(subdomain: nil)).to route_to(
controller: "home",
action: "index")
@michaljemala
michaljemala / tls-client.go
Last active April 10, 2024 01:57
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@robinsound
robinsound / listing_rake_tasks.sh
Created July 2, 2013 21:35
Command rake to tell you all tasks available
# rake -T, --tasks [PATTERN] Display the tasks (matching optional PATTERN) with descriptions, then exit.
rake -T
defmodule ApplicationRouter do
use Dynamo.Router
prepare do
# Pick which parts of the request you want to fetch
# You can comment the line below if you don't need
# any of them or move them to a forwarded router
conn.fetch([:cookies, :params])
end

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@shanselman
shanselman / gist:5422230
Last active March 28, 2024 10:33
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
@guilleiguaran
guilleiguaran / file.md
Last active October 12, 2015 13:57
Why Google V8 is not suited for integration into servers

Why Google V8 is not suited for integration into servers

06/09/2010

Last time I studied the ability to embed javascript in nginx using the library Google V8 Javascript Engine , it should be noted, was no easy task, as all that complicated the classic "Hello World!", reflected in the documentation is extremely sketchy. Because V8 developed primarily for Chrome, then this left a significant imprint on him and, to paraphrase Henry Ford's statement about the color of the machine, it can be said that the V8 will work well in any application, provided that this program is called Chrome.

First of all, V8 does not know how to handle memory allocation errors - it just ends the process. This is acceptable for such a browser like Chrome, which displays each page in a separate process, and the crash of one process does not affect the other pages, but for the server to process in one process thousands of simultaneous connections, it does not fit. While V8 allows you to set your own error handler memory allocation, ho

@bithavoc
bithavoc / home.js
Created July 26, 2011 07:17
Sample pseudo action
// pseudo Loader: https://github.com/firebaseco/pseudo
// actions/home.js
var pseudo = require('pseudo')
pseudo.get('/', {
filters:['requireLogin'],
action:function(req, res) {
var greeting = this.customContext // use custom context bound values
// render some view for the home page