Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍👩‍👦‍👦
nqdq

Jonathon Hibbard infolock

👨‍👩‍👦‍👦
nqdq
View GitHub Profile
@infolock
infolock / .gitignore
Created Oct 3, 2016
Boilerplate Gitignore for macOS web (JS) development
View .gitignore
bower_components/
node_modules/
tmp/
.AppleDouble
.LSOverride
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
View swift-json-parse.swift
import Foundation
// This can go in its own separate swift file - just keeping it here for reference..
struct MyModel {
let name: String
let email: String
static func create( name: String, email: String ) -> MyModel {
return MyModel( name: name, email: email )
}
View VirtualBox-Centos-6.5-GuestAdditions-Install-Notes
##
# Below are the steps taken to install the GuestAdditions on a VirtualBox Centos 6.5 Instance. This was done to setup sharing between Mac OSX and CentOS 6.5.
#
# Login to the GUEST ( your actual VirtualBox CentOS Instance ), update `yum` and install the necessary packages
#
##
yum update
yum --enablerepo rpmforge install dkms
yum --enablerepo rpmforge install dkms
View file-code-4.js
// Creating method from code found here: https://gist.github.com/bennadel/9751583#file-code-4-js
// Used with jsperf
var _charArr = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "{", "}", "|", ":", "\"", "<", ">", "?", "~", "!", "@", "#", "$", "%", "&", "^", "&", "*", "(", ")", "_", "+", " ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "[", "]", "\\", ";", "'", ",", ".", "/"];
var randomStr( maxLen ) {
var rndKey = 0;
var str = "";
var i;
View .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Path to where the scripts being included below live. Update this to reflect your own paths..
# In this example, we will assume there is a tools folder in your $HOME folder...
TOOLS_PATH=$HOME/tools
# Force vi to be vim
@infolock
infolock / chmod_files_and_dirs.sh
Created Oct 10, 2013
*nix recursive find and change mod access for files and folders within a given path
View chmod_files_and_dirs.sh
# Recursively find all files in the current directory and change to access of 644
find ./ -type f -exec chmod 644 {} \;
# Recursively find all directories in the current directory and change to access of 755
find ./ -type d -exec chmod 755 {} \;
View images.example.com
server {
listen 80;
server_name images.example.com;
access_log /var/sites/images.example.com/logs/access.log;
error_log /var/sites/images.example.com/logs/error.log;
root /var/sites/images.example.com/htdocs;
location / {
index index.php index.html index.htm;
}
location = /favicon.ico {
@infolock
infolock / .htaccess
Last active Dec 20, 2015
htaccess file containing Apache Mod Rewrite Rule(s) for doing a Subdomain Redirect (CloudFlare as the Nameserver, Godaddy As the host) The nginx conf file related to this htaccess file can be found here: https://gist.github.com/infolock/6044150 More information can be found in the full article: http://phpadvocate.com/blog/2013/07/apache-godaddy-…
View .htaccess
# Author Jonathon Hibbard
##################### Godaddy Apache .htaccess for example.com #####################
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
##################### Try and prevent looping madness #####################
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
@infolock
infolock / gist:6024993
Created Jul 17, 2013
Shell command to quickly copy a LICENSE (ie: /documents/LICENSE) file into a all subdirectories where all of my github projects are located : (ie: /sources/github/ contains jsToolkit, PHPToolset, etc.). This maxdepth option keeps it isolated to just the root of the subdirectories. removing it will traverse the entire directory tree and copy all …
View gist:6024993
find /sources/github -type d -maxdepth 1 -exec cp -i /documents/LICENSE {} \;
View gist:5953184
- (CGImageRef)createMaskFromAlphaChannel:(UIImage *)image
{
size_t width = image.size.width;
size_t height = image.size.height;
NSMutableData *data = [NSMutableData dataWithLength:width*height];
CGContextRef context = CGBitmapContextCreate(
[data mutableBytes], width, height, 8, width, NULL, kCGImageAlphaOnly);