Skip to content

Instantly share code, notes, and snippets.

View arthur-debert's full-sized avatar

Arthur Debert arthur-debert

View GitHub Profile
@rcrowley
rcrowley / deps.pp
Created November 16, 2010 00:14
Deploying Django with Puppet
stage { "pre": before => Stage["main"] }
class python {
package {
"build-essential": ensure => latest;
"python": ensure => "2.6.6-2ubuntu1";
"python-dev": ensure => "2.6.6-2ubuntu1";
"python-setuptools": ensure => "latest";
}
exec { "easy_install pip":
path => "/usr/local/bin:/usr/bin:/bin",
@millermedeiros
millermedeiros / gist:870867
Created March 15, 2011 15:18
JavaScript Chaining Example
//
// Orthodox Chaining
//
//basic Object that implements chaining
var myObj = {
_val : 'lorem',
val : function(val){
if(val === void(0)){
return this._val;
@edwardgeorge
edwardgeorge / setup.py
Created July 11, 2011 22:22
python libxml2 binding package for easy installation with pip/easy_install into a virtualenv
import os
import shutil
import subprocess
import sys
import tarfile
import urllib2
LIBXML2_PREFIX = "libxml2"
LIBXSLT_PREFIX = "libxslt"
LIBXML2_FTPURL = "ftp://xmlsoft.org/libxml2/"
@jonalter
jonalter / app.js
Created October 2, 2011 22:48
Android: notification that will launch app
var win = Titanium.UI.createWindow({
backgroundColor: 'blue'
});
var btn = Ti.UI.createButton({
title : 'Add Notification'
});
btn.addEventListener('click', function(e) {
var activity = Ti.Android.currentActivity();
@angus-c
angus-c / advice.js
Created June 3, 2012 20:12
an advice functional mixin
//usage
withAdvice.call(targetObject);
//mixin augments target object with around, before and after methods
//method is the base method, advice is the augmenting function
withAdvice: function() {
['before', 'after', 'around'].forEach(function(m) {
this[m] = function(method, advice) {
if (typeof this[method] == 'function') {
return this[method] = fn[m](this[method], advice);
@ehazlett
ehazlett / gist:3840931
Created October 5, 2012 16:47
Amara Dev Branch Switching
  • stop vagrant VM if running
  • git checkout <branch> (unisubs & unisubs-integration)
  • vagrant up
  • vagrant ssh
  • vereset (blows away virtualenv)
  • dbreset (blows away DB)
  • dev-runserver.sh
@chen206
chen206 / gist:4030441
Created November 7, 2012 09:45
Install Postgresql 9.2 on Ubuntu 12.04
#!/bin/bash
#
# Install Postgres 9.2 on a clean Ubuntu 12.04
"""
LC_ALL issue
comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.
sudo apt-get install language-pack-en-base
sudo dpkg-reconfigure locales
comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.
@sjl
sjl / gist:5083042
Last active December 14, 2015 11:59
hmm ok maybe I should bisect this bug
let's see if this has always happened
$ git checkout some-old-rev
nope it used to be good ok let's bisect
$ git bisect good
already bisecting

A couple of days ago a bunch of demo envs were failing to upload subtitles. Uploads would go through, but text would be empty (timming, number of subs, etc were ok). Could not repro locally, nor on staging, nor on dev. After a very fun debugging session, this is what happens:

  • babelsubs requires bleach
  • bleach requires an unpinned (latest) version of html5lib

Html5lib released a backwards incompatible release a couple of days ago. So, when creating a new env, pip would find the babelsubs dependency. Then the bleach dependency, then the html5lib, and would install the broken version. Everything 'worked' except bleach.clean would return an empty string instead of anything else.

Therefore, those new envs would get html5lib-1.01a which is broken, but our local installs would still be on 0.95 (which works). This is their bug report: mozilla/bleach#94

The fix (hopefully) is to load our pinned down version of html5lib before bleach so that when pip finds the dependency on bleach i

@cyrilmottier
cyrilmottier / _app_avelibRelease_res_values_config.xml
Last active November 20, 2020 11:27
Using the new Gradle-based Android build system: an example
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="config_app_name">AVélib</string>
<string name="config_authority">com.cyrilmottier.android.avelib.citybikes</string>
<string name="config_com.google.android.maps.v2.api_key">XXX</string>
</resources>