Skip to content

Instantly share code, notes, and snippets.

View shawnrice's full-sized avatar

Shawn Patrick Rice shawnrice

View GitHub Profile
@michaelfox
michaelfox / Plist_parser.php
Created March 26, 2011 19:30
A PHP Class for Parsing OS X Plist files
<?php
/**
* Plist Parser Class
*
* Usage:
* ======
* $plist = Plist::from_file("~/Music/iTunes/iTunes Music Library.xml");
* print_r($plist->as_array());
*/
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@saetia
saetia / gist:1623487
Last active May 1, 2024 19:55
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
<?php
// file: ./Shape/Circle.php
namespace Shape;
class Circle extends Shape implements ShapeInterface {
public function __construct() {
var_dump($this);
}
@lavoiesl
lavoiesl / gitconfig
Created October 10, 2012 11:02
gitconfig
# http://blog.lavoie.sl/2012/10/git-tutorial-and-global-configs.html
[user]
name = Sébastien Lavoie
email = github@lavoie.sl
[color]
diff = auto
status = auto
branch = auto
@wolever
wolever / MIT-LICENSE.txt
Last active June 1, 2022 05:42 — forked from niw/MIT-LICENSE.txt
Put a mac's AirPort in HostAP mode. Updated to work with OS X 10.8.
Copyright (C) 2012 Yoshimasa Niwa
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@lavoiesl
lavoiesl / time-spender-logger.php
Last active December 11, 2015 23:59
On each PHP request (cli, cgi or apache module), this script will detect to which project the file belongs and log it.
<?php
/**
* On each PHP request (cli, cgi or apache module),
* this script will detect to which project the file belongs and log it.
* It also features a threshold so a couple consecutive minutes without a request
* doesn't stop your timer, see below.
*
* To install, configure the roots (see below) add this line to your php.ini:
* auto_prepend_file=/path/to/file/time-spender-logger.php
*
@docwhat
docwhat / traceback_example.bash
Last active April 6, 2022 02:52
A template showing how to do bash tracebacks. This makes using `set -eu` much more comfortable.
#!/bin/bash
#
# Tracebacks in bash
# https://docwhat.org/tracebacks-in-bash/
#
# Just take the code between the "cut here" lines
# and put it in your own program.
#
# Written by Christian Höltje
# Donated to the public domain in 2013
@lavoiesl
lavoiesl / service.sh
Last active May 3, 2023 11:52
Mac OS launchctl utility with support for partial match
#!/bin/bash
# Mac OS launchctl utility
# Support partial match
# Will exit on error if no of more than one service is found.
#
# @link http://blog.lavoie.sl/2013/08/service-management-utility-for-mac-osx.html
# @link https://gist.github.com/lavoiesl/6160897
#
# Usage:
# service selfupdate
@lavoiesl
lavoiesl / sysbench.sh
Last active October 21, 2017 00:15
Sysbench wrapper for several tests of sysbench
#!/usr/bin/env bash
# Sysbench wrapper for several tests of sysbench
# Scales with number of processors, works on mac and linux
#
# @link https://gist.github.com/lavoiesl/7536567
#
# wget https://gist.github.com/lavoiesl/7536567/raw/sysbench.sh -O - 2>/dev/null | bash
#
# Requires http://sysbench.sourceforge.net/