Skip to content

Instantly share code, notes, and snippets.

View iholler's full-sized avatar

Stephen King iholler

  • Knoxville, TN
View GitHub Profile
@iholler
iholler / bluehollercreative-gmap-functions.js
Last active December 16, 2015 05:28
CUSTOM GMAP3 BUILD - Calculate distance from current location. Two Functions: 1. Loads map with markers for current location and a specified destination. 2. Re-loads the same map, but this time checks for the distance between the current location and the destination and checks to see if the user is within a given range. If true - returns an aler…
// Author: Stephen King
// Contact: stephen.curtis.k@gmail.com
// Credits: http://www.gmap3.net
// Created using Google maps and the "gmap3" framework.
/* =========================================================================================
AUTHOR NOTES
=========================================================================================
//LOAD initMap(); function at the end of your HTML document before the closing "body" tag.
LOAD destination(); function through a button's onclick="distance();"
@djKianoosh
djKianoosh / ie-shims.js
Created October 21, 2013 20:36
IE shims for array indexOf, string startsWith and string trim
// Some common IE shims... indexOf, startsWith, trim
/*
Really? IE8 Doesn't have .indexOf
*/
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this === null) {
throw new TypeError();
{
"scope": "source.css",
"completions":
[
{ "trigger": "l|left", "contents": "left:$1;$0" },
{ "trigger": "r|right", "contents": "right:$1;$0" },
{ "trigger": "t|top", "contents": "top:$1;$0" },
{ "trigger": "b|bottom", "contents": "bottom:$1;$0" },
{ "trigger": "z|z-index", "contents": "z-index:$1;$0" },
@tbrianjones
tbrianjones / download_file_to_client_computer.php
Last active October 28, 2021 02:49
Simple way to write data to a file and save it to a Client's computer when they click a link, using only PHP and HTML.
<?php
// this is a single page that can access and write any data to a file
// on a clients computer when they click a link using only HTML and PHP
//
// this will keep the data between page loads
session_start();
// download file if $_GET['download_file'] is set to true
@LeCoupa
LeCoupa / casperjs.cheatsheet.js
Last active January 23, 2022 07:56
Cheatsheet: CasperJS, PhantomJS & Spooky --> https://github.com/LeCoupa/awesome-cheatsheets
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
@LeaVerou
LeaVerou / gray.scss
Last active May 16, 2022 13:05
Polyfill gray() from CSS Color Level 4 with SASS
@function gray($intensity, $alpha: 1) {
@return rgba($intensity, $intensity, $intensity, $alpha);
}
/* Thanks Chris Eppstein for simplifying my code! */
/* Testing our new function */
body {
background: gray(50%);
background: gray(255, .2);
@scripting
scripting / sendToSlack.js
Last active July 9, 2022 13:03
A tiny JavaScript app that sends a message to your default Slack channel. Can be customized with a name, icon, emoji or sent to a different channel. Runs in Node.js.
var request = require ("request");
var urlWebHook = "https://hooks.slack.com/services/abcdef"; //the URL you get on your "incoming web hooks" page.
function sendToSlack (s, theUsername, theIconUrl, theIconEmoji, theChannel) {
var payload = {
text: s
};
if (theUsername !== undefined) {
payload.username = theUsername;
@plasticbrain
plasticbrain / gist:3887245
Created October 14, 2012 04:00
PHP: mime types (array format)
<?php
$mime_types = array(
'.3dm' => 'x-world/x-3dmf',
'.3dmf' => 'x-world/x-3dmf',
'.a' => 'application/octet-stream',
'.aab' => 'application/x-authorware-bin',
'.aam' => 'application/x-authorware-map',
'.aas' => 'application/x-authorware-seg',
'.abc' => 'text/vnd.abc',
'.acgi' => 'text/html',
@joelambert
joelambert / README
Created June 1, 2011 11:03
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@omz
omz / FileTransfer.py
Last active August 8, 2023 14:44
File Transfer script for Pythonista (iOS)
# File Transfer for Pythonista
# ============================
# This script allows you to transfer Python files from
# and to Pythonista via local Wifi.
# It starts a basic HTTP server that you can access
# as a web page from your browser.
# When you upload a file that already exists, it is
# renamed automatically.
# From Pythonista's settings, you can add this script
# to the actions menu of the editor for quick access.