Skip to content

Instantly share code, notes, and snippets.

View zoxon's full-sized avatar

Zoxon zoxon

View GitHub Profile

Vanilla JavaScript

Some vanilla equivalents to jQuery methods.

DOM selectors

jQuery:

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@zoxon
zoxon / IE.js
Created April 19, 2017 06:48 — forked from julianshapiro/IE.js
Future-Proof IE Version Detection Without User Agent Sniffing
var IE = (function() {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 4; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {
@zoxon
zoxon / RAF.js
Created April 19, 2017 06:48 — forked from julianshapiro/RAF.js
requestAnimationFrame Polyfill
var requestAnimationFrame = window.requestAnimationFrame || (function() {
var timeLast = 0;
return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
var timeCurrent = (new Date()).getTime(),
timeDelta;
/* Dynamically set the delay on a per-tick basis to more closely match 60fps. */
/* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671. */
timeDelta = Math.max(0, 16 - (timeCurrent - timeLast));
@zoxon
zoxon / easing.js
Created April 12, 2017 06:43 — 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
@zoxon
zoxon / README.md
Created April 12, 2017 06:07 — forked from chrisjlee/README.md
Simple project setup with webpack, typescript and hot reloading

Angular 2.x Quickstart

This is shell project for configuring a typical project for angular 2.x. It includes the most naive example of an angular 2.x project. This uses some of the typical tools: webpack, karma, jasmine, typescript, sass.

Inspired by https://github.com/jeffbcross/aim

@zoxon
zoxon / gist:4985278109ae141841f51e921daea511
Created April 12, 2017 06:03 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@zoxon
zoxon / multiple_ssh_setting.md
Created April 12, 2017 05:15 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@zoxon
zoxon / vim_shortcuts.md
Created April 12, 2017 05:15 — forked from ldong/vim_shortcuts.md
Vim Shortcuts

Vim shortcuts

zz                                       Position cursor at middle of screen
zt                                       Position cursor at top of screen
zb                                       Position cursor at the bottom of screen

H                                        Go to the Header
M                                        Go to the Middle
L                                        Go to the Lower
@zoxon
zoxon / uncamelize.js
Created April 12, 2017 05:10 — forked from jpetitcolas/uncamelize.js
How to uncamelize a string in Javascript? Example: "HelloWorld" --> "hello_world"
/**
* Uncamelize a string, joining the words by separator character.
* @param string Text to uncamelize
* @param string Word separator
* @return string Uncamelized text
*/
function uncamelize(text, separator) {
// Assume separator is _ if no one has been provided.
if(typeof(separator) == "undefined") {