Skip to content

Instantly share code, notes, and snippets.

View mexitek's full-sized avatar

Arlo Carreon mexitek

View GitHub Profile
@mexitek
mexitek / khan_marklet.js
Created September 11, 2011 01:14
Khan Academy Bookmarklet that is meant to automatically answer your current question correctly. Simply copy and paste this code into a new bookmark.
javascript:
/* Build URI endpoint for Khan API */
var url="/api/v1/user/exercises/"+userExercise.exercise+"/problems/"+(userExercise.total_done+1)+"/attempt";
/* Slowly, but surely, collecting the data for a successfull API call */
var data={
complete:1,
count_hints:0,
time_taken:Math.floor(Math.random()*10),
attempt_number:userExercise.total_done+1,
@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 / json_to_postgre.php
Created August 25, 2011 19:12
Script to automate an import process from .json file to postgre DB.
<?php
# Configure
$DB_USER = 'admin';
$DB_PASS = 'qwerty';
$DB_HOST = 'localhost';
$DB_NAME = 'postgis-2-0';
// Param 3 when ran in shell will override this value
$DB_TABLE = 'public.florida_establishments_garman';
// Param 2 when ran in shell will override this value
$CATEGORY = 'misc';
@mexitek
mexitek / Recover_Hidden_Web_Passwords.js
Created March 30, 2011 19:29
Reveals any passwords that are masked behind bullets on any password field. Copy/Paste this code into a new BOOKMARK in your browser
javascript:
var s='',f = document.getElementsByTagName('input');
for(var i=0;i<f.length;i++){
if(f[i].type.toLowerCase()=='password' && f[i].value)
{s+='found: '+f[i].value+' \n';}
}
s=(s)?s+'\nThat\'s All Folks!':'No Passwords Found';
alert(s);
@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 / 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: