Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Martin justindmartin

View GitHub Profile
View Hello Pebble
navigator.geolocation.getCurrentPosition(function(pos) {
var coords = pos.coords;
Pebble.showSimpleNotificationOnPebble('Hello!',
'Your coordinates are ' + coords.latitude + ', ' + coords.longitude);
)}
@justindmartin
justindmartin / ron_nginx_configuration.conf
Created Oct 7, 2013
Getting started Nginx configuration for Ron.
View ron_nginx_configuration.conf
server {
listen 80;
root #replace this with the default full path to where all of your PHP files are;
index home;
server_name www.jumalabs.com #change to desired name, such as flipquiz.jumalabs.com;
location / {
rewrite ^/(.*)$ /index.php?url=$1 break;
@justindmartin
justindmartin / convertAnswerNumberToLetters.php
Created Sep 4, 2013
This converts answer choice numbers to letters.
View convertAnswerNumberToLetters.php
function convertAnswerNumberToLetters($number){
$LETTERS_DICTIONARY = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
$MAX_ITERATIONS = 20;
$letters = '';
$numIterations = 0;
while($number > 0 && $numIterations <= $MAX_ITERATIONS){
$index = $number;
for($temp = 0; $temp < $MAX_ITERATIONS && $temp < $number && $temp > 26; $temp -= 26){
View tunnel.sh
ssh -p remotePort -D localPort -C -q -N user@remoteHost
@justindmartin
justindmartin / Sigmoid Function.php
Last active Feb 8, 2019
This is a sigmoid function in PHP.
View Sigmoid Function.php
<?php
function sigmoid($t){
return 1 / (1 + pow(M_EULER, -$t));
}
?>
@justindmartin
justindmartin / eliminateDistractions.py
Created Apr 20, 2013
Script to block websites, which are distractions during coding
View eliminateDistractions.py
import sys
#open hosts file and read current data
hostsFile = open("/etc/hosts", "w+")
hostsFileData = hostsFile.read()
#host list
newHosts = [
"facebook.com",
"quora.com",
@justindmartin
justindmartin / JSMin.class.php
Created Mar 4, 2013
JSMin -- Ryan Grove <ryan@wonko.com> (PHP port) -- Steve Clay <steve@mrclay.org> (modifications + cleanup) -- Andrea Giammarchi <http://www.3site.eu> (spaceBeforeRegExp) -- 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c) -- 2008 Ryan Grove <ryan@wonko.com> (PHP port) -- http://opensource.org/licenses/mit-license.php MIT License -- http:…
View JSMin.class.php
<?php
/**
* JSMin.php - modified PHP implementation of Douglas Crockford's JSMin.
*
* <code>
* $minifiedJs = JSMin::minify($js);
* </code>
*
* This is a modified port of jsmin.c. Improvements:
*
@justindmartin
justindmartin / CSS, JS, HTML Minifier.php
Last active Sep 2, 2017
CSS, JS, and HTML minifier, written in PHP - requires JSMin.php
View CSS, JS, HTML Minifier.php
<?php
/* require JSMin class file */
require_once('JSMin.class.php');
class minifier{
function __Construct(){
}
function minifyCSS($CSS) {
/* remove comments */
$CSS = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $CSS);
@justindmartin
justindmartin / Global CSS Styles.css
Created Sep 2, 2012
These are some Global CSS rules that I use to maintain identical feel across all browsers
View Global CSS Styles.css
/* Global */
*{padding:0px; margin:0; border:none; outline:none; color:#333; font-family:Arial,Helvetica,sans-serif;}
*:focus{border:none; outline:none;}
html,body{height:100%;}
h1{font-size:32px !important;}
h2{font-size:24px !important;}
h3{font-size:19px !important;}
h4{font-size:16px !important;}
h5{font-size:13px !important;}
h6{font-size:11px !important;}