Skip to content

Instantly share code, notes, and snippets.

View gcollazo's full-sized avatar

Giovanni Collazo gcollazo

View GitHub Profile
<?
if(unserialize(base64_decode($_COOKIE["geolocation"])) == "PR" || unserialize(base64_decode($_COOKIE["geolocation"])) == "US"){ ?>
<div id="minBox" style="position:absolute; width: 312px; height: 129px; top: 4px; left: -1px;">
<script language="javascript">
function validate() {
var mobile2, Carriers;
mobile2 = document.getElementById("mobile2").value;
Carriers = document.getElementById("Carriers").value;
Get Linear Schedule for Channel: 328
Linear Schedule for Service Provider 63879 and Channel 328
--------------------------------------------
Getting airings from 2012-08-17 19:27:33.825069 to 2012-08-24 19:27:33.825069
Getting airings starting at 2012-08-17 19:27:33.825069....
News4 New York at 5 - Program 7476714 on Channel #241 WNBC
@ljos
ljos / cocoa_keypress_monitor.py
Last active August 12, 2024 17:34
Showing how to listen to all keypresses in OS X through the Cocoa API using Python and PyObjC
#!/usr/bin/env python
#
# cocoa_keypress_monitor.py
# Copyright © 2016 Bjarte Johansen <[email protected]>
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# “Software”), to deal in the Software without restriction, including
@tobyhede
tobyhede / postsql.sql
Created May 17, 2012 03:08
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@sergiolopes
sergiolopes / ios5webdebug.sh
Created March 2, 2012 21:47
Runs iOS 5 simulator with MobileSafari remote debug
#!/bin/bash
# Open iPhone Simulator on default location for XCode 4.3
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
# Open mobile safari
echo Open mobile safari on emulator and press return
read
# Plug debug to MobileSafari.app
@jamescasbon
jamescasbon / template.py
Created December 11, 2011 16:37
Pure python templates using with statement
"""
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
TL;DR
-----
This module defines a template language that allows us to do:
d = Doc()
@dadon
dadon / handlebars_translate.js
Created December 7, 2011 13:41
Django gettext in Handlebars.js templates
Handlebars.registerHelper('trans', function(fn) {
return gettext(fn(this));
});
@luckydev
luckydev / devs.rb
Created December 1, 2011 04:58
Types of Developers
# SeniorDev, AwesomeDev, NoviceDev
class SeniorDev
def do_some_old_stuff
puts "This is a piece of cake"
end
def method_missing(name, *args)
puts "Err.. What? #{name}??.. THAT IS IMPOSSIBLE! Leave me alone."
end