Skip to content

Instantly share code, notes, and snippets.

View markstory's full-sized avatar

Mark Story markstory

View GitHub Profile
@markstory
markstory / fileheader_conflict_fixer.py
Created January 27, 2010 14:21
Used to fix annoying and widespread conflicts
#! /usr/bin/env python
import os, re
def main():
"""Fix the stupid merge conflicts.."""
for root, dirs, files in os.walk('.'):
if '.git' in dirs:
dirs.remove('.git') # don't visit .git directories
@markstory
markstory / cakephp_version_bump.py
Created January 30, 2010 02:48
a simple script for helping do cakephp releases
#! /usr/bin/env python
import os, re
from optparse import OptionParser
"""
Helper script for making releases
- Bumps version numbers
- Updates changelog urls
<?php
$filename = '/Users/markstory/Desktop/cakefest_2010_prize_draw.txt';
$file = file_get_contents($filename);
$people = explode("\n", $file);
$header = <<<TEXT
__ __ _ ____ ____ ____ __ _____
/ /` / /\ | |_/ | |_ | |_ | |_ ( (` | |
\_\_, /_/--\ |_| \ |_|__ |_| |_|__ _)_) |_|
<?php
$options = array(
'repo' => '/Users/predominant/Projects/cakephp/2.0/.git',
'titleOrder' => array(
'dev', 'alpha', 'beta', 'rc',
),
'regex' => '/(?<version>[\d\.]+)(?:-(?<title>[a-zA-Z]+)(?:(?<iteration>\d)?))?/',
'formats' => array(
'plaintext' => '| awk \'{print "Commit: ["$1"]\n"; $1=""; print "-"$0"\n"}\'',
'lighthouse' => '| awk \'{print "#### Commit: ["$1"](http://github.com/cakephp/cakephp/commit/"$1")\n"; $1=""; print $0"\n"}\'',
~/Sites/cake_dev(1.3) $ git push origin 1.3
Counting objects: 24, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 1.53 KiB, done.
Total 13 (delta 11), reused 0 (delta 0)
remote: /data/github/current/config/basic/redis.rb:13: private method `split' called for nil:NilClass (NoMethodError)
remote: from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
remote: from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
remote: from /data/github/current/config/basic/resque.rb:3
@markstory
markstory / gist:1711119
Created January 31, 2012 15:38 — forked from chartjes/gist:1711104
Hands On Node File System Exercise #3
var fs = require('fs');
function readFiveBytes(filePosition) {
var readFile = function (err, fd) {
if (err) {
console.log(err.message);
return;
}
@markstory
markstory / gist:1770613
Created February 8, 2012 15:55
jenkins json url for getting people who broke the build.
http://jenkins/view/Radiator/api/json?tree=jobs[name,color,buildable,healthReport[description,score,iconUrl],builds[culprits[fullName],changeSet[items[msg]]]]
@markstory
markstory / gist:1935774
Created February 28, 2012 22:39
hash benchmarks
public function test() {
$this->autoRender = false;
$data = array(
array(
'Article' => array(
'id' => '1',
'user_id' => '1',
'title' => 'First Article',
'body' => 'First Article Body'
// Front controller for our API
var application_root = __dirname;
var express = require("express");
var path = require("path");
var pg = require('pg');
var app = express.createServer();
var model = require('transactionmodel);
var tm = new model.TransactionModel(pg);
I have my model here:
// transactionmodel.js
function TransactionModel() {
var pg = require('pg');
var connectionString = "pg://chartjes:******@localhost:5432/ibl_stats";
this.client = new pg.Client(connectionString);
this.client.connect();
this.getCurrent = function(callback) {