Skip to content

Instantly share code, notes, and snippets.

Chris Christensen christianchristensen

Block or report user

Report or block christianchristensen

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
View random_iterator.rb
module Enumerable
# Iterate over this array randomly.
# From: http://stackoverflow.com/questions/2459913/how-can-i-randomly-iterate-through-a-large-range
# And: http://refactormycode.com/codes/40-is_prime
def randomized
return to_enum(:randomized) unless block_given?
def is_prime?(num)
i = 3
View features moving
git checkout laterBranchOrTag
// (add the CCK fields/types that need to be migrated tofeatureNameNew- delete the references from featureNameOld. note: this will cause the field to be deleted)
git commit
git checkout earlierBranchOrTag
drush features revert featureNameOld
// (cacheclear, etc...extra: add the variables and some other items to featureNameNew from featureNameOld - i.e. they will exist in both for now)
git checkout laterBranchOrTag
drush features-updatefeatureNameNew
git commit
View select_jump_list.js
$('select.jump_list').change(function() {
if (!this.value) {
return;
}
var url, url_len, last_char;
if (this.value.match('://')) {
window.top.location = this.value;
}
View gist:544478
<?php
class MinSplPriorityQueue extends SplPriorityQueue
{
public function compare($priority1, $priority2)
{
if ($priority1 === $priority2) return 0;
return $priority1 > $priority2 ? -1 : 1;
}
}
View gist:615484
javascript:for(var i=0;i<document.links.length;i++){var a=document.links[i];if(a.href.indexOf('mailto:')==0){a.innerHTML=a.href;a.style.backgroundColor='red';a.style.color='white'}};return true;
View gist:1001601
# Cookbook Name:: openldap
# Attributes:: openldap
#
# Copyright 2008-2009, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
View enterprise.txt
________________ _
\__(=======/_=_/____.--'-`--.___
\ \ `,--,-.___.----'
.--`\\--'../
'---._____.|]
@christianchristensen
christianchristensen / gist:1244308
Created Sep 27, 2011
LucidChart Collapse toolbox bookmarklet
View gist:1244308
javascript:void(function(){document.getElementById("tool-box-wrapper").style.display="none";document.getElementById("viewport-container").style.left="0px";}());
You can’t perform that action at this time.