Skip to content

Instantly share code, notes, and snippets.

View pierrenel's full-sized avatar
:shipit:

Pierre Nel pierrenel

:shipit:
View GitHub Profile
@pierrenel
pierrenel / Git + Dropbox
Created April 10, 2011 16:15
Via HackerNews at some point, how to use Dropbox & Git
Using git+dropbox together effectively? - Stack Overflow
I think that git on dropbox is great. I use it all of the time. I have multiple computers (two at home and one at work) that I use dropbox as a central bare repo. Since I don’t want to host it on a public service and I don’t have access to a server that I can always ssh to, Dropbox takes care of this by syncing (very quickly) in the background.
Setup is something like this:
~/project $ git init
~/project $ git add .
~/project $ git commit -m "first commit"
~/project $ cd ~/Dropbox/git
@pierrenel
pierrenel / protovisForceTest.html
Created June 22, 2011 15:18 — forked from psychemedia/protovisForceTest.html
First attempt at plugging Twitter social network into force directed layout using protovis. Doesn't work...:-( Race condition.. Need to hold off rendering the graph till all the data is in...
<html><head><title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript" src="../protovis-3.2/protovis-r3.2.js"></script>
<script type="text/javascript">
//getNet is where we get a list of Twitter usernames
function getNet(){
url="http://search.twitter.com/search.json?q=jisc11&rpp=100&callback=?"
@pierrenel
pierrenel / makeapp.sh
Created March 31, 2012 09:53 — forked from demonbane/makeapp.sh
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline
@pierrenel
pierrenel / gist:3826472
Created October 3, 2012 11:26
apachesolr update 7012
/**
* Rename some variables and update the database tables
*/
function apachesolr_update_7012() {
module_load_include('inc', 'apachesolr', 'apachesolr.index');
$env_id = apachesolr_default_environment();
// Variable changed from integer to array with environment integers
$stored = variable_get('apachesolr_index_last', array());
if (isset($stored['apachesolr'])) {
Unable to import sentry.filters.SiteFilter
Traceback (most recent call last):
File "/srv/www/sentry/lib/python2.6/site-packages/sentry-5.0.21-py2.6.egg/sentry/filters/helpers.py", line 35, in get_filters
cls = getattr(module, class_name)
AttributeError: 'module' object has no attribute 'SiteFilter'
Unable to import sentry.filters.ServerNameFilter
Traceback (most recent call last):
File "/srv/www/sentry/lib/python2.6/site-packages/sentry-5.0.21-py2.6.egg/sentry/filters/helpers.py", line 35, in get_filters
cls = getattr(module, class_name)
AttributeError: 'module' object has no attribute 'ServerNameFilter'
<style type="text/css">
HTML.safari.win {
-webkit-text-stroke: 1px transparent;
}
HTML.chrome.win {
-webkit-text-stroke: 0.4px;
}
</style>
<script type="text/javascript" charset="utf-8">
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod'
@pierrenel
pierrenel / html.tpl.php
Last active December 18, 2015 00:38
Adding other javascript to it's own variable, and getting Drupal to aggregate it nicely on cache refresh.
<?php print $footer_js; ?>
@pierrenel
pierrenel / merge.php
Last active December 18, 2015 23:08
Merge random array 2 (letters) into ordered array 1 (numbers)
<?php
$final = array();
$left = array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14);
$right = array('a','b','c','d','e');
shuffle($right);
$merged = array_merge($left, $right);
shuffle($merged);
$r = 0;
@pierrenel
pierrenel / drupal_exclude_node_type_search.php
Created July 2, 2013 16:20
Exclude a type of content from drupal search results, + limit to 8
/**
* Excludes node type "foo" from search results
*
* @param object $query
*/
function mymodule_query_alter(&$query) {
$is_search = FALSE;
foreach ($query->getTables() as $table) {
if ($table['table'] == 'search_index') {
$is_search = TRUE;
import requests
def campfire(token, subdomain, room_id, message, msgtype):
requests.post(
'https://%s.campfirenow.com/room/%s/speak.json' % (
subdomain, room_id
),
auth=(token, 'x'),
headers={
'Content-type': 'application/json'