Skip to content

Instantly share code, notes, and snippets.

View chrisns's full-sized avatar

Chris Nesbitt-Smith chrisns

View GitHub Profile

JS technical test

Scope

Consider the following code:

var a = b = 5;
console.log(b);

What will be printed on the console?

@chrisns
chrisns / tcmessages.py
Created June 26, 2014 17:06
pycharm tcmessages.py fix
import sys
class TeamcityServiceMessages:
quote = {"'": "|'", "|": "||", "\n": "|n", "\r": "|r", ']': '|]'}
messages = []
def __init__(self, output=sys.stdout, prepend_linebreak=False, buffer_output=True):
self.output = output
self.prepend_linebreak = prepend_linebreak
self.buffer_output = buffer_output
@chrisns
chrisns / playlist.js
Created December 19, 2013 16:20
transittours example playlist
{
"location1": {
"lon": 12,
"lat": 30,
"radius": 10, // distance in km
"playlist" : {
"audiofile1":null,
"audiofile2":null
}
},
@chrisns
chrisns / ticker.py
Created December 18, 2013 14:38
btc/ltc/usd ticker
#!/usr/bin/env python
# Based on the Gmail appindicator from
# http://conjurecode.com/create-indicator-applet-for-ubuntu-unity-with-python/
import sys
import os
import gtk
import appindicator
import requests
@chrisns
chrisns / cgminer.conf
Last active July 26, 2016 11:30
mining config
{
"pools": [
{
"url": "stratum+tcp://eu.multipool.us:7777",
"user": "chrisns.HOSTNAME",
"pass": "x"
},
{
"url": "stratum+tcp://eu2.multipool.us:7777",
"user": "chrisns.HOSTNAME",
@chrisns
chrisns / codecoverage.patch
Created November 8, 2012 14:44
drupal 7 codecoverage patch
diff --git includes/bootstrap.inc includes/bootstrap.inc
index 74853b2..282a232 100644
--- includes/bootstrap.inc
+++ includes/bootstrap.inc
@@ -3383,3 +3383,52 @@ function _drupal_shutdown_function() {
}
}
}
+
+
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* AES implementation in PHP */
/* (c) Chris Veness 2005-2011 www.movable-type.co.uk/scripts */
/* Right of free use is granted for all commercial or non-commercial use providing this */
/* copyright notice is retainded. No warranty of any form is offered. */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
class Aes {
diff --git modules/field/field.api.php modules/field/field.api.php
index 5f64117..683d9b6 100644
--- modules/field/field.api.php
+++ modules/field/field.api.php
@@ -259,6 +259,32 @@ function hook_field_schema($field) {
}
/**
+ * Allow modules to alter the schema for a field.
+ *
@chrisns
chrisns / maestro_og_hack.patch
Created October 26, 2012 10:44
neuter maestro's og integration
diff --git maestro.admin.inc maestro.admin.inc
old mode 100644
new mode 100755
index 76cc821..14743d5
--- maestro.admin.inc
+++ maestro.admin.inc
@@ -750,7 +750,7 @@ function maestro_export($id) {
case MaestroAssignmentTypes::GROUP:
if ($assign_by == MaestroAssignmentBy::FIXED) {
@chrisns
chrisns / 337089-26b.patch
Created July 17, 2012 09:35
select all in patch difference
diff --git i18n.module i18n.module
index e857633..3bbecc4 100644
--- i18n.module
+++ i18n.module
@@ -459,7 +459,7 @@ function i18n_db_rewrite_sql($query, $primary_table, $primary_key, $args = array
if ($mode == 'mixed') {
$result['where'] = i18n_db_rewrite_where($primary_table, 'node', 'simple');
if (i18n_get_lang() != i18n_default_language()) {
- $result['join'] = "LEFT JOIN (SELECT tnid FROM {node} WHERE tnid <> 0 AND language='"
+ $result['join'] = "LEFT JOIN (SELECT * FROM {node} WHERE tnid <> 0 AND language='"