Skip to content

Instantly share code, notes, and snippets.

While I was experimenting with animation, I had to make a few basic prototypes for a layout system and see how they intertwine. Here's the API in conjunction with React:

var MyComp = React.createClass({
  registerLayoutValues: function() {
    return {
      self: {
        width: 30,
        left: (get('parent', 'width') - get('self', 'width')) / 2 // Center.
 }
@pthrasher
pthrasher / ForceCaseSensitivityPlugin.js
Created October 29, 2015 20:55 — forked from alexkirsz/ForceCaseSensitivityPlugin.js
Force case sensitivity in webpack
var fs = require('fs');
var path = require('path');
var _ = require('lodash');
module.exports = function ForceCaseSensitivityPlugin() {
this.plugin('normal-module-factory', function(nmf) {
nmf.plugin('after-resolve', function(data, done) {
var parentDir = path.dirname(data.resource);
var resourceName = path.basename(data.resource);
fs.readdir(parentDir, function(err, files) {
@pthrasher
pthrasher / gist:f2a03810fe9bce77888d
Created November 25, 2015 21:58 — forked from fdecampredon/gist:86ccbba3863bccaec7dd
Obtaining client window size on server
/*jshint node:true*/
var http = require('http');
var fs = require('fs');
var url = require('url');
var querystring = require('querystring');
var head = fs.readFileSync('head.html','UTF-8');
//<head>
// <meta charset="utf-8">
@pthrasher
pthrasher / README.md
Created February 16, 2016 20:22 — forked from 0x3333/README.md
Mac OS X - Wallpaper Changer - Swift

Mac OS X - Wallpaper Changer

Swift code to change the Wallpaper for all screens. Currently, it changes only the current spaces' wallpaper. I'm working on a version to change in all spaces.

Usage: WallpaperChanger "/Users/username/SomeFolder/SomePicture.jpg"

@pthrasher
pthrasher / 0_reuse_code.js
Created January 12, 2017 23:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pthrasher
pthrasher / index.html
Last active February 8, 2018 21:14 — forked from shancarter/index.html
Clustered Force Layout 4.0
<!doctype html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v4.min.js"></script>
<script>
let margin = {top: 100, right: 100, bottom: 100, left: 100};
let width = 960,
height = 500,