Skip to content

Instantly share code, notes, and snippets.

# First, Install Vagrant and Virtualbox then:
# Create new project directory
mkdir -p ~/Sites/newproject # Create new project directory
mk ~/Sites/newproject # Go into your new project directory
# Setup Vagrant
vagrant init
# Edit vagrant file box and box url to install Ubuntu, just like https://gist.github.com/fideloper/dab171a2aa646e86b782#file-vagrantfile-share-var-www-rb-L6-L8
# Edit Vagrantfile to create a static IP address, just like https://gist.github.com/fideloper/dab171a2aa646e86b782#file-vagrantfile-share-var-www-rb-L10
@dr-dimitru
dr-dimitru / .htaccess
Created October 30, 2013 16:34
.htaccess file for Laravel 4 and Laravel 3 | For /public folder
# ----------------------------------------------------------------------
# /PUBLIC folder .htaccess
# ----------------------------------------------------------------------
# This .htaccess file is recommended
# to be placed at root/public folder
# of your Laravel powered application
# ----------------------------------------------------------------------
# This file works with Laravel 3 and 4
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and
@PetePolash
PetePolash / CalculatorBrain.h
Created July 23, 2012 21:29
Code for Minimal Parentheses
//
// CalculatorBrain.h
// Calculator
//
// Created by Peter Polash on 7/2/12.
// Copyright (c) 2012 Share. All rights reserved.
//
#import <Foundation/Foundation.h>
@Elephruit
Elephruit / descriptionOfProgram.m
Created July 9, 2012 15:50
Description of Program (CS193P Assignment 2)
+ (NSString *) descriptionOfProgram:(id)program
{
NSMutableArray *stack;
if ([program isKindOfClass:[NSArray class]]) stack = [program mutableCopy];
NSString *programDescription = @"";
while (stack.count) {
programDescription = [programDescription stringByAppendingString:[self descriptionOfTopOfStack:stack]];
if (stack.count) {
programDescription = [programDescription stringByAppendingString:@", "];
}
@jboner
jboner / latency.txt
Last active July 6, 2024 06:48
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@dfox
dfox / route53-user-policy.json
Created January 25, 2012 16:45
An IAM policy for Amazon AWS to allow limited access to Route 53
{
"Statement":[
{
"Action":[
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
"Effect":"Allow",
"Resource":[
@korzo
korzo / .htaccess redirect old domain to new domain
Created December 14, 2010 19:37
Redirect all pages from old domain to new domain with .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old\.com$ [NC]
RewriteRule .* http://www.new.com%{REQUEST_URI} [R=301,L]