Skip to content

Instantly share code, notes, and snippets.

View voodooGQ's full-sized avatar

Shane Smith voodooGQ

View GitHub Profile
@voodooGQ
voodooGQ / LICENSE.txt
Created October 4, 2019 14:29 — forked from davidwhitney/LICENSE.txt
A Tiny Typescript mocking... um... library? class? That doesn't annoy me, and doesn't cause Typescript linters to get confused or fill your code up with :anys. The license is MIT.
Copyright (c) 2019 David Whitney
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, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@voodooGQ
voodooGQ / lambda-basic-auth.js
Created February 15, 2019 16:50 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@voodooGQ
voodooGQ / singleton_spec.rb
Created March 23, 2018 14:33
RSpec Singleton
describe MySingleton, "#not_initialised" do
before(:each) { Singleton.__init__(MySingleton) }
end
@voodooGQ
voodooGQ / .rubocop.yml
Created November 20, 2017 19:49
Github Rubocop Adendum
inherit_gem:
rubocop-github:
- config/default.yml
- config/rails.yml
AllCops:
Exclude:
- 'bin/*'
- 'Gemfile'
- 'Guardfile'
DisplayCopNames: true
@voodooGQ
voodooGQ / getImageMeta.php
Last active August 29, 2015 14:02
getImageMeta
<?php
/**
* Returns image meta data based on the image ID supplied
*
* @param int $imageID The image post id
* @return array
*/
public static function getImageMeta($imageID)
{
@voodooGQ
voodooGQ / gist:8474406
Last active January 3, 2016 14:09
Dogge Git
alias such=git
alias very=git
alias wow='git status'
$ wow
$ such commit
$ very push
@voodooGQ
voodooGQ / gist:7789859
Created December 4, 2013 15:49
CD to current finder window
# Place in your ~/.bash_profile
# cd to current finder window
function cdfinder()
{
cd "$(osascript -e 'tell application "Finder"' \
-e 'set myname to POSIX path of (target of window 1 as alias)' \
-e 'end tell' 2>/dev/null)"
}
@voodooGQ
voodooGQ / pmo.php
Last active December 26, 2015 22:29
Post Meta Object
<?php
/**
* Returns all "public" meta items for $post in the form of an object
* Useful for reducing server calls
*
* @param int $post_id The ID of the post
* @return object
*/
function post_meta_object($post_id) {
$meta = get_post_meta($post_id);
@voodooGQ
voodooGQ / gist:4057330
Created November 12, 2012 03:28
REGEX: Parse URL into individual parts (JavaScript: The Good Parts)
REGEX: Parse URL into individual parts (Javascript: The Good Parts)
<script type="text/javascript" language="javascript">
var parse_url = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/;
var url= "http://www.ora.com:80/goodparts?q#fragment";
var results = parse_url.exec(url);
var names = ['url', 'scheme', 'slash', 'host', 'port', 'path', 'query', 'hash'];
@voodooGQ
voodooGQ / walker-nav-example.php
Created November 8, 2012 17:24 — forked from norcross/walker-nav-example.php
example of custom Walker for nav
// Menu output mods
class description_walker extends Walker_Nav_Menu
{
function start_el(&$output, $item, $depth, $args)
{
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';