Skip to content

Instantly share code, notes, and snippets.

View paularmstrong's full-sized avatar
🐈‍⬛
Codes with cats

Paul Armstrong paularmstrong

🐈‍⬛
Codes with cats
View GitHub Profile
@paularmstrong
paularmstrong / a_star.js
Created May 12, 2011 21:22 — forked from jminor/a_star.js
A* path finding algorithm for impactjs game engine
// A* path finding algorithm for impactjs game engine
// adapted from http://stormhorse.com/a_star.js
// via http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html
// impact-ified by jminor - http://pixelverse.org/
/* Example:
this.pathFinder = new PathFinder();
var start = [((this.pos.x+this.size.x/2) / tilesize).floor(), ((this.pos.y+this.size.y/2) / tilesize).floor()];
var destination = [((target.pos.x+target.size.x/2) / tilesize).floor(), ((target.pos.y+target.size.y/2) / tilesize).floor()];
@paularmstrong
paularmstrong / JS_UserDefaults.h
Created June 30, 2011 00:35
Bridge for iOSImpact to interact with NSUserDefaults
//
// JS_UserDefaults.h
//
// Created by Paul Armstrong on 6/28/11.
// Copyright 2011 Paul Armstrong Designs. All rights reserved.
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
@paularmstrong
paularmstrong / gist:1152976
Created August 18, 2011 00:06
Use CSS3 to Display Link Targets
a[href^=http]:hover:after,
a[href^=http]:link:hover:after {
margin: 0 0 0 5px;
padding: 0 0.2em;
content: '(' attr(href) ')';
font-size: 0.8em;
position: absolute;
background: #C6CFEB;
color: #3A57AB;
}
@paularmstrong
paularmstrong / gist:1176767
Created August 28, 2011 15:01
NKO vote badge
#count {
font-family: Helvetica, Arial, Verdana, sans-serif;
font-weight: bold;
color: #FFF;
}
@paularmstrong
paularmstrong / gist:1196150
Created September 5, 2011 23:20
CSS3 Attribute Selectors Are Awesome
a[href*="twitter.com"],
a[href*="github.com"],
a[href*="dribbble.com"],
a[href*="linkedin.com"] {
background-image: url(images/icons.png);
background-position: 2px 2px;
background-repeat: no-repeat;
padding-left: 20px;
}
a[href*="github.com"] { background-position: 2px -23px; }
@paularmstrong
paularmstrong / jquery.fancyselect.css
Created September 12, 2011 17:05
Fancy Select Box replacement that allows you to style everything about your select box
.fancyselect {
display: inline;
position: absolute;
padding: 2px 2px 0 2px;
}
.fancyselect.open {
background: #FFF;
border: 2px solid #DDD;
padding: 0;
}
@paularmstrong
paularmstrong / filterkeys.js
Created September 22, 2011 19:27
filter keys from an object
function filterKeys(obj) {
var newObj = {}, key, url, i, newArr = [],
disallowed = ['constructor', 'target', 'currentTarget', 'relatedTarget', 'srcElement', 'toElement', 'view'];
for (key in obj) {
if (obj.hasOwnProperty(key) && disallowed.indexOf(key) === -1) {
if (Array.isArray(obj[key])) {
newArr = [];
i = obj[key].length;
while (i) {
i -= 1;
@paularmstrong
paularmstrong / clients.md
Created September 25, 2011 20:01 — forked from defunkt/clients.md
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@paularmstrong
paularmstrong / Makefile
Created September 30, 2011 01:55
node package to browser
browser:
@rm -rf browser/dist
@mkdir -p browser/dist
@echo "swig = (function () {" >> $(BROWSER_FILE)
@echo "var swig = {}," >> $(BROWSER_FILE)
@echo " dateformat = {}," >> $(BROWSER_FILE)
@echo " filters = {}," >> $(BROWSER_FILE)
@echo " helpers = {}," >> $(BROWSER_FILE)
@echo " parser = {}," >> $(BROWSER_FILE)
@echo " tags = {};" >> $(BROWSER_FILE)
@paularmstrong
paularmstrong / links.css
Created October 21, 2011 16:41
Create a larger hit area for links with a nicely sized background color hover state that doesn't throw off the inline layout of your text.