Skip to content

Instantly share code, notes, and snippets.

View saimonmoore's full-sized avatar

Saimon Moore saimonmoore

View GitHub Profile

Different services I can suggest when a non-tech friend or family member asks me how they can cheaply make a website and possibly use it to sell stuff online.

Website Hosting

@derekcollison
derekcollison / Cloud Foundry Production Updates
Created April 16, 2011 17:11
How to update your application in Cloud Foundry without dropping user requests..
# vmc update is great for test and development, however it stops your old app and stages and starts the new one,
# resulting in dropped requests.
# If you want to update an application without dropping user requests, see below.
# NOTE: This change assumes your application can share services, etc with the new version.
# Assume my app is named foo
vmc push foo-v2 --url foov2.cloudfoundry.com
@Floby
Floby / editor.js
Created April 19, 2011 09:18
open the default editor from node
var fs = require('fs');
var child_process = require('child_process');
var spawn = child_process.spawn;
function openEditor(file) {
var cp = spawn(process.env.EDITOR, [file], {
customFds: [
process.stdin,
process.stdout,
process.stderr
@brianmario
brianmario / config.ru.rb
Created April 21, 2011 06:11
minimal rails3 app
# minimal rails3 app
require 'action_controller'
Router = ActionDispatch::Routing::RouteSet.new
Router.draw do
root :to => 'site#index'
end
class SiteController < ActionController::Metal
@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@unixcharles
unixcharles / nginx.conf
Last active June 1, 2024 13:34
nginx config for http/https proxy to localhost:3000
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
<style media="print">
#printed-image { content: url(/path/to/image.png); }
</style>
<img id="printed-image" src="/images/spacer.gif">
@jjb
jjb / gist:996510
Created May 28, 2011 02:00
How to set the certificate file for Net::HTTP library-wide

In my previous post I described how to securely acquire the Mozilla list of root certificates and convert them to a form usable by curl and various libraries which don't ship with them.

Next, I want to point Net:HTTP at this file library-wide, so that it is used by all invocations of methods accessing https resources (in particular, Kernel#open, which in ruby 1.8.7 does not have a ca_file option and is therefore unusable with https). I hunted around the ruby standard library for a couple hours and came up with this:

require 'open-uri'
require 'net/https'

module Net
 class HTTP
@matiasfha
matiasfha / index.html
Created June 2, 2011 20:19
nodejs + thrift +socket.io + couchdb
<!DOCTYPE>
<html>
<head>
<title>Test</title>
</head>
<body>
<div id="mensajes">
Hola Mundo
@josevalim
josevalim / omniauth_controller.rb
Created October 8, 2011 10:58
Dynamic omniauth
class OmniauthController < ApplicationController
def start
request_phase(:facebook, client_id, client_secret)
end
def callback
callback_phase(:facebook, client_id, client_secret) do
render :text => "Done!"
end
end