Skip to content

Instantly share code, notes, and snippets.

View russmatney's full-sized avatar

Russell Matney russmatney

View GitHub Profile
@Kilian
Kilian / annoying.js
Created January 6, 2011 15:04
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
@hoelzro
hoelzro / foo.bar.lua
Created October 19, 2011 21:07
Simple relative require in Lua
require 'baz'
@bchapuis
bchapuis / placeholdercolor.less
Created May 14, 2012 12:40
Less: mixin for placeholder color
.placeholder(@color) {
&::-webkit-input-placeholder {
color: @color;
}
&:-moz-placeholder {
color: @color;
}
}
@RainerAtSpirit
RainerAtSpirit / JekyllApps.js
Created July 9, 2012 12:18
Adding AngularJS search in Jekyll blog
/**
* Setup Module with `highlight` filter
*/
var JekyllApp = angular.module('JekyllApp', [], function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(false);
});
JekyllApp.filter('highlight', function () {
return function (text, filter) {
@metachu
metachu / metachuorg.lua
Created July 28, 2012 13:08
Org mode agenda for awesome-wm
local string = string
--local print = print
local tostring = tostring
local io = io
local table = table
local pairs = pairs
local capi = {
mouse = mouse,
screen = screen
}
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 17, 2024 13:10
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@lsiv568
lsiv568 / dropzone.coffee
Last active September 16, 2016 12:22
This directive uses the HTML5 drag and drop spec as well as the FileReader to base64 encode the dropped files. This allows for easy client/server transfer via REST protocol.
'use strict';
angular.module('reusableThings')
.directive('fileDropzone', () ->
restrict: 'A'
scope: {
file: '='
fileName: '='
}
link: (scope, element, attrs) ->
@terryyounghk
terryyounghk / momentjs-extensions.js
Last active December 31, 2015 15:29
Extensions for momentjs This is a small extension to moment.js, and adds the ability to add/subtract number of business days, snap to nearest business day, and calculate difference in terms of business days. Note that this simply excludes Sundays and Saturdays.
/* jshint laxbreak: true */
/**
* moment.js plugin: additional methods
* businessDiff (mStartDate)
* businessAdd (numberOfDays)
* businessSubtract (numberOfDays)
* business ([false])
*/
(function () {
var moment;
@mrunderhill89
mrunderhill89 / BehaviorTree.lua
Created April 18, 2014 17:13
Behavior Tree implementation in Lua.
--[[
This behavior tree code was taken from our Zelda AI project for CMPS 148 at UCSC.
It is for the most part unmodified, and comments are available for each function.
Author: Kevin Cameron (mrunderhill89)
]]--
BT = {}
BT.__index = BT
BT.results = {success = "success"
,fail = "fail"
@zxbodya
zxbodya / S3-CORS-config.xml
Last active April 6, 2024 03:40
Client side uploads to s3, with pre-signed upload form (PHP/JS)
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>