Skip to content

Instantly share code, notes, and snippets.

View iamso's full-sized avatar

Steve Ottoz iamso

View GitHub Profile
@iamso
iamso / logTable
Last active August 29, 2015 14:21
Console helper functions
window._debug = true;
// ...
var logTable = function(data, prefix){
var table = [],
i,
value,
isArray;
@iamso
iamso / npm-upgrade-bleeding.sh
Created February 12, 2016 09:46 — forked from othiym23/npm-upgrade-bleeding.sh
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
@iamso
iamso / hosts.php
Created August 31, 2016 11:52
Output hosts file entries for use in VirtualBox and Parallels Desktop
<?php
$file = file_get_contents("/etc/hosts");
$lines = explode("\n", $file);
$hosts = array();
foreach($lines as $line) {
if (preg_match("/^#/", $line) || !$line) {
continue;
}
@iamso
iamso / server.js
Last active October 14, 2016 18:27
Simple Node.js Http Server
const http = require('http');
const port = process.env.PORT || 1234;
const server = http.createServer((request, response) => {
response.end(`It works!! Url: ${request.url}`);
}).listen(port, () => {
console.log(`Server listening on http://localhost:${port}`);
});
@iamso
iamso / request.js
Last active June 20, 2017 12:38
Simple HTTP(S) request with Node.js
'use strict';
const http = require('http');
const https = require('https');
const {URL} = require('url');
const methods = {};
['get', 'post', 'put', 'patch', 'delete', 'head', 'options'].forEach(method => {
methods[method] = (url, data, headers) => {
return request(url, method, data, headers);
<style>
html:not(.is-phone) .whatsapp-link {
display: none;
}
</style>
<a class="whatsapp-link" href="whatsapp://send?text=url-encoded-text-goes-here">
Share with Whatsapp
</a>
<script>
;(function(navigator, document) {
@iamso
iamso / webfonts
Created January 23, 2017 14:15
Convert fonts to .woff and .woff2
#!/usr/bin/env bash
cd "$PWD"
shopt -s globstar
for f in *.otf *.ttf ; do
FILE=$(basename "$f")
if [ "$FILE" != "." ] && [ "$FILE" != ".." ] && [ "$FILE" != "*.otf" ] && [ "$FILE" != "*.ttf" ]
then
echo "Converting $FILE"
@iamso
iamso / LICENSE.txt
Last active February 8, 2017 10:38 — forked from Fedia/LICENSE.txt
John Resig's Micro-Templating in 140 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 Fedia <fedia@psih.ru>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@iamso
iamso / easing.js
Created February 15, 2017 17:04 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@iamso
iamso / easings.js
Created February 15, 2017 17:04 — forked from rezoner/easings.js
One argument easing equations
/*
A full list of simple easing equations inspired by GIST from greweb - https://gist.github.com/gre/1650294
Equations source - http://gsgd.co.uk/sandbox/jquery/easing/
*/
{
linear: function(t) {
return t
},
inQuad: function(t) {