Skip to content

Instantly share code, notes, and snippets.

Ethyde ethyde

Block or report user

Report or block ethyde

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ethyde
ethyde / universal_amd_cjs_plainjs.js
Created Dec 12, 2016
Universal JS module loader
View universal_amd_cjs_plainjs.js
/*
* From http://ifandelse.com/its-not-hard-making-your-library-support-amd-and-commonjs/
* http://ricostacruz.com/cheatsheets/umdjs.html
*/
(function (root, factory) {
if(typeof define === "function" && define.amd) {
// Now we're wrapping the factory and assigning the return
// value to the root (window) and returning it as well to
// the AMD loader.
@ethyde
ethyde / debounce.js
Created Nov 1, 2016
JS Native debounce function
View debounce.js
// from : http://qnimate.com/javascript-limit-function-call-rate/
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this,
args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
@ethyde
ethyde / .bash_alias
Last active Nov 24, 2016
Git Config files
View .bash_alias
#!/bin/bash
alias g='git'
alias gs='git status'
View vanilla-lazy-load.html
<html>
<head>
<style>
.item {width:300px; display: inline-block; }
.item .itemtitle {font-weight:bold; font-size:2em;}
.hidden {display:none;}
</style>
</head>
<body>
<h1>Amalgam Comics Characters</h1>
View newsletter_two-columns.html
<!-- Progressive Enhancements -->
<style>
/* Media Queries */
@media screen and (max-width: 480px) {
/* What it does: Forces table cells into full-width rows. */
.stack-column {
display: block !important;
width: 100% !important;
max-width: 100% !important;
@ethyde
ethyde / getCoordinate.js
Created Jan 10, 2016
getCoordinate of any box in JS
View getCoordinate.js
var getCoordinate = function(elemId, parentId){
var element = document.getElementById(elemId);
var context = document.getElementById(parentId);
var bodyRect = context.getBoundingClientRect(),
pointPos = element.getBoundingClientRect(),
offsetY = pointPos.top - bodyRect.top;
offsetX = pointPos.left - bodyRect.left;
centerX = offsetX + pointPos.width / 2;
@ethyde
ethyde / .bash_profile
Created Dec 3, 2015
Bash profile load ssh-agent and add all key in ~/.ssh/id_rsa*
View .bash_profile
# SSH Agent
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
# source : https://www.schoonology.com/technology/ssh-agent-windows/
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
# (for example, when using agent-forwarding over SSH).
@ethyde
ethyde / Gruntfile.js
Last active Oct 18, 2015
Grunt config for PostCSS
View Gruntfile.js
/**
* @fileOverview Gruntfile tasks. These tasks are intended to help you when modifying the template. If you are
* just using the template, don't sweat this stuff. To use these tasks, you must install grunt, if you haven't already,
* and install the dependencies. All of this requires node.js, of course.
*
* Install grunt:
*
* npm install -g grunt-cli
*
* Then in the directory where you found this file:
View kitchensink.html
<!doctype html>
<html>
<head>
<title>Kitchen sink</title>
<style>
body { margin: 0 5%; }
.colA { width: 45%; float: left; margin-right: 5%; }
.colB { width: 45%; float: left; }
View kitchensink.html
<article>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<section>
<h1>Heading 1 (in section)</h1>
You can’t perform that action at this time.