Skip to content

Instantly share code, notes, and snippets.

@pau1m
pau1m / index.js
Created December 29, 2012 12:16 — forked from GothAck/index.js
#!/usr/bin/env node
/*
* Parsing BIG compressed data with Node.js and SAX
* Probably some bugs, but worked fine for OpenStreetMap Great Britain bz2
* Greg Miell 2012
*/
// Simple string trim prototype extension
String.prototype.trim = function() {
@pau1m
pau1m / KineticjsPolylineTransition.js
Last active December 10, 2015 16:08
Animating a shape across a polyline using transitions in KineticJS.
(function(){
//[x,y]
var examplePolyline = [[10,10], [50,50], [50,100], [20,20], [60,100],[200,200],[0,0]];
var stage = new Kinetic.Stage({
container: 'myCanvas',
width: 600,
height: 400
});
@pau1m
pau1m / gist:4771520
Created February 12, 2013 17:25
Quick hack to help get multiple image info in services / views
/*
*
*@param int $nid
*A node nid
*@param string $image_field
*Name of field on which to find images
*
*@return array
*Urls for various sizes of image
*/
@pau1m
pau1m / gist:4944280
Created February 13, 2013 12:34
Quick n dirty oauth request
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
//@see http://oauth.googlecode.com/svn/code/php/
require "lib/OAuth.php";
$key = 'xx';
$secret = 'xx';
@pau1m
pau1m / drush cheat sheet
Last active December 30, 2015 21:49
Drush cheat sheet
Roles, Perms and Users
drush -u 1 role-create 'site administrator'
drush -u 1 role-delete 'site administrator'
drush help | grep perm
drush help perm-grant
drush -u 1 perm-grant --roles="site administrator" --permissions="administer nodes, administer users"
drush perm-grant --roles="site administrator" --all-modules
@pau1m
pau1m / add_ssh_key
Last active January 2, 2016 14:49
Add SSH Key
cd ~/.ssh
ssh-keygen -t rsa -C "[email protected]"
ssh-add id_rsa
clip < ~/.ssh/id_rsa.pub
<?php
/**
* Implements hook_menu().
*/
function mymodule_menu() {
$items['mymodule/%ctools_js/add'] = array(
'page callback' => 'mymodule_node_add_modal_callback',
'page arguments' => array(1),
'access arguments' => array('access content'),
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
@pau1m
pau1m / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pau1m
pau1m / gist:aa09497e819de410196f
Last active August 29, 2015 14:28 — forked from dustincurrie/gist:938829
Programmatically create quicktabs
<?php
function mymodule_block($op = 'list', $delta = 0, $edit = array()) {
switch($op) {
case 'list':
$blocks['mymodule_quicktabs'] = array('info' => t('[mymodule] Quicktabs'));
return $blocks;
break;
case 'view':
switch ($delta) {