Skip to content

Instantly share code, notes, and snippets.

@joakimbeng
joakimbeng / router.html
Last active March 15, 2024 06:18
A really simple Javascript router
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building a router</title>
<script>
// Put John's template engine code here...
(function () {
// A hash to store our routes:
@SyntaxC4
SyntaxC4 / config.hdf
Last active December 28, 2015 04:48
Upstart script for hhVM on Ubuntu 13.04
Server {
SourceRoot = /var/www
}
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@MikeRogers0
MikeRogers0 / backup-to-s3.sh
Last active May 19, 2020 15:33
A method of backing up your website to Amazon S3.
#!/bin/bash
## Email Variables
EMAILDATE=`date --date="today" +%y-%m-%d`
EMAIL="you@yourdomain.com"
SUBJECT="[servername] Backup Script Started! - "$EMAILDATE
EMAILMESSAGE="/tmp/emailmessage1.txt"
echo "Just to let you know that the backup script has started."> $EMAILMESSAGE
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
@aegzorz
aegzorz / UIView+Recursion.h
Created July 11, 2013 10:40
Recursively find a subview.
#import <UIKit/UIKit.h>
@interface UIView (Recursion)
/**
Return YES from the block to recurse into the subview.
Set stop to YES to return the subview.
*/
- (UIView*)findViewRecursively:(BOOL(^)(UIView* subview, BOOL* stop))recurse;
@LBRapid
LBRapid / Guardfile
Created July 3, 2013 14:37
Guardfile guard-sprockets example
guard 'sprockets', :destination => 'public',
:asset_paths => ['app/assets/javascripts', 'vendor/assets/javascripts'],
:root_file => 'app/assets/javascripts/application.js', :minify => true do
watch(%r{^app/assets/javascripts/(.+)\.(js|js\.coffee)})
end
@LBRapid
LBRapid / precompile.rake
Last active December 19, 2015 07:19
Precompile javascript assets in a rails engine
namespace :assets do
ROOT = Pathname.new(File.dirname(__FILE__))
LOGGER = Logger.new(STDOUT)
APP_ASSETS_DIR = ROOT.join("app/assets")
PUBLIC_ASSETS_DIR = ROOT.join("vendor/assets")
OUTPUT_DIR = ROOT.join("public")
desc 'Compile assets'
task :compile => :compile_js
@brianpattison
brianpattison / README.md
Created November 22, 2012 07:41 — forked from tjogin/README.md
PHP on Pow.cx

PHP on Pow.cx

Install Pow

$ curl get.pow.cx | sh

Install PHP with MySQL

$ curl -O https://raw.github.com/gist/4129846/7ae1709453a8a19ce9c030bf41d544dd08d96d85/php.rb

$ mv php.rb brew --prefix/Library/Formula

@mustafaturan
mustafaturan / ruby.2.0.0-setup.sh
Last active May 21, 2019 23:00
ruby 2.0.0 centos 6
#!/usr/bin/env bash
# repository
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
# system update
yum -y update
yum -y groupinstall "Development Tools"
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick
@saetia
saetia / parse.rb
Last active June 26, 2017 16:59
Parse MySQL dumps
ruby -e "$(curl -fsSkL https://gist.githubusercontent.com/saetia/2369908/raw/4bf9a6d36060582e69f02c314f66449971a7bb11/parse.rb)" /Users/Joel/site.db.121010.dump
ruby parse.rb site.120411.dump