Skip to content

Instantly share code, notes, and snippets.

Avatar
🐛
squashin bugs.

nick comer nkcmr

🐛
squashin bugs.
View GitHub Profile
View nick-comer-io.less
@xs: 0;
@sm: 544px;
@md: 768px;
@lg: 992px;
@xl: 1200px;
@xs-up: "only screen and (min-width:#{lower-bound($medium-range)})";
body {
font-family: 'Source Code Pro', monospace;
@nkcmr
nkcmr / cephei.php
Last active Apr 9, 2016
cephei - a tiny css pre-processor, written in php
View cephei.php
<?php
function cephei($selector, $properties) {
$output = sprintf("%s {\n", $selector);
$children = [];
foreach ($properties as $property => $value) {
if (is_array($value)) {
$children[$property] = $value;
} else {
$output .= sprintf(" %s: %s;\n", $property, $value);
View ejson.php
<?php
date_default_timezone_set('UTC');
$foo = '{"bar":{"$date":1358205756553},"pop":{"goes":{"err":{"$binary":"c3VyZS4="},"the":{"weasel":{"$date":1358205756553,"$tz":"America/New_York"}}}}}';
class EJSON {
protected static $customTypes = [];
public static function type($marker, $decoder) {
if (!is_callable($decoder)) {
@nkcmr
nkcmr / check-sw-reg.js
Last active Aug 29, 2015
push api zumba blog
View check-sw-reg.js
// the service worker api entry point is navigator.serviceWorker
navigator.serviceWorker
.getRegistration()
.then(function (registration) {
// 'registration' is an instance of ServiceWorkerRegistration, see here:
// http://www.w3.org/TR/service-workers/#service-worker-registration-interface
if (!registration) {
// there is no service worker installed!
} else {
// there is one installed, and it is either 'waiting'
@nkcmr
nkcmr / README.md
Last active Apr 23, 2017
simple deluge complete scope that uploads stuff to google drive
View README.md

deluge to google drive uploader

simple uploader script for deluge, assign this script to be called on torrent complete and it will walk a directory and upload it to your google drive

install dependencies:

npm install googleapis async winston lodash mime twilio
@nkcmr
nkcmr / the-beast-of-a-regex.js
Created Mar 16, 2015
best working email regex for javascript [updated]
View the-beast-of-a-regex.js
/**
* i say updated because previously, the regex wouldn't
* like if you entered, 'mikey@rocks.email', which with
* recently added TLDs is a perfectly valid email address.
* So i looked up the maximum length for a TLD (which is
* 63 characters), and put it in here. Now it works pretty well.
* It even acceptes those GMail aliases (mikey+facebook@rocks.email)
*/
var EMAIL_REGEX = /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.({2,63})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i
@nkcmr
nkcmr / scrollIntoView.js
Created Feb 4, 2015
$.fn.scrollIntoView
View scrollIntoView.js
define([], function() {
function stripWrapper(ele) {
return (ele instanceof jQuery || ele instanceof angular.element) ? ele[0] : ele;
}
function getRect(el) {
el = stripWrapper(el);
return _.pick(el.getBoundingClientRect(), 'top', 'left', 'bottom', 'right', 'width', 'height');
}
View gist:9b9ec0a62481ca387ef9

Send a request to: http://giphy.com/services/oembed/?url=http://giphy.com/gifs/ijJ0Ltz4UuD4s, and it returns this:

{
  "width": 360,
  "author_url": "http://giphy.com",
  "title": "Idk Animated GIF",
  "url": "http://giphy.com/gifs/zLOr4ChnIorxS",
  "image": "https://media3.giphy.com/media/zLOr4ChnIorxS/giphy.gif",
  "provider_url": "http://giphy.com/",
@nkcmr
nkcmr / gist:3853630202c157fc7686
Created May 16, 2014
please-uphold-strict-net-neutrality.eml
View gist:3853630202c157fc7686
Date: Fri, 16 May 2014 11:50:25 -0400
From: Nick Comer
To: openinternet@fcc.gov
Message-ID: <etPan.537633c1.6b8b4567.2c2@alpha.local>
Subject: Please Uphold Strict Net Neutrality
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
I could write a drawn out, multi-page essay on the reasons that net
@nkcmr
nkcmr / spdy.js
Created Feb 11, 2014
replacing https with spdy
View spdy.js
var express = require("express");
var app = express();
//BEFORE
var https = require("https");
https.createServer({ /*options and ssl stuff*/ }, app).listen(443);
//AFTER
var spdy = require("spdy");
spdy.createServer({ /*options and ssl stuff*/ }, app).listen(443);