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;
}
@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)
{
@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
@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
@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 / FiniteAuditTrailTrait.php
Created July 12, 2016 15:32
FiniteStateMachine and FiniteAuditTrail Traits for Laravel 5.1 (WIP)
<?php namespace App\Finite;
/**
* The FiniteAuditTrail Trait.
* This plugin, for the Finite package (see https://github.com/yohang/Finite), adds support for keeping an audit trail for any state machine.
* Having an audit trail gives you a complete history of the state changes in your stateful model.
* Prerequisites:
* 1. Install Finite package (https://github.com/yohang/Finite#readme)
* 2. Use FiniteStateMachine in your model (https://gist.github.com/tortuetorche/6365575)
* Usage: in your Stateful Class use this trait after FiniteStateMachine trait, like this "use FiniteAuditTrailTrait;".
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "An auto-generated nested stack.",
"Metadata": {},
"Parameters": {
"AppSyncApiId": {
"Type": "String",
"Description": "The id of the AppSync API associated with this project."
},
"AppSyncApiName": {