Skip to content

Instantly share code, notes, and snippets.

@mojombo
mojombo / regex_example.c
Created October 29, 2008 00:29
An example of using regex in C
#include <stdlib.h>
#include <string.h>
#include <regex.h>
#include <stdio.h>
int main() {
regex_t *preg = calloc(1, sizeof(regex_t));
int numoffsets = 5;
regmatch_t pmatch[numoffsets];
Gist should be way faster now.
rails_root = "/data/github/current"
20.times do |num|
God.watch do |w|
w.name = "dj-#{num}"
w.group = 'dj'
w.interval = 30.seconds
w.start = "rake -f #{rails_root}/Rakefile production jobs:work"
w.uid = 'git'
speed test.
# +path+ is the full path of the new repo (traditionally ends with /.git)# +path+ is the full path of the new repo (traditionally ends with /.git)# +path+ is the full path of the new repo (traditionally ends with /.git)# +path+ is the full path of the new repo (traditionally ends with /.git)
/*
=skin=
@name Default
@author Yatrik Solanki
@homepage http://www.yatriksolanki.com
@email yatriksolanki@gmail.com
@license MPL/LGPL/GPL
=/skin=
*/
/*
=skin=
@name Default
@author Yatrik Solanki
@homepage http://www.yatriksolanki.com
@email yatriksolanki@gmail.com
@license MPL/LGPL/GPL
=/skin=
*/
>> Dir.entries('_layouts')
=> [".", "..", ".svn"]
>> Dir.entries('_layouts').reject { |x| File.directory?(x) }
=> [".svn"]
>> Dir.chdir('_layouts')
=> 0
>> Dir.entries('.')
=> [".", "..", ".svn"]
>> Dir.entries('.').reject { |x| File.directory?(x) }
=> []
bar
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,