Skip to content

Instantly share code, notes, and snippets.

Bouke Haarsma Bouke

Block or report user

Report or block Bouke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Bouke
Bouke / ajax-request.d.ts
Created Jun 19, 2018
TypeScript typings for ember-ajax
View ajax-request.d.ts
declare module 'ember-ajax/ajax-request' {
import Ember from 'ember';
import AjaxRequestMixin from 'ember-ajax/mixins/ajax-request';
export default class AjaxRequest extends Ember.Object.extend(AjaxRequestMixin) { }
}
@Bouke
Bouke / StringDecimalConverter.cs
Last active Apr 1, 2019
Serialize decimal to string in Newtonsoft.Json
View StringDecimalConverter.cs
public class StringDecimalConverter : JsonConverter
{
public override bool CanRead
{
get
{
return false;
}
}
@Bouke
Bouke / gist:11261620
Last active Sep 25, 2019
Multiple Python installations on OS X
View gist:11261620

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10
$ pyenv install 2.6.9
@Bouke
Bouke / gist:10454272
Last active Sep 5, 2019
Install FreeTDS, unixODBC and pyodbc on OS X
View gist:10454272

First, install the following libraries:

$ brew install unixodbc
$ brew install freetds --with-unixodbc

FreeTDS should already work now, without configuration:

$ tsql -S [IP or hostname] -U [username] -P [password]
locale is "en_US.UTF-8"
locale charset is "UTF-8"
@Bouke
Bouke / postactivate
Created Jan 8, 2014
Python virtualenvwrapper
View postactivate
#!/bin/bash
# This hook is run after every virtualenv is activated.
#create project directory and cd into it
env_name="`basename \"$VIRTUAL_ENV\"`"
env_name="${env_name/-py3/}"
pwd_root="$HOME/Sites/$env_name"
if [ ! -d "$pwd_root" ] ; then
echo "Creating directory $pwd_root"
mkdir "$pwd_root"
@Bouke
Bouke / gist:7579228
Last active Dec 28, 2015
Fetch a pull request without adding the requester's repo as a remote
View gist:7579228
git fetch origin pull/[id]/head:pull/[id]
@Bouke
Bouke / iana_extractor.py
Created Nov 11, 2013
IANA Language Tag Parser
View iana_extractor.py
"""
Parses the language tags provided by IANA_
For a definition of the tag types, see
http://www.w3.org/International/questions/qa-choosing-language-tags
IANA_: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
"""
from collections import OrderedDict
from pprint import pprint
@Bouke
Bouke / aws_usage.py
Last active Apr 19, 2017 — forked from rcoup/aws_usage.py
Catch login failures / captcha input
View aws_usage.py
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
@Bouke
Bouke / ember-select.js
Created Apr 11, 2013
Ember.Select allowing options to be disabled. Usage `{{view Ember.Select ... optionDisabledPath="content.disabled"}}`
View ember-select.js
var get = Ember.get, getPath = Ember.getPath, set = Ember.set, fmt = Ember.String.fmt;
Ember.Select.reopen({
optionDisabledPath: null
});
Ember.SelectOption.reopen({
attributeBindings: ['disabled'],
init: function() {
You can’t perform that action at this time.