Skip to content

Instantly share code, notes, and snippets.

Colin Ramsay colinramsay

Block or report user

Report or block colinramsay

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
colinramsay / gist:42d3dbd0316212d65161
Created May 12, 2015
react-router 0.13.2 TransitionGroup
View gist:42d3dbd0316212d65161
let AnimationWrapper = React.createClass({
render() {
console.log(this.props.childClassName + ' render');
return this.props.children;
componentWillAppear (callback) {
console.log(this.props.childClassName + ' willappear');
View gist:2888419
//Relative path to CMBase.php. This example assumes the file is in the same folder
//Your API Key. Go to to see where to find this and other required keys
$api_key = '9fd115edeef04b86080a2838baa28a89';
$client_id = null;
$campaign_id = null;
$list_id = '95b3a886fca5e7572963bf2c69d4ad1f';
$cm = new CampaignMonitor($api_key, $client_id, $campaign_id, $list_id);
colinramsay / extjs4-treefilter.js
Created Feb 10, 2012
Add filtering to Ext JS 4's TreePanel (Ext.tree.Panel)
View extjs4-treefilter.js
* Add basic filtering to Ext.tree.Panel. Add as a mixin:
* mixins: {
* treeFilter: 'MyApp.lib.TreeFilter'
* }
Ext.define('MyApp.lib.TreeFilter', {
filterByText: function(text) {
this.filterBy(text, 'text');
colinramsay /
Created Jan 9, 2011
Change the username of one or more Google Apps users in your domain
import gdata.apps.service
service = gdata.apps.service.AppsService(email="admin@mydomain", domain="", password="password")
names = {'from':'to'}
for current, change_to in names.iteritems():
user_entry = service.RetrieveUser(current)
View values_at.rb
- filtered_sets = filter_sets(sets, set_idxs) unless set_idxs.empty?
+ filtered_sets = sets.values_at(*set_idxs) unless set_idxs.empty?
- def filter_sets(sets, set_idxs)
- filtered_sets = []
- sets.each_with_index do |set, index|
- if set_idxs.include?(index)
- log("Adding setidx #{index} with #{set.data_points.length} items to filtered_sets")
- filtered_sets << set
View inc.rb
class ActiveRecord::Base
def self.incorporates(association_id, options = {})
id = association_id.to_s
klass = id.camelize.constantize
obj =
obj.attributes.each do |att|
send :define_method, "#{att}=" do |value|
assoc = send("#{association_id.to_s}")
unless assoc
View js-recorder-page1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" charset="utf-8" src=""></script>
<script type="text/javascript" charset="utf-8">
View gist:152768
// Sqlite Test Base for Fluent NH - needs AddDefaultMappings extension method to NH.Cfg.Configuration
using System;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using Luxington.EstimateAggregator.Core.NHibernate;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
View MySQL NHibernate Config
<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
<property name="connection.connection_string">
Database=test;Data Source=someip;User Id=blah;Password=blah
<property name="dialect">NHibernate.Dialect.MySQLDialect</property>
View SQL Server 2005 NHibernate Config
<?xml version="1.0" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Server=(local);Initial Catalog=dbname;User Id=user;Password=********</property>
You can’t perform that action at this time.