Skip to content

Instantly share code, notes, and snippets.

@datafatmunger
datafatmunger / test.c
Created July 30, 2011 14:44
clang why you so noisy?!??!
#include <stdio.h>
int main() {
int i = 0;
if(++i) {
printf("1\n");
}
if(i = 1) {
@datafatmunger
datafatmunger / gist:1345641
Created November 7, 2011 17:46
Missile command
background-image: -webkit-repeating-linear-gradient(-35deg, #ccc, #ccc 1px, transparent 1px, transparent 6px);
@datafatmunger
datafatmunger / solution.js
Created April 20, 2012 12:56
Solution Backbone Model
Solution = Backbone.Model.extend ({
fetchAll: function(options) {
var solution = this;
var error = false;
var errorHandler = function() {
error = true;
}
$.when(solution.comments.fetch({ error: errorHandler }),
solution.likes.fetch({ error: errorHandler }),
@datafatmunger
datafatmunger / ideedock-question-firehose.js
Created August 18, 2012 12:30
Ideedock Question Stream
WebSocketStompMock = SockJS;
var stomp = Stomp.client('http://ideedock.com:55674/stomp');
stomp.connect('guest', 'guest', function(x) {
stomp.subscribe('/topic/questions', function(d) {
console.log(JSON.parse(d.body).question);
});
});
@datafatmunger
datafatmunger / ideedock-reponses.json
Created August 18, 2012 12:51
Ideedock Reponse Examples
// questions endpoint - /topic/questions
{
"id":"b98ea39b-f44e-4f89-b32f-dc450bb84565",
"question":"How do we keep birds away from airports?",
"user":{
"email":"sophie@example.com",
"id":"500fc8c13eca27796000004a",
"name":"jbg",
"url":"dev.ideedock.com"
},
WebSocketStompMock = SockJS;
var guid = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}();
var stream = 'dev.ideedock.com';
var stomp = Stomp.client('http://'+stream+':55674/stomp');
stomp.connect('guest', 'guest', function(x) {
@datafatmunger
datafatmunger / ideedock-requests.js
Created August 18, 2012 13:35
Ideedock Request Examples
// Example Ideedock Requests
// - /topic/questions
{
id: Utils.generateGUID(),
question: 'What the heck am I doing here?',
user: authenticatedUser,
created: date,
time: date,
end: new Date(new Date().setDate(date.getDate() + 2)),
@datafatmunger
datafatmunger / ws1.html
Last active December 19, 2015 20:09
Hackers & Designers, Workshop 1, CSS3
<!DOCTYPE html>
<html>
<head>
<style>
div {
width:100px;
height:100px;
background:red;
position:relative;
@datafatmunger
datafatmunger / TSTView.m
Created February 13, 2014 08:31
iOS7 boundingRectWithSize Example
//
// TSTView.m
// Test
//
// Created by James Bryan Graves on 09-02-14.
// Copyright (c) 2014 Qardio. All rights reserved.
//
#import "TSTView.h"
@datafatmunger
datafatmunger / gist:18a1a2ea50b80dc37bb7
Created September 5, 2015 15:05
Shaney Reddit Bot
import cookielib
import urllib
import urllib2
import re
import mechanize
import string
import sys
from bs4 import BeautifulSoup
from random import randint
import random