Skip to content

Instantly share code, notes, and snippets.

Dallon Feldner dallonf

  • Austin, TX
Block or report user

Report or block dallonf

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 superagent-nock-748.js
const nock = require('nock');
const test = require('tap').test;
const superagent = require('superagent');
test('reqheaders ignored #748 - test matching', t => {
nock('http://www.example.com', {
reqheaders: {
'authorization': 'Bearer TOKEN'
}
})
View Conditional.jsx
function render1() {
return (
<div>
{ templates.length
? null
: <div>Nothing to see here, move along...</div>
}
</div>
);
}
@dallonf
dallonf / index.html
Created Oct 6, 2015
React can't render SVG under PhantomJS
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<svg id="svgRoot">
<g id="gElement">
</g>
View co.d.ts
declare module 'co' {
interface ICoStatic {
<T>(coroutine: () => IterableIterator<any>): Promise<T>
wrap<T>(coroutine: (...args: any[]) => IterableIterator<Promise<any>>): (...args: any[]) => Promise<T>
}
var co: ICoStatic;
export default co;
}
@dallonf
dallonf / jsonify-bootstrap.js
Created Aug 4, 2015
Experiment: render Bootstrap variables to JSON file
View jsonify-bootstrap.js
let fs = require('fs');
let path = require('path');
let less = require('less');
let bluebird = require('bluebird');
let css = require('css');
async function execute() {
let variablesLess = await bluebird.fromNode(cb => fs.readFile(path.join(__dirname, 'less/variables.less'), 'utf-8', cb));
let [parseResult] = await bluebird.fromNode(cb => less.parse(variablesLess, cb));
let varNames = parseResult.rules
View gist:3f365373ae971d278706
var FloatingElement = React.createClass({
propTypes: {
children: React.PropTypes.element.isRequired,
floatingClassName: React.PropTypes.string
},
getDefaultProps() {
return {
floatingClassName: 'floating'
@dallonf
dallonf / gist:6178837
Created Aug 7, 2013
jQuery Monkey Testing
View gist:6178837
// Paste this into the Developer Console for any project that uses jQuery
function stopMonkey() {
clearInterval(monkey);
}
monkey = setInterval(function() {
var $els = $('body').find('*:visible');
var rand = Math.round(Math.random() * $els.length);
$els.eq(rand).click();
View sessions_controller.rb
class SessionsController < ApplicationController
layout 'basic'
def new
end
def create
puts params[:email]
puts params[:password]
@dallonf
dallonf / app.ts.js
Last active Dec 13, 2015
Using the Quintus Engine with TypeScript. This is just a proof-of-concept, it's WAY too early to actually use.
View app.ts.js
/// <reference path="quintus.d.ts" />
var Q = Quintus()
.include("Sprites, Scenes, Input");
// No need to call Q.Sprite.extend
class Player extends Q.Sprite {
init(p) {
super.init(p, {
asset: "somegraphic.png",
@dallonf
dallonf / await-script-compiled.js
Created Nov 13, 2012
AwaitScript compiler concept
View await-script-compiled.js
// AwaitScript sample compiled to JavaScript
var async = require('async');
function recurse(path, fn) {
var files = [];
fs.readdir(path, function(err, dir) {
if (err) return fn(err);
async.forEach(dir, function(f, fn) {
fs.stat(f, function(err, stat) {
if (err) return fn(err);
You can’t perform that action at this time.