Skip to content

Instantly share code, notes, and snippets.

View BaylorRae's full-sized avatar

Baylor Weathers BaylorRae

View GitHub Profile
@BaylorRae
BaylorRae / flash_messages.php
Created May 21, 2011 05:18
Flash Messages for PHP
<?php
class FlashMessages {
private $messages = array();
private $now = false;
private static $instance = null;
private function __construct() {
// Save all messages
$this->messages = $_SESSION['flash_messages'];
@BaylorRae
BaylorRae / doc_block.php
Created July 17, 2012 20:38
Parse PHP Doc Blocks
<?php
class DocBlock {
public $docblock,
$description = null,
$all_params = array();
/**
* Parses a docblock;
@BaylorRae
BaylorRae / baylorrae.zsh-theme
Created December 19, 2011 23:15
This is my oh-my-zsh theme.
# Baylor Rae's Prompt Theme
# based on wunjo prompt theme and modified for oh-my-zsh
# shows me all files and folders when I change directories
cd() { builtin cd "$@"; ls }
# uses ~ instead of /Users/baylorrae/
pwd() { print -D $PWD }
# I substituted my own so the commit times were live
import React, { useState, useEffect } from 'react';
import './App.css';
import { firebase } from './config'
function useTimesList(sortDirection='asc') {
const [times, setTimes] = useState([])
useEffect(() => {
const unsubscribe = firebase
@BaylorRae
BaylorRae / version-1.js
Created August 15, 2012 00:53
Create fixed table headers with jQuery
// http://obvcode.blogspot.com/2007/11/easiest-way-to-check-ie-version-with.html
var Browser = {
version: function() {
var version = 999; // we assume a sane browser
if (navigator.appVersion.indexOf("MSIE") != -1) {
// bah, IE again, lets downgrade version number
version = parseFloat(navigator.appVersion.split("MSIE")[1]);
}
return version;
def test_ordered_reducer_pattern():
class RandomNumberDependency(Dependency):
def promises(self):
return ['random-number']
def execute(self, context):
context['random-number'] = 5
return context
@BaylorRae
BaylorRae / PubSub.php
Created December 21, 2011 06:08
PubSub class for PHP
<?php
class PubSub {
private static $events = array(); // all subscriptions
// Don't allow PubSub to be initialized outside this class
private function __construct() {}
private function __clone() {}
@BaylorRae
BaylorRae / .vimrc
Created February 2, 2018 04:50
5 tips to improve your vim
" 1) W isn't mapped by default
command! W :w
" 2) force minimun window width
set winwidth=110
" 3) navigate by display lines
noremap j gj
noremap k gk
module Types
ProjectType = GraphQL::ObjectType.define do
name "Project"
description "a project"
implements GraphQL::Relay::Node.interface
global_id_field :id
field :title, !types.String do
Feature: purchase product
Scenario: purchase product
Given seller has created a product
When buyer purchases the product
And buyer sends payment
Then seller should receive money
And the product shouldn't be listed