Skip to content

Instantly share code, notes, and snippets.

View bpartridge's full-sized avatar

Brenton Partridge bpartridge

View GitHub Profile
From 8a69546552b12261cc40dcfca96fb4d235e7ca0e Mon Sep 17 00:00:00 2001
From: Brenton Partridge <[email protected]>
Date: Tue, 30 Aug 2011 21:43:04 -0700
Subject: [PATCH] Changed interface for ADVANsCEne to compile on OS X
---
src/NDSSystem.cpp | 2 +-
src/mc.cpp | 2 +-
src/mc.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
From 8a69546552b12261cc40dcfca96fb4d235e7ca0e Mon Sep 17 00:00:00 2001
From: Brenton Partridge <[email protected]>
Date: Tue, 30 Aug 2011 21:43:04 -0700
Subject: [PATCH] Changed interface for ADVANsCEne to compile on OS X
---
src/NDSSystem.cpp | 2 +-
src/mc.cpp | 2 +-
src/mc.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
@bpartridge
bpartridge / gist:2576202
Created May 2, 2012 12:22
Pet the pony! Go to the address bar of your Reddit window (not this one), delete everything there, type "javascript:" (with the colon, without quotes), then after that paste this (one line)
(function(){var NPETS=3,MAXLEN=100,INTERVAL=100,POS_PROP='background-position',KARMA_POS='-0px -0px',DIS_POS='-55px -0px',$name=$('span.redditname a'),$img=$('#header-img'),initialName=$name.text(),initialAttrib=$img.parent().attr('title');$name.text('pet me please');$img.css(POS_PROP,DIS_POS);$img.parent().removeAttr('title');$img.mouseenter(function(){var buf=[];window.petkarmaint=setInterval(function(){var nmin=0,nmax=0,i=1,indownstroke=true,happy;buf.push(window.petkarmay);while(i<buf.length-1){if(buf[i-1]>buf[i]&&buf[i+1]>=buf[i]){nmin+=1;indownstroke=true;};if(buf[i-1]<buf[i]&&buf[i+1]<=buf[i]){nmax+=1;indownstroke=false;};i+=1;};if(nmin>=NPETS-1){window.petkarmahappy=true;$name.text('HAPPY! coded by btown_brony, vectors by Pinkie_Pi');$img.css(POS_PROP,KARMA_POS);};if(nmin<NPETS-1){window.petkarmahappy=false;$name.text(indownstroke?'pet':'...');$img.css(POS_PROP,DIS_POS);};},INTERVAL);}).mousemove(function(e){window.petkarmay=e.pageY;}).mouseleave(function(){if(window.petkarmaint){clearInterval(window.
@bpartridge
bpartridge / example-user.js
Created May 4, 2012 11:21 — forked from nijikokun/example-user.js
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9-_]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@bpartridge
bpartridge / LICENSE.txt
Created July 8, 2012 06:30 — forked from p01/LICENSE.txt
Music SoftSynth
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri http://www.p01.org/releases/
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@bpartridge
bpartridge / Makefile
Created January 31, 2014 00:21
Python and Numpy for Xeon Phi
PY_VER = 2.7.3
SRC = $(shell readlink -f python)
MIC_PY_HOME = $(SRC)/_install
MIC_PY_PATH = $(MIC_PY_HOME)/lib/python2.7
CTYPES = $(SRC)/Modules/_ctypes
all: $(MIC_PY_PATH)/_ctypes
install:
@echo "To install, copy $(MIC_PY_HOME) where it can be accessed from the MIC card."
# This file extends and overrides parts of the ActiveAdmin DSL and internals
# in order to provide support for automatically displaying and editing images,
# which in our infrastructure are stored as URLs whose column names end in "img".
# Since this file will be reloaded frequently in the development environment,
# all operations done at load time (class_eval's, etc.) MUST be idempotent.
ActiveAdmin::Views::TableFor.class_eval do
def img_column(col_sym=:img, title="Image")
column title, sortable: false do |obj|

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

<svg width='813px'
height='386.9994px'
viewBox='0 0 813 386.9994'
xmlns='http://www.w3.org/2000/svg'
xmlns:xlink="http://www.w3.org/1999/xlink">
<style type='text/css'>
.keycap .border { stroke: black; stroke-width: 2; }
.keycap .inner.border { stroke: rgba(0,0,0,.1); }