Skip to content

Instantly share code, notes, and snippets.

Learning me some Golang

Colin O'Dell colinodell

Learning me some Golang
Block or report user

Report or block colinodell

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
robatron /
Last active Sep 6, 2018
Generalized tree search (DFS, BFS)

Generalized Tree Search

A generalized depth and breadth-first tree search algorithm

Here's a neat little algorithm that can perform a depth-first search (DFS) or breadth-first search (BFS) by simply changing the collection data type:

search( Node root ) {
    Collection c = new Collection()
    c.push( root )
philwinkle / ce-\app\code\core\Mage\Usa\Model\Shipping\Carrier\Fedex.php
Last active Oct 7, 2016
Git diff of Fedex SOAP API endpoint change - CE 1.6, 1.7, 1.8 and EE 1.11, 1.12, 1.13
View ce-\app\code\core\Mage\Usa\Model\Shipping\Carrier\Fedex.php
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
index d567b6e..9a98440 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
@@ -119,8 +119,8 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex
$client = new SoapClient($wsdl, array('trace' => $trace));
- ? ''
- : ''

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

JohannesHoppe / 666_lines_of_XSS_vectors.html
Created May 20, 2013
666 lines of XSS vectors, suitable for attacking an API copied from
View 666_lines_of_XSS_vectors.html
<img src=1 href=1 onerror="javascript:alert(1)"></img>
bkeepers / .gitconfig
Created Feb 19, 2013
Git aliases to make new commits that fixup or are squashed into previous commits
View .gitconfig
fixup = !sh -c 'REV=$(git rev-parse $1) && git commit --fixup $@ && git rebase -i --autosquash $REV^' -
squash = !sh -c 'REV=$(git rev-parse $1) && git commit --squash $@ && git rebase -i --autosquash $REV^' -
domenic /
Last active Nov 6, 2019
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
colinodell / .gitignore
Last active Mar 13, 2017
Standard Magento .gitignore
View .gitignore
# Don't include any temporary files and other unimportant things
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

View maybe_without_objects.js
function type(obj) {
var obj_type = typeof obj;
return({ is : function(type) { return obj_type === type; },
is_object : function() { return obj_type === "object"; },
is_func : function() { return obj_type === "function"; },
is_string : function() { return obj_type === "string"; }});
function maybe(item) {
jrf0110 / class.js
Created Apr 23, 2012
Simple extendable classes in javascript
View class.js
/* This WAS a two-line function until an awesome reddit user pointed out my logical flaw. Now It's a 5-line function :( */
var Class = function(d){
d.constructor.extend = function(def){
for (var k in d) if (!def.hasOwnProperty(k)) def[k] = d[k];
return Class(def);
return (d.constructor.prototype = d).constructor;
You can’t perform that action at this time.