Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Mirande busticated

View GitHub Profile
View gist:1296340
[18-Oct-2011 18:50:22] SET NAME XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[18-Oct-2011 18:50:22] - - - - - - - - this->name = dummy-test
[18-Oct-2011 18:50:22] SET QUALIFICATION XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[18-Oct-2011 18:50:22] - - - - - - - - vary_cache_on_function = true
[18-Oct-2011 18:50:22] - - - - - - - - is_qualified = true
[18-Oct-2011 18:50:22] CHECKING FOR SEG XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[18-Oct-2011 18:50:22] - - - - - - - - test = return (bool) isset( $_COOKIE["dummy-test"] );
[18-Oct-2011 18:50:22] - - - - - - - - vary_cache_on_function = false
[18-Oct-2011 18:50:22] NEEDS SEGMENT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@busticated
busticated / gist:1348409
Created Nov 8, 2011 — forked from jrburke/basic.js
possible jquery plugin boilerplate
View gist:1348409
(function(root, factory) {
if (typeof exports === 'object') {
// Node/CommonJS
factory(require('jquery'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Use a named plugin in case this
// file is loaded outside an AMD loader,
// but an AMD loader lives on the page.
define('myPlugin', ['jquery'], factory);
} else {
@busticated
busticated / arena.js
Created Mar 28, 2012
AMDWTF: So you want to AMD...
View arena.js
define( [ 'jquery', 'mods/crazydot' ], function( $, CrazyDot ){
var dots = [];
var setup = function( cfg ){
while ( dots.length < cfg.count ){
dots.push( new CrazyDot( cfg.speed, 'body' ).move() );
}
};
var stopGame = function(){
@busticated
busticated / gist:5961163
Last active Dec 19, 2015
angularjs routes... how do they work?
View gist:5961163
app.config(function($routeProvider, $locationProvider){
$locationProvider.html5Mode(true).hashPrefix('!');
$routeProvider
.when('/', {
templateUrl: '/html/home.html',
controller: 'HomeCtrl'
})
.when('/templates', {
templateUrl: '/html/tmpl.list.html',
controller: 'TmplCtrl'
View tmpl.dialog.addimg.html
app.factory('fileUpload', function($q){
return {
send: function(files){
var deferred = $q.defer(),
data = new FormData(),
xhr = new XMLHttpRequest();
angular.forEach(files, function(file){
data.append('file', file, file.name);
});
View gist:797d552bc8c47174c4e5
<html>
<head></head>
<body>
<!-- #container wraps the entire page's markup (except on-demand stuff like modals) -->
<!-- #container's children and classnames change based on the current view / route -->
<div id="#container" class="VIEW VIEW--MODE">
<nav></nav>
<header></header>
<main></main>
<footer></footer>
@busticated
busticated / viewport.html
Created Jan 4, 2016
viewport dimensions test harness
View viewport.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no" />
<style>
html,
body {
View gist:bc5de9dbdbf2d4f2b3524cbacf725844
here's an interesting snippet from my `stats.json` file as generated by webpack v2.2.1
notes:
+ for brevity, i've stripped out the actual "source": field
+ the only modules i recognize in the block copied below are:
* dom.js (/path/to/my/project/lib/client/util/dom.js - a module i wrote)
* transit.js (/path/to/my/project/node_modules/transit-js/transit.js - a dependency of a dependency)
+ both dom.js and transit.js use `Buffer` in the node.js context only (e.g. if node.js, use Buffer, else other thing)
+ `"userRequest": "Buffer"` <-- does this mean webpack found a mention of the `Buffer` variable and that's why it's being included?
View codemod-react-proptypes.js
'use strict';
///////////////////////////////////////////////////////////////////////////////
// USAGE: jscodeshift ./lib/ -t ./scripts/codemod-react-proptypes.js
///////////////////////////////////////////////////////////////////////////////
module.exports = function(file, api){
var js = api.jscodeshift,
root = js(file.source),
shouldFixWhitespace,
collection;
@busticated
busticated / Foo.js
Created Jan 11, 2018
React Context + GatsbyJS
View Foo.js
// src/components/Foo.js
import createClass from 'create-react-class';
import { div, em } from 'react-dom-factories';
import PropTypes from 'prop-types';
export default createClass({
displayName: 'Foo',
contextTypes: {
count: PropTypes.number