This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe MySingleton, "#not_initialised" do | |
before(:each) { Singleton.__init__(MySingleton) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inherit_gem: | |
rubocop-github: | |
- config/default.yml | |
- config/rails.yml | |
AllCops: | |
Exclude: | |
- 'bin/*' | |
- 'Gemfile' | |
- 'Guardfile' | |
DisplayCopNames: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias such=git | |
alias very=git | |
alias wow='git status' | |
$ wow | |
$ such commit | |
$ very push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']; |
NewerOlder