Skip to content

Instantly share code, notes, and snippets.

@samkeen
samkeen / git-svn-workflow.md
Last active April 17, 2019 07:33
git svn workflow

Clone

# -s is there to signify that my Subversion repository has a standard layout (trunk/, branches/, and tags/)
$ git-svn clone -s http://example.com/my_subversion_repo local_dir

Gitignore

# check in strategy
$ git svn show-ignore > .gitignore

just local strategy

@samkeen
samkeen / current_profile.sh
Last active December 14, 2015 17:49
My current (horrific mess but functional) bash prompt
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# $ cd ~
# $ wget https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh -O .git-prompt.sh
# Setup git auto-complete and branch
source .git-prompt.sh
# curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
. ~/.git-completion.bash
if [ -f $(brew --prefix)/etc/bash_completion ]; then
@samkeen
samkeen / rspec_restful.rb
Created February 28, 2013 01:52
General Rspec for REST api with no UI
require 'spec_helper'
include Rack::Test::Methods
def app
Rails.application
end
describe CuuidsController do
brew install -v --HEAD fishfish
vi ~/.config/fish/config.fish
# and add this: http://notsnippets.tumblr.com/post/894091013/fish-function-of-the-day-prompt-with-git-branch
# then type fish and have fun.
@samkeen
samkeen / TestingCodeigniter.md
Created August 12, 2011 14:54
Article describing how to test Codeigniter apps

(Integration) Test Infecting Codeigniter

Intro

This is not an article on the theoretical proper way to implement a testing policy and/or infrastructure. This is much more real world than that. This is about finding yourself in a situation were you need to refactor or add features to an existing substantial code base. Before undertaking such an adventure you would like to lay down some tests for regression purposes. The hitch is that the code is in a framework that hasn't put testing support first.

Many PHP frameworks qualify for the statement above but the one we will talk about in this article is Codeigniter. I wont use this article to debate the quality of the Codeigniter code base. It is what it is and finds itself used for a very many (in production) websites. What this article is about is addressing the situation that there are many developers out there that may find themselves working on a product utilizing a framework such as Codeigniter

@samkeen
samkeen / spinner.php
Created August 2, 2011 20:05
PHP spinner
<?php
function spinner($speed=200000)
{
static $counter;
$characters = array('|', '/', '-', '\\', '|', '-', '\\');
$backspace = "\010";
echo $characters[$counter % (count($characters)-1)];
usleep($speed);
echo $backspace;
$counter++;
@samkeen
samkeen / AliasSyncDataObject.php
Created June 13, 2011 16:59
Generic data object with alias sync
<?php
/**
* AliasSyncDataObject
* This is a data object that allows models to be marshaled from Doctrine to Si
* and back again.
* It is mostly just coordinating field alias names and keeping their values in sync.
*/
class AliasSyncDataObject {
@samkeen
samkeen / brew-php-output.txt
Created January 30, 2011 18:54
Attempt to run `brew install php --with-apache --with-mysql`
$ brew install -v php --with-apache --with-mysql
==> Build Environment
CC: /usr/bin/cc => /usr/bin/gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/bin/gcc-4.2
CFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CXXFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CPPFLAGS: -I/usr/local/Cellar/gettext/0.17/include -I/usr/local/Cellar/libpng/1.2.44/include -I/usr/local/Cellar/libxml2/2.7.7/include
LDFLAGS: -L/usr/local/Cellar/gettext/0.17/lib -L/usr/local/Cellar/libpng/1.2.44/lib -L/usr/local/Cellar/libxml2/2.7.7/lib
MAKEFLAGS: -j2