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
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');
callback();
View gist:2888419
//Relative path to CMBase.php. This example assumes the file is in the same folder
require_once('CMBase.php');
//Your API Key. Go to http://www.campaignmonitor.com/api/required/ 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
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
colinramsay / rename_google_apps.py
Created Jan 9, 2011
Change the username of one or more Google Apps users in your domain
View rename_google_apps.py
import gdata.apps.service
service = gdata.apps.service.AppsService(email="admin@mydomain", domain="mydomain.com", password="password")
service.ProgrammaticLogin()
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 = {})
has_one(association_id)
id = association_id.to_s
klass = id.camelize.constantize
obj = klass.new
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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></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>
<property name="dialect">NHibernate.Dialect.MySQLDialect</property>
</session-factory>
View SQL Server 2005 NHibernate Config
<?xml version="1.0" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory>
<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>
</session-factory>
</hibernate-configuration>
You can’t perform that action at this time.