Skip to content

Instantly share code, notes, and snippets.

View ryross's full-sized avatar

Ryder Ross ryross

View GitHub Profile
"Effective people are not problem-minded; they're opportunity minded. They feed opportunities and starve problems." -Stephen R. Covey
"Don't think of problems as difficulties. Think of them as opportunities for action." - Unknown
While one person hesitates because he feels inferior, the other is busy making mistakes and becoming superior. - Henry C. Link
Innovation distinguishes between a leader and a follower. - Steve Jobs
The art of leadership is saying no, not yes. It is very easy to say yes. - Tony Blair
@markbirbeck
markbirbeck / ec2_server_create.rb
Created March 16, 2012 13:02
A patch for the 'knife ec2 server create' command to enable use with chef-solo
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@badsyntax
badsyntax / example.html
Created June 5, 2012 14:43
Twitter bootstrap tabs & jQuery BBQ hashchange history example
<!-- Tab sets have to have an id set -->
<div class="tabs" id="mytab1">
<ul class="nav nav-tabs">
<li><a href="#tab1">Tab 1</a></li>
<li><a href="#tab2">Tab 2</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="tab1">
Content for tab 1
</div>
@brianteachman
brianteachman / php_time_profiler.php
Created October 1, 2012 22:41
PHP timimg script using microtime() and BC Math
#!/usr/bin/php
<?php
$profile = function() {
static $start = '0';
list($timestamp, $microseconds) = split(' ', microtime());
$current = bcadd($timestamp, $microseconds, 4);
if ($start === '0') {
$start = $current;
return;
}
@scribu
scribu / php-init.sh
Created November 12, 2012 16:35
Ubuntu PHP Dev Setup
#!/bin/bash
# LEMP
apt-get -y install nginx mysql-server php5-mysql php5-fpm
# extra php packages
apt-get -y install php5-cli php5-gd php5-curl php5-xdebug
# change user from www-data to scribu
sed -i 's/www-data/scribu/g' /etc/nginx/nginx.conf /etc/php5/fpm/pool.d/www.conf
@Ikke
Ikke / MethodDelegator.php
Created November 14, 2012 22:22
DCI using php
<?php
Trait MethodDelegator
{
private $roles = array();
private $method_map = array();
public function delegate($class)
{
@tortuetorche
tortuetorche / 01.FiniteStateMachine.README.md
Last active October 12, 2017 23:06
FiniteStateMachine Trait with Example.Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.

FiniteStateMachine Trait

Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.

Usage

In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).

Example

@tortuetorche
tortuetorche / 01.FiniteAuditTrail.README.md
Last active May 28, 2022 03:39
FiniteAuditTrail Trait For Laravel 4 with Example. Support for keeping an audit trail for any state machine, borrowed from the Ruby StateMachine audit trail gem.

FiniteAuditTrail Trait

Support for keeping an audit trail for any state machine, borrowed from the Ruby StateMachine audit trail gem. Having an audit trail gives you a complete history of the state changes in your model. This history allows you to investigate incidents or perform analytics, like: “How long does it take on average to go from state a to state b?”, or “What percentage of cases goes from state a to b via state c?”

Requirements

  1. PHP >= 5.4
  2. Laravel 4 framework
@imath
imath / bpgmq.php
Created November 4, 2013 03:39
This is the complete class for the BuddyPress Codex article : Group Meta Queries: Usage Example. You can test it copying it in the functions.php of your active theme
<?php
/* you can copy & paste from here */
//it's important to check the BP_Group_Extension is available
if( class_exists( 'BP_Group_Extension' ) ) :
/**
* This is a quick and dirty class to illustrate "bpgmq"
* bpgmq stands for BuddyPress Group Meta Query...
* The goal is to store a groupmeta in order to let the community administrator
@ken-muturi
ken-muturi / woocommerce_checkout_update_order_meta
Last active January 22, 2024 15:33 — forked from mikejolley/gist:1604009
woocommerce_checkout_update_order_meta
<?php
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';