Skip to content

Instantly share code, notes, and snippets.

View davidhq's full-sized avatar
🎯
Focusing

davidhq

🎯
Focusing
View GitHub Profile
worker_processes 1;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@davidhq
davidhq / .gitignore
Last active August 29, 2015 13:57 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
@davidhq
davidhq / gist:3bd6c9601e91b0186593
Created May 19, 2014 23:02
startup script rbenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
CONFIG_FILE=/etc/default/thinking_sphinx
. $CONFIG_FILE || exit
PATH=/home/$USER/.rbenv/shims:/home/$USER/.rbenv/bin:$PATH
...
echo "Starting $PROGRAM_NAME"
@davidhq
davidhq / faye.rb
Last active August 29, 2015 14:04
ENV['RAILS_ENV'] = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
require ::File.expand_path('../config/environment', __FILE__)
require 'faye'
require 'eventmachine'
require 'redis'
class NumberHelper
extend ActionView::Helpers::NumberHelper
### Keybase proof
I hereby claim:
* I am davidhq on github.
* I am davidhq (https://keybase.io/davidhq) on keybase.
* I have a public key whose fingerprint is ED2F A352 E886 BC83 5B5D C011 274F 83D3 1421 DB54
To claim this, I am signing this object:
@davidhq
davidhq / ssh_forward_setup.md
Last active August 29, 2015 14:07
Showcase websites from your local machine easily

Showcase websites from your local machine easily

We want to make yourdomain.com (could be subdomain like showcase.yourdomain.com as well, of course) open whatever webapp (Rails, Sinatra etc.) is running on port 3000 on your development machine.

Create ~/bin/ssh_forward with this contents:

#!/usr/bin/env bash
domain=yourdomain.com
echo "http://$domain" | pbcopy

python -mwebbrowser http://$domain &

@davidhq
davidhq / devise.sl.yml
Last active August 29, 2015 14:13
devise 3.4.1, slovenian translations
# Based on https://gist.github.com/samotarnik/4337418 (Devise 2.1.2) by @samotarnik
sl:
devise:
confirmations:
confirmed: 'Vaš uporabniški račun je bil uspešno potrjen. Sedaj ste prijavljeni.'
send_instructions: 'V nekaj minutah boste prejeli elektronsko sporočilo z navodili za potrditev vašega uporabniškega računa.'
send_paranoid_instructions: 'Če je vaš elektronski naslov v naši bazi podatkov, boste na ta naslov v nekaj minutah prejeli navodila za potrditev vašega uporabniškega računa.'
failure:
already_authenticated: 'Ste že prijavljeni.'
inactive: 'Vaš uporabniški račun še ni bil aktiviran.'
@davidhq
davidhq / aliases.bash
Last active August 29, 2015 14:15
Ultimate web server
function serve {
if [ -f ./server ]; then
./server
elif [ -f ./server.js ]; then
node server.js
elif [ -f ./package.json ]; then
npm run start
else
# npm install http-server -g
http-server -p 3000
@davidhq
davidhq / server.js
Last active August 29, 2015 14:15
Ethereum dapp server with reverse proxy for eth RPC (solves CORS issues)
// use: web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8888/client'));
// eth has to run on 8090:
// eth -j -f -m 10 -n off --json-rpc-port 8090
// static server based on: https://gist.github.com/ryanflorence/701407
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
_request = require("request"),
@davidhq
davidhq / contract.html
Last active August 29, 2015 14:16
go-ethereum example
<html>
<head>
<script type="text/javascript" src="dist/bignumber.min.js"></script>
<script type="text/javascript" src="dist/ethereum.js"></script>
<script type="text/javascript">
var web3 = require('web3');
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8090'));