Skip to content

Instantly share code, notes, and snippets.

View hugowetterberg's full-sized avatar

Hugo Wetterberg hugowetterberg

View GitHub Profile
function test() {
for (var i=0;i < 5;i++) {
console.log('orig: '+ i);
doStuff(i);
}
function doStuff(i) {
setTimeout(function debugLogging() {
console.log('cb: '+ i);
}, 100);
@hugowetterberg
hugowetterberg / _update_sql_with_param_support.php
Created January 26, 2009 10:36
update_sql function with support for parameters
/**
* Had to reimplement the update_sql function to be
* able to pass serialized php into the db, otherwise
* the {}:s were prefixed as tables.
*
* This implementation is a merge of update_sql and
* db_query to get the near-actual executed sql for the log.
*
* Two sql-statements have to be generated, one with the
* table prefixes for execution and one with the enclosing
@hugowetterberg
hugowetterberg / gist:52780
Created January 26, 2009 10:40
Example use of the _update_sql_with_param_support function
/**
* Update that changes the CCK field field_info_url
* from a text field to a link field without data loss
*
* @return void
*/
function hook_update_1() {
$ret = array();
// Global settings
@hugowetterberg
hugowetterberg / attention.markdown
Created February 2, 2009 14:38
Standardized script for syncing local server with a common dev server
@hugowetterberg
hugowetterberg / cleanup.sed
Created February 4, 2009 11:58
Git pre commit hook written in php that validates the syntax of php files and removes trailing whitespace before commit
{
s/[[:space:]]*$//
s/\$Id: .* Exp \$/$Id$/g
}
@hugowetterberg
hugowetterberg / HACKED-CORE-.patch
Created February 6, 2009 10:37
Patch that allows decoupling of default and fallback language and uses the path prefix of the default language (if set)
From a272fe19a5135b0256bb5af3210d89067fcfa257 Mon Sep 17 00:00:00 2001
From: Hugo Wetterberg <hugo.wetterberg@goodold.se>
Date: Fri, 6 Feb 2009 11:09:02 +0100
Subject: [PATCH] HACKED CORE!
It's now possible to set a default fallback language that's different from the default language.
---
includes/language.inc | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
@hugowetterberg
hugowetterberg / post-receive
Created February 20, 2009 08:42
Post-receive-hook that updates the working dir and updates submodules
#!/bin/sh
repo="`pwd`"
export GIT_DIR="$repo"
wd="`dirname $repo`"
echo "$repo"
echo "$wd"
cd "$wd"
git merge master
git submodule init
diff --git a/sites/all/modules/coder/includes/coder_style.inc b/sites/all/modules/coder/includes/coder_style.inc
index 5330b6c..2a52b0f 100644
--- a/sites/all/modules/coder/includes/coder_style.inc
+++ b/sites/all/modules/coder/includes/coder_style.inc
@@ -47,8 +47,8 @@ function coder_style_reviews() {
),
array(
'#type' => 'regex',
- '#value' => '(\.\s\'\'|\'\'\s\.|\.\s""|\.\s"")',
- '#warning' => 'string concatenation should be formatted without a space separating the operators (dot .) and a quote',
From b969757d5d6fb52f66560eea10a7299f1d81729b Mon Sep 17 00:00:00 2001
From: Hugo Wetterberg <hugo.wetterberg@goodold.se>
Date: Tue, 24 Feb 2009 12:58:51 +0100
Subject: [PATCH] Modified OAuth.php so that we can support consumer request according to the draft "Using OAuth for Consumer Requests" http://oauth.googlecode.com/svn/spec/ext/consumer_request/1.0/drafts/2/spec.html
---
lib/OAuth.php | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/OAuth.php b/lib/OAuth.php
/**
* Access checking for comments
*/
function _comment_resource_access($op='view', $args=array()) {
if (user_access('administer comments')) {
return TRUE;
}
if ($op=='create') {
$comment = (object)$args[0];