Skip to content

Instantly share code, notes, and snippets.

View intel352's full-sized avatar

Jonathan Langevin intel352

  • Elon, NC
  • 00:57 (UTC -04:00)
View GitHub Profile
#!/usr/bin/env zsh
branch=`git rev-parse --abbrev-ref HEAD`
git show-branch | ack '\*' | ack -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
# How it works:
# 1| Display a textual history of all commits.
# 2| Ancestors of the current commit are indicated
# by a star. Filter out everything else.
@intel352
intel352 / ab.dart
Last active December 31, 2015 23:19 — forked from okaq/godart.txt
import 'dart:html' show Console;
void main() {
var console = new Console();
console.log("ok ab dart!");
}
// to compile use:
// dart2js -oab.js ab.dart
@intel352
intel352 / answer_pic.go
Created September 17, 2012 14:45 — forked from tetsuok/answer_pic.go
An answer of the exercise: Slices on a tour of Go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
x := make([]uint8, dx)
y := make([][]uint8, dy)
for n := range y {
y[n] = x
@intel352
intel352 / find.php
Created April 2, 2012 14:56
Remove from relation range and search
<?php
$criteria = new \ext\activedocument\Criteria;
$criteria->addMapPhase('
function(value, keyData, arg) {
if(!value["not_found"]) {
var object = Riak.mapValuesJson(value)[0];
if(object.hasOwnProperty(arg.col) && object[arg.col] instanceof Array) {
if(object[arg.col].indexOf(arg.val) != -1)
return [[value.bucket,value.key]];
}
@intel352
intel352 / gist:2029327
Created March 13, 2012 15:07
Suggest solution to search an object's array in Riak, using ActiveDocument + js map function
<?php
use \ext\activedocument\Criteria;
$criteria = new Criteria;
$criteria->addColumnCondition(array('slug'=>$slug));
$category = Category::model()->find($criteria);
$criteria = new Criteria;
$criteria->order='updated ASC';
<?php
$ordersForShipping=new CActiveDataProvider( Orders::model()->with(array(
'cart'=>array(
/*
* Ensure occurs in same query
*/
'together'=>true,
'joinType'=>'INNER JOIN',
'with'=>array(
@intel352
intel352 / gist:1186453
Created September 1, 2011 15:44 — forked from gfrison/gist:1186421
app.config
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
[
%% Riak Core config
{riak_core, [
%% Default location of ringstate
{ring_state_dir, "data/ring"},
%% http is a list of IP addresses and TCP ports that the Riak
%% HTTP interface will bind.