Skip to content

Instantly share code, notes, and snippets.

/**
* @see http://bonsaiden.github.io/JavaScript-Garden/#types.typeof
* @param {*} object
* @return {string}
*/
function toType(object) {
return Object.prototype.toString.call(object).slice(8, -1).toLowerCase();
}
@pocotan001
pocotan001 / .zshrc
Last active August 29, 2015 14:07
Highlight a given file and copy it as RTF.
# requires highlight `brew install highlight`
function hlcopy() {
if [ -z "$2" ]; then
src="pbpaste"
else
src="cat $2"
fi
$src | highlight -O rtf --syntax $1 --style _${1} --font Menlo --font-size 38 | pbcopy
/**
* forked from canon-jenkins
* https://github.com/rackerlabs/canon-jenkins
*/
body {
background: none repeat scroll 0 0 #333;
color: #999;
font-size: 13px;
font-family: "Helvetica Neue",sans-serif;
@pocotan001
pocotan001 / designer.html
Created September 14, 2014 15:35
designer
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
  • 🎨 when improving the format/structure of the code
  • 🚀 when improving performance
  • ✏️ when writing docs
  • 💡 new idea
  • 🚧 work in progress
  • ➕ when adding feature
  • ➖ when removing feature
  • 🔈 when adding logging
  • 🔇 when reducing logging
  • 🐛 when fixing a bug
@pocotan001
pocotan001 / state.css
Created April 16, 2014 07:00
Global state rules.
.is-invisible {
visibility: hidden !important;
}
.is-hidden {
display: none !important;
visibility: hidden !important; /* for screenreaders */
}
.is-hidden-visually {
@pocotan001
pocotan001 / globals.snippets.js
Last active April 29, 2023 15:03
Finding improper JavaScript globals.
// globals.js
// https://gist.github.com/pocotan001/6305714
// Finding improper JavaScript globals
(function() {
var prop, cleanWindow,
globals = new function globals() {},
body = document.body,
iframe = document.createElement('iframe'),
ignore = {
@pocotan001
pocotan001 / hereDoc.js
Created May 18, 2013 17:55
hereDoc.js
define(function() {return function(){/**
Here document
*/}.toString().slice(15, -3)});
/**
* @param {String} type [http://goo.gl/B5k5w]
* @param {Mix} object
* @return {Boolean}
*/
function is(type, object) {
var klass = Object.prototype.toString.call(object).slice(8, -1);
return object !== undefined && object !== null && klass === type;
}