Skip to content

Instantly share code, notes, and snippets.

@Inscrutabilis
Inscrutabilis / GeodesicSphere.js
Created December 12, 2010 05:29
Three.js geodesic sphere primitive class
/**
* @author Inscrutabilis / mailto:iinscrutabilis@gmail.com
*/
/*
* Generates a geodesic sphere geometry
* By default, it is 1x1x1 octahedron, as a first approximation to sphere
* It will return more sphere-like object if you specify iterations > 0
* But please keep in mind that it generates (4 ^ iterations) * 8 faces
* Radius argument overrides default sphere radius (1)
@xtian
xtian / html5boilerplate.jade
Last active December 23, 2023 15:05
HTML5 Boilerplate in jade
!!! 5
html(class='no-js')
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
title
meta(name='description', content='')
meta(name='viewport', content='width=device-width, initial-scale=1')
@cmaes
cmaes / find_elem_circuits.m
Created October 3, 2011 20:31
Find all the elementary circuits of a directed graph
function [numcycles,cycles] = find_elem_circuits(A)
if ~issparse(A)
A = sparse(A);
end
n = size(A,1);
Blist = cell(n,1);
@kyleturner
kyleturner / Remove Submodule
Created January 5, 2012 01:07
How to remove a submodule from a Github project
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@efeminella
efeminella / enhance.helper.js
Created March 14, 2012 04:57
Plain text URL to anchor tags Handlebars Helper
// Plain text URL to anchor tags Handlebars Helper
(function(){
// defines markup enhancement regex
var protocol = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim
, scheme = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
/*
* Registers a Helper method with handlebars which, given a string of
* plain text or existing markup, provides enhancements of plain text
@yustam
yustam / redis.config
Last active December 16, 2023 06:45
Install Redis on Elastic Beanstalk
packages:
yum:
gcc-c++: []
make: []
sources:
/home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz
commands:
redis_build:
command: make
cwd: /home/ec2-user/redis-2.8.4
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@tristanwietsma
tristanwietsma / auth.go
Created May 15, 2014 04:15
Golang web server example
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)
@irazasyed
irazasyed / manage-etc-hosts.sh
Created March 7, 2015 09:16
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTNAME=$1
@shotamatsuda
shotamatsuda / skia.sh
Created May 6, 2015 12:45
Build Skia as universal static libraries for OSX and iOS
readonly DEPOT_TOOLS_GIT='https://chromium.googlesource.com/chromium/tools/depot_tools.git'
readonly SKIA_GIT='https://skia.googlesource.com/skia.git'
readonly PROJECT_DIR="$(cd "$(dirname "$0")/../"; pwd)"
readonly BUILD_DIR="${PROJECT_DIR}/build"
readonly DEPOT_TOOLS_DIR="${BUILD_DIR}/depot_tools"
readonly SKIA_DIR="${BUILD_DIR}/skia"
download_depot_tools() {
echo 'Downloading depot tools...'