Skip to content

Instantly share code, notes, and snippets.

@stephen-james
stephen-james / rasterizeElement.js
Last active December 11, 2015 03:48
A helper script for use with phantomJS (http://phantomjs.org/) similar to rasterize.js allowing you to rasterize elements of a web page by specifying a selector.
/*
rasterizeElement.js
This file is a helper script for use with phantomJS (http://phantomjs.org/) similar to rasterize.js
allowing you to rasterize elements of a web page by specifying a selector.
Author - Stephen James
Twitter - @stephenhjames
GitHub - https://github.com/stephen-james
@stephen-james
stephen-james / gist:4593799
Created January 22, 2013 10:58
10gen education login screen input height fix
textarea, input[type="text"], input[type="email"], input[type="password"] {
background: #fafafa;
border: 1px solid #c8c8c8;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.6), inset 0 0 3px 0 rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.6), inset 0 0 3px 0 rgba(0, 0, 0, 0.1);
@stephen-james
stephen-james / ServiceCommandLine_Program.cs
Created March 15, 2013 12:35
Service that can run in command line
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
if (System.Environment.UserInteractive)
{
if (args.Length > 0)
{
switch (args[0])
@stephen-james
stephen-james / gist:5238264
Created March 25, 2013 16:10
easy formatted debug of viewmodel JSON in knockoutJS
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
@stephen-james
stephen-james / farseer.mixins.less
Last active December 15, 2015 11:29
Useful .LESS css mixins
.flex-box(@pack, @align, @orient)
{
display:-moz-box;
-moz-box-pack:@pack;
-moz-box-align:@align;
-moz-box-orient: @orient;
display:-webkit-box;
-webkit-box-pack:@pack;
-webkit-box-align:@align;
@stephen-james
stephen-james / gist:5318026
Created April 5, 2013 09:43
Distance from Origin, distance between two pixels
// using pythags awesomeness
var distanceFromOrigin = Math.sqrt(Math.pow(origin.x - e.clientX, 2) + Math.pow(origin.y - e.clientY, 2));
@stephen-james
stephen-james / gist:5405023
Last active December 16, 2015 08:19
regex for decomposing transition css declarations (using this in the arc menu widget)
(.*)(left|top|opacity|height|width|transform|-webkit-transform)\s*(initial|\s*-?[0-9]*\.?[0-9]*m?s?)\s*(initial|linear|ease(?:-in|-out|-in-out)?|cubic-bezier\((?:\s*-?[0-9]*?\.?[0-9]*?\s*,?)*?\))?(initial|\s*-?[0-9]*\.?[0-9]*m?s?)?(.*)
@stephen-james
stephen-james / examples.html
Created April 25, 2013 15:44
Vertical alignment of child elements, using table-cell, flexbox 2009 and CSS3 flexbox http://jsfiddle.net/stephen_james/Q4XpP/2/
<h1>Centering items vertically</h1>
<h2>using <code>display : table-cell</code></h2>
<div class="center-align-method-tablecell">
<div class="align-center">
Some text
<div class="box box1">box 1</div>
<div class="box box2 align-center">box 2</div>
<div class="box box3">box 3</div>
</div>
@stephen-james
stephen-james / dabblet.css
Created May 13, 2013 16:07
Responsive Layout using flexible box model [on dabblet](http://dabblet.com/gist/5569449).
/**
* style.css
*/
/*
this css uses Lea Verou's prefix free, if you port it out of dabblet, add the prefixes!
*/
/* resets */
html, body
@stephen-james
stephen-james / gist:6040103
Created July 19, 2013 15:39
Generating Metaproj for MSBuild from solution file
>set MSBuildEmitSolution=1
>msbuild MySolution.sln /p:Configuration=Debug;Platform="Any CPU";OutputDir=bin