Skip to content

Instantly share code, notes, and snippets.

View joshbuchea's full-sized avatar

Josh Buchea joshbuchea

View GitHub Profile
@joshbuchea
joshbuchea / random-password.php
Last active January 9, 2018 18:55
Generate random passwords
<?php
function random_password( $length = 8 ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
$password = substr( str_shuffle( $chars ), 0, $length );
return $password;
}
?>

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

Elevator Hack

This elevator "hack" will allow you to go immediately to your destination floor, bypassing all previously queued floors.

  1. Press & hold close door button until doors close. Keep holding.
  2. Press floor # button and do not release close door button until elevator moves.

Note: One LifeHacker commenter said: "it is completely dependant on the Logic Controller being used in the motor room of the elevator, as this trick does not work on older elevators".

To Do

@joshbuchea
joshbuchea / plist-to-json.sh
Created July 28, 2015 00:06
A shell script for Automator that can convert .plist to .json file.
for f in "$@"
do
filename="${f%.*}"
plutil -convert json "$filename".plist -o "$filename".json
done
@joshbuchea
joshbuchea / .gitignore
Last active August 29, 2015 14:26 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@joshbuchea
joshbuchea / 0_reuse_code.js
Last active August 29, 2015 14:27
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
@joshbuchea
joshbuchea / cordova-default-csp.xml
Last active August 29, 2015 14:27
Cordova sensible Content-Security-Policy defaults
<meta http-equiv="Content-Security-Policy" content="
default-src 'self' data: gap: https://ssl.gstatic.com;
script-src 'self' 'unsafe-inline' 'unsafe-eval';
style-src 'self' 'unsafe-inline';
img-src 'self' data:;
media-src *;">
@joshbuchea
joshbuchea / android-expansion-steps.md
Last active October 2, 2017 12:28
Steps to get cordova-plugin-xapkreader working with Ionic/Cordova 5 project
@joshbuchea
joshbuchea / bootstrap-starter.html
Last active April 19, 2016 05:34
Bootstrap starter template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap Starter Template</title>
<!-- Bootstrap -->
@joshbuchea
joshbuchea / force-lowercase-urls.php
Created October 18, 2015 06:28
A function to redirect uppercase URLs to lowercase.
/**
* Changes the requested URL to lowercase.
*
* Only if URL does not include a filename or query variable.
*/
function force_lowercase_urls() {
// Grab requested URL
$url = $_SERVER['REQUEST_URI'];
// If URL contains a period, halt (likely contains a filename and filenames are case specific)
if ( preg_match('/[\.]/', $url) ) {