Skip to content

Instantly share code, notes, and snippets.

View Glutnix's full-sized avatar
🦨
codin' up a storm

Brett Taylor Glutnix

🦨
codin' up a storm
View GitHub Profile
@Glutnix
Glutnix / outline.txt
Last active August 29, 2015 14:06
JavaScript outline
- Client Side – JavaScript
- <script type="text/javascript">…code here… </script>
- <script type="text/javascript" src="file.js"><!-- no code here --></script>
- statements
- semicolons;
- values and types
- string, number, boolean
- null, undefined, NaN
- var
- operators
@Glutnix
Glutnix / keybase.md
Created September 24, 2014 01:09
keybase.md

Keybase proof

I hereby claim:

  • I am glutnix on github.
  • I am glutnix (https://keybase.io/glutnix) on keybase.
  • I have a public key whose fingerprint is 847B D53F F668 623E 2852 7775 0F1F C976 14E2 99C8

To claim this, I am signing this object:

@Glutnix
Glutnix / processImage.sh
Created September 29, 2014 05:49
ImageMagick - scale up a folder of 14x14 alpha png images, add a black border, and save it.
#!/bin/bash
# IMAGEMAGICK
# scale image up using nearest neighbour
# extend canvas larger
# layer 1: clone 0, extract the alpha layer, and contrast it to black and white only, no grey
# layer 2: clone 1, blur clone 0 by 3px, then contrast it
# layer 3: clone 2: fill black with opaque white
# take layer 3, 0, 1, ignoring alpha, composite them over each other.
# delete layers 0,1,3, swap the last two layers, and, ignoring alpha, composite all the layers together copying the alpha layer
@Glutnix
Glutnix / filters.php
Created November 17, 2014 02:16
Laravel 4.2 Route filters for checking ownership
Route::filter('admin', function()
{
if (Auth::user()->role !== 'admin') return Redirect::to('login');
});
Route::filter('albumOwner', function($route, $request)
{
$album = Album::findOrFail($route->getParameter('albums'));
if ( $album->user_id !== Auth::id() && Auth::user()->role !== "admin") {
return Redirect::to('login');
@Glutnix
Glutnix / 0_reuse_code.js
Last active August 29, 2015 14:11
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
@Glutnix
Glutnix / javascript_resources.md
Last active August 29, 2015 14:11 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@Glutnix
Glutnix / css_resources.md
Last active August 29, 2015 14:11 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@Glutnix
Glutnix / tmux-session-exists-notify.sh
Last active December 18, 2015 17:28
Notification of existing tmux sessions. Add this to your .bashrc or .zshrc to be told when you login.
if [ -z "$TMUX" ]; then # not currently in a tmux session
tmux has-session >/dev/null 2>/dev/null
if [ $? = 0 ]; then # previous command exited with status 0
echo " "
echo "tmux: There are tmux session(s) running."
tmux ls
echo "run 'tmux attach' to re-attach."
fi
fi
@Glutnix
Glutnix / single-game.md
Last active April 21, 2016 05:14
Pyramid Buffet

Single Game page

  • Name
  • Alternate names
  • Designer
  • Year Published (if finished)
  • Year Development Began (if known, or still in development)

Facts

@Glutnix
Glutnix / index.js
Created February 4, 2019 21:26
cloudfront lambda to redirect requests for folders to the index.html inside that folder
/*
redirect requests for folders to folders/index.html
*/
const resolveUrlEndingInSlashToIndexHtml = require('./resolve-url-ending-in-slash-to-index-html');
exports.handler = (event, context, callback) => {
// Extract the request from the CloudFront event that is sent to Lambda@Edge
const { request } = event.Records[0].cf;