Skip to content

Instantly share code, notes, and snippets.

View mexitek's full-sized avatar

Arlo Carreon mexitek

View GitHub Profile
@mexitek
mexitek / scanDir.php
Created July 9, 2013 05:32
Run this PHP script via command line and see all the directories with contents over 1 KB.
<?php
// Base directory is where you run the script from
$currentDirectory = '.';
// Get all contents, minus pointers to . and ..
$baseLevelContents = array_diff( scandir( $currentDirectory ), array('..','.') );
// All directories
$baseDirs = array_filter( $baseLevelContents, "is_dir" );
@mexitek
mexitek / everOther.js
Last active December 19, 2015 03:19
A handlebars helper for displaying a block every x iterations of a loop.
Handlebars.registerHelper("everyOther", function (index, amount, scope) {
if ( ++index % amount )
return scope.inverse(this);
else
return scope.fn(this);
});
@mexitek
mexitek / gist:5540805
Last active December 17, 2015 03:08 — forked from alvarezr/gist:5540771
-- DELETE duplicate entry
DELETE
FROM L_table
WHERE id NOT IN (SELECT MIN(id) id
FROM L_table
GROUP BY l_field, etc ASC);
@mexitek
mexitek / permissions.php
Last active December 16, 2015 16:40
Sample class for bitmasked permissions
<?php
/**
* @author Arlo Carreon
*
*/
class Permissions {
// Bitmasks
const REPORTS = 1;
const QUIZES = 2;
@mexitek
mexitek / prep.js
Created November 20, 2012 19:15
JS Template String vs Jquery DOM Creation
var hotelObj = {"hotelId":"2653","p":"30","n":"America`s Best Inn Main Gate East","d":"In the Walt Disney World Resort Area offering FREE Shuttle Service! A great family vacation spot nearby the major theme parks of Orlando Florida.","lat":"28.3321","lng":"-81.4892","a":"All Orlando","aid":"19","v":"","url":"http:\/\/bookitsb.com\/us\/florida\/orlando\/hotels\/americas-best-inn-main-gate-east\/","nr":"0","sr":"25","tr":"","fr":"","tsm":"","rqm":"","r":"Deluxe Room","pr":"","su":"Near Disney, Kissimmee - Hotel with FREE Theme Park Shuttles","ma":"In the Walt Disney World Resort Area offering FREE Shuttle Service!","fc":"","i":"","am":"","li":"MCO","ln":"Orlando, Florida, United States","c":{"l":"BONUS","n":"JOINT TEST"},"st":"50","img":"\/\/images.bookit.com\/RA10168\/RA10168_227891_TN.jpg"};
window.buildHotelHTML = function( hotelData){
var str = '<div class="hidden pod resultsPod hotelResults rowClearOFH ' + '">\
<input type="hidden" name="hotelUniqueId" value="' + hotelData.hotelId + '" disabled="disabl
@mexitek
mexitek / build.log
Created January 18, 2012 05:41
Titanium Mobile Error
Starting build at 01/17/12 23:50
Build details:
timestamp=12/13/10 21:20
version=1.5.0
githash=efb9caa
Script arguments:
@mexitek
mexitek / GeoIPCity.dat
Created December 16, 2011 19:40
GeoIP and Varnish - Attempt to respond with user's city, lat and long information
This file has been truncated, but you can view the full file.
@mexitek
mexitek / config.json
Created October 30, 2011 16:48
Github's hubot on Joyent's No.de machines. Read the comments for instructions.
{"version": "v0.4.11"}
@mexitek
mexitek / classes.php
Created October 24, 2011 23:13
Super and subclass variable inheritence
<?php
# Our super class
class A {
protected static $login;
protected static $pass;
# public static setter
# Maybe, replaces constructor
public static function setLogin($l,$p){
@mexitek
mexitek / ignoreConfigs.sh
Created September 19, 2011 18:38
Remove and untrack test/config files in Git
echo "*.config">>.gitignore;
git rm --cached "*.config";
git add .;
git commit -m "Ignoring and deleting config files." ;
git push origin;