Skip to content

Instantly share code, notes, and snippets.

View jasonsturges's full-sized avatar

Jason Sturges jasonsturges

View GitHub Profile
@jasonsturges
jasonsturges / unicorn-voting-2014.user.js
Last active August 29, 2015 13:58
Stack Exchange Unicorn Voting 2014 User Script
// ==UserScript==
// @name Unicorn Voting 2014
// @description Unicorn voting animations for everyone! FOREVER! (2014 edition)
// @version 1.0
// @include http://stackoverflow.com/*
// @include http://meta.stackoverflow.com/*
// @include http://superuser.com/*
// @include http://serverfault.com/*
// @include http://stackapps.com/*
// @include http://*.stackexchange.com/*
@jasonsturges
jasonsturges / readme.md
Created November 5, 2014 22:10
Referencing RequireJS config instance

RequireJS config may be referenced via:

var config = requirejs.s.contexts._.config;

Given a require such as:

require.config({
    property: "value"
});
@jasonsturges
jasonsturges / Library.js
Last active January 4, 2016 07:08
JavaScript Backbone inheritance super method, Adobe DPS
ADOBE.LibraryView = ADOBE.AppView.extend({
initialize: function (isAPIAvailable, isOnline) {
ADOBE.LibraryView.__super__.initialize.apply(this, arguments);
}
});
@jasonsturges
jasonsturges / photo-resize.jsx
Created June 16, 2016 19:22
Scale images to multiple sizes in Photoshop using JSX scripted batch processing automation
#target "photoshop"
if (BridgeTalk.appName == "photoshop") {
app.bringToFront();
var inputFolder = Folder.selectDialog("Select the folder containing photos to be resized."),
imageSizes = [2048, 1024, 512, 256];
if (inputFolder != null) {
var fileList = inputFolder.getFiles(/\.(jpg|jpeg|tif|psd|)$/i);
@jasonsturges
jasonsturges / index.html
Last active January 6, 2017 19:12
Flexbox masonry grid, similar to 500px image layout, from example: https://github.com/xieranmaya/blog/issues/6
<html lang="en" ng-app="app">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=1080">
<title>Cats</title>
<style>
body {
margin: 0;
overflow-x: hidden;
}
@jasonsturges
jasonsturges / build-hxcpp.sh
Created March 29, 2017 22:02
Build and install Haxe Foundation hxcpp haxelib for macOS from latest GitHub commit
#!/bin/bash
#### Description: Build and install Haxe Foundation hxcpp haxelib for macOS
#### from latest GitHub: https://github.com/HaxeFoundation/hxcpp
#### Written by: Jason Sturges - jason@jasonsturges.com on 2017-03-29
haxelib remove hxcpp
haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp.git
cd /usr/local/lib/haxe/lib/hxcpp/git/tools/hxcpp
@MenuItem ("Terrain/Object to Terrain")
static function Object2Terrain () {
// See if a valid object is selected
var obj = Selection.activeObject as GameObject;
if (obj == null) {
EditorUtility.DisplayDialog("No object selected", "Please select an object.", "Cancel");
return;
}
if (obj.GetComponent(MeshFilter) == null) {
@jasonsturges
jasonsturges / readme.md
Created September 10, 2014 17:39
Toggle hidden files Automator script for Mac OS X

To start, open up Automator (in the Applications folder) and choose a Service template. From the library choose "Run Shell Script" and drag it across to the workflow area. In the text box paste the following command:

STATUS=`defaults read com.apple.finder AppleShowAllFiles`
if [ $STATUS == YES ]; 
then
    defaults write com.apple.finder AppleShowAllFiles NO
else
    defaults write com.apple.finder AppleShowAllFiles YES
fi

killall Finder

@jasonsturges
jasonsturges / .gitignore
Created July 16, 2020 03:29
Unity git ignore
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
@jasonsturges
jasonsturges / Math.log10.js
Last active August 25, 2020 06:03
Math.log10
Math.log10(n);
// Equivalent polyfill:
Math.log(n) * Math.LOG10E