Skip to content

Instantly share code, notes, and snippets.

Stephen King iholler

  • Knoxville, TN
View GitHub Profile
@scripting
scripting / sendToSlack.js
Last active May 12, 2020
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.
View sendToSlack.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;
@tbrianjones
tbrianjones / download_file_to_client_computer.php
Last active Aug 5, 2019
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.
View download_file_to_client_computer.php
<?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
@p3t3r67x0
p3t3r67x0 / prefixed-office-properties.md
Last active Jan 3, 2020
MS Office prefixed style properties can be used for older versions of MS Excel, MS PowerPoint or MS Word when you want to save a document, presentation, workbook, or worksheet as a web document, or even in older versions for MS Outlook.
View prefixed-office-properties.md

MS Office prefixed style properties

mso-ansi-font-size

Note: Office only

mso-ansi-font-size: large | larger | <length> | medium | <percentage> | small | smaller | x-large | x-small | xx-large | xx-small
@jirutka
jirutka / -README.md
Last active Jul 23, 2020
How to use terminal on Windows and don’t go crazy…
View -README.md

How to use terminal on Windows without going crazy…

Windows is really horrible system for developers and especially for devops. It doesn’t even have a usable terminal and shell, so working with command line is really pain in the ass. If you really don’t want to switch to any usable system (OS X, Linux, BSD…), then this guide should help you to setup somewhat reasonable environment – usable terminal, proper shell, ssh client, git and Sublime Text as a default editor for shell.

Install stuff

  1. Download and install Git for Windows* with:
    • [✘] Use Git from the Windows Command Prompt
    • [✘] Checkout as-is, commit Unix-style line endings
View casperjs.cheatsheet.js
// 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 11, 2019
Polyfill gray() from CSS Color Level 4 with SASS
View gray.scss
@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);
@joyrexus
joyrexus / README.md
Last active Aug 4, 2020 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods
View README.md

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@djKianoosh
djKianoosh / ie-shims.js
Created Oct 21, 2013
IE shims for array indexOf, string startsWith and string trim
View ie-shims.js
// 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();
@iholler
iholler / bluehollercreative-gmap-functions.js
Last active Dec 16, 2015
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…
View bluehollercreative-gmap-functions.js
// 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();"
View gist:5075355
My thoughts on writing tiny reusable modules that each do just one
thing. These notes were adapted from an email I recently sent.
***
If some component is reusable enough to be a module then the
maintenance gains are really worth the overhead of making a new
project with separate tests and docs. Splitting out a reusable
component might take 5 or 10 minutes to set up all the package
overhead but it's much easier to test and document a piece that is
You can’t perform that action at this time.