Skip to content

Instantly share code, notes, and snippets.

View mexitek's full-sized avatar

Arlo Carreon mexitek

View GitHub Profile
@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;
@mexitek
mexitek / postgis_fill_points.sql
Created August 26, 2011 00:36
Postgre Function that fills in a table calls points with random Lat/Long for location field and a unique name
DECLARE
amount ALIAS FOR $1;
r_lat FLOAT;
r_lon FLOAT;
BEGIN
FOR v_Count IN 1..amount LOOP
r_lat := random()*360;
r_lon := random()*360;
INSERT INTO points (name_of_place,location) VALUES ( 'place_'||v_Count, makepoint( r_lat, r_lon) );
END LOOP;
@mexitek
mexitek / init.rb
Created August 2, 2011 19:04
Moved: https://github.com/mexitek/redmine_wiki_html_util - Redmine Wiki Extension that allows placement of raw HTML, CSS or JS into your wiki. Useful for Web UI Demos.
#
# vendor/plugins/redmine_wiki_html_util/init.rb
#
require 'redmine'
require 'open-uri'
Redmine::Plugin.register :redmine_gist do
name 'Redmine Wiki HTML Util'
author 'Arlo Carreon'
author_url 'http://www.arlocarreon.com/'
@mexitek
mexitek / SubPub.lua
Created June 30, 2011 01:21
Lua SubPub Utility (or PubSub, whatevs)
--
-- subpub.lua
--
-- Created by Arlo Carreon on 2011-06-29.
-- MIT License: 2011 Corillo Apps.
--
-- SUBPUB.lua : A hub for application events. Class can publish an event,
-- all methods subscribed to said event will be executed.
--
-- Try out the test below!!
@mexitek
mexitek / JSON.js
Created May 18, 2011 19:12
Quick and Dirty JSON object for any small app
// JSON detection
var JSON = JSON || {};
// implement JSON.stringify serialization
JSON.stringify = JSON.stringify || function (obj) {
var t = typeof (obj);
if (t != "object" || obj === null) {
// simple data type
if (t == "string") obj = '"'+obj+'"';
return String(obj);
@mexitek
mexitek / Websnapr_Thumbnail_Hack.html
Created May 12, 2011 21:00
Made this hack to display the failed attempt at securing a JS service
<!-- // Include their JS service -->
<script src="http://www.websnapr.com/js/websnapr.js"></script>
<script>
// Use this function instead of wsr_snapshot()
function wsr_snapshot2(url,key,size,link){
link=typeof(link)!='undefined'?link:1;
if(size==''||size==undefined){size='s'};
var src="http://images.websnapr.com/?size="+(size.toLowerCase()=='t' || '' ?'t':'s')+
"&key="+encodeURIComponent(key)+
@mexitek
mexitek / SimpleGeo Feature Categories HTML
Created April 6, 2011 15:33
List of SimpleGeo Feature Categories as of 4/6/2011 used the JSON representation via https://gist.github.com/732639 @mager to generator this HTML
<style>
td {text-align:center}
</style>
<table>
<tbody>
<tr>
<th>Category ID</th>
<th>Sub Category</th>
<th>Category</th>
<th>Type</th>
@mexitek
mexitek / Coldfusion and Facebook's signed_request Param
Created March 24, 2011 02:48
How to handle facebook's signed_request FORM Parameter in Coldfusion
<!--- Check for the param --->
<cfparam name="FORM.signed_request" default="">
<!--- Split the param by the . --->
<cfset raw_str = ListGetAt(FORM.signed_request, 2, ".")>
<!--- Add padding if string is too short. --->
<!--- CF Fix: Exception invalid base64 string --->
<cfset res = Len(raw_str) % 4>
<cfif res eq 2>