Skip to content

Instantly share code, notes, and snippets.

View baileylo's full-sized avatar

Logan Bailey baileylo

View GitHub Profile
@baileylo
baileylo / gist:2143103
Created March 21, 2012 00:43
How I encrypt passwords!
<?php
function bestEncryptionEver($plain_text) {
$hash = array(
'q' => 'w',
'w' => 'e',
'e' => 'r',
'r' => 't',
't' => 'y',
'a' => 's',
@baileylo
baileylo / gist:1926710
Created February 27, 2012 20:11
gdgt lunch decider
(Math.floor(Math.random()*(100)) % 2 )?console.log('Chiptole') : console.log('Quiznos');
console.lol = function() {
return console.log.apply(null, arguments);
};
@baileylo
baileylo / gist:1733553
Created February 3, 2012 23:06
First js in jquery - I did bad
/*
FILE ARCHIVED ON 9:31:31 Jan 3, 2010 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 23:03:13 Feb 3, 2012.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
@baileylo
baileylo / gist:1711831
Created January 31, 2012 17:50
Which would you rather see?
<?php
// Which would you rather see
// Option 1 - double assignment
function isInCharge($name) {
$in_charge = false;
if ($name === 'Charles') {
$in_charge = true;
trigger_event('Play Charles In Charge theme song');
<?php
$prev_line = false;
foreach ($data as $line){
// go through each line, showing it as required, if it is surrounded by '<>' then
// assume that it is a title
$prev_line = $line=chop($line);
if (strlen($line) && $line[0]=='#'){
<div id="admin_categories" class="admin">
{include_component name='Admin::adminNav' selected='categories'}
<div class="col-right">
<!-- Put page contents here --!>
</div>
</div>
<?php
function shouldWeEatChipotle() {
return (substr(date('l'), -1) == 'y');
}
@baileylo
baileylo / gist:939084
Created April 23, 2011 23:34
Simple check api wrapper for jquery
(function( $ ){
$.fn.checkValidity = function() {
var html_object = this.get.(0);
if (typeof html_object.checkValidity != 'function') {
switch(this.attr('type')) {
case 'email':
// add email validation
break;
case 'url':
// Add url validation
<?php
foreach($class_list as $classname) {
$reflector = new ReflectionClass($classname);
$ini_config_data[strtolower($classname)] = $reflector->getFileName();
}
?>