Skip to content

Instantly share code, notes, and snippets.

View cobbweb's full-sized avatar

Andrew Bucknall cobbweb

  • QLD, Australia
  • 02:00 (UTC +10:00)
View GitHub Profile
@cobbweb
cobbweb / ipdb.sublime-snippet
Created February 5, 2014 08:07
Sublime Text snippet to insert an ipdb breakpoint with set_trace()
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
import ipdb; ipdb.set_trace()
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>ipdb</tabTrigger>
<description>Set an ipdb breakbpoint with ipdb.set_trace</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.python, keyword.control.import.python</scope>
@cobbweb
cobbweb / TodoStore.js
Created February 17, 2015 06:22
Reactive data layers with Flux
var alt = require('../alt');
var TodoActions = require('./TodoActions');
// Reactive data layer
var Todos = alt.Todos;
class TodoStore {
constructor() {
this.bindActions(TodoActions);
(function(window) {
'use strict';
window.SrcSet = {
/**
* Converts srcset value into JS objects
* e.g. './image1.jpg 1100w, ./image1_big.jpg 1500w, ./image1_small.jpg'
* yields:
* [
* { src: './image1.jpg', width: 1100 },
@cobbweb
cobbweb / MODM140Test.php
Created April 15, 2011 00:51
Testing nested embedded documents in Doctrine ODM (BETA3)
<?php
namespace Doctrine\ODM\MongoDB\Tests\Functional\Ticket;
use Doctrine\Common\Collections\ArrayCollection,
Documents\Functional\EmbeddedTestLevel0,
Documents\Functional\EmbeddedTestLevel1,
Documents\Functional\EmbeddedTestLevel2;
class MODM140Test extends \Doctrine\ODM\MongoDB\Tests\BaseTest
@cobbweb
cobbweb / MoveEmbeddedDocuments.php
Created April 20, 2011 05:13
How to move embedded documents between parent documents in Doctrine ODM
<?php
namespace Doctrine\ODM\MongoDB\Tests\Functional;
use Doctrine\Common\Collections\ArrayCollection,
Documents\Functional\EmbeddedTestLevel0,
Documents\Functional\EmbeddedTestLevel1,
Documents\Functional\EmbeddedTestLevel2;
class MoveEmbeddedDocuments extends \Doctrine\ODM\MongoDB\Tests\BaseTest
@cobbweb
cobbweb / base.css
Created September 23, 2011 01:40
Button-ish anchors
/* make links move down 1px when clicked */
a:active {
position: relative;
top: 1px;
}
@cobbweb
cobbweb / NewInvoice.xml
Created October 24, 2011 22:14
Create a PAID invoice in Xero (Attempt #1)
<?xml version="1.0"?>
<Invoices>
<Invoice>
<Type>ACCREC</Type>
<Contact>
<ContactID>427f9f6c-8d02-403b-9e8b-e22a77a33c05</ContactID>
</Contact>
<InvoiceNumber>11001691</InvoiceNumber>
<DueDate>2011-10-30</DueDate>
<Date>2011-10-24</Date>
@cobbweb
cobbweb / vm.js
Created December 2, 2011 02:05
Virtual Machine
var VM = {
cpu: {
ip: 0x00,
r0: 0x00,
r1: 0x00,
r2: 0x00,
r3: 0x00,
@cobbweb
cobbweb / main.c
Created December 2, 2011 03:56
Part 1
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/utsname.h>
@cobbweb
cobbweb / connect-to.sh
Created December 6, 2011 06:46
SSH connect shortcuts
#!/bin/sh
# © Andrew Cobby <cobby@cobbweb.me>
# Creates shortcuts to log into remote servers
# Setup private/public key auth for passwordless logins
# USAGE: $ ./connect-to.sh example
# Defaults
user="root"