Skip to content

Instantly share code, notes, and snippets.

View juanmirod's full-sized avatar

Juan Miguel Rodriguez Ceron juanmirod

View GitHub Profile
@yuya-takeyama
yuya-takeyama / dog.js
Created March 6, 2011 13:48
Encapsulated constructor in JavaScript.
var Dog = (function () {
var init, create;
/**
* Encapsulated Constructor,
*/
init = function (name, age) {
this.name = name;
this.age = age;
};
/**
* Juan's leaving card: http://is.gd/juan_leaving
*/
(function() {
'use strict';
var message = [
' gg ',
' dP8, ',
' dP Yb ',
const scope = {};
function def(id, fn) {
scope[id] = fn;
}
function explode(id) {
return scope[id] ? [id] : id.split('\u200d');
}
function getFns(id) {
return explode(id).map(function(ii) {
if (!scope[ii])
@jellea
jellea / gist:3438926
Created August 23, 2012 17:18
Webcam snapshot on every git commit
#!/bin/bash
#
# This script will make a webcam snapshot every commit. The jpg file will have
# the commit id as the filename.
#
# This script requires imagesnap. Install with: 'brew install imagesnap'
#
# Put this file in the '.git/hooks/' name it 'post-commit' and chmod it by:
# 'chmod +x .git/hooks/post-commit'
#
@HaNdTriX
HaNdTriX / image_to_data_url.js
Last active February 27, 2022 07:23
Convert an image to base64URL.
/**
* Converts an image to a dataURL
* @param {String} src The src of the image
* @param {Function} callback
* @param {String} outputFormat [outputFormat='image/png']
* @url https://gist.github.com/HaNdTriX/7704632/
* @docs https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement#Methods
* @author HaNdTriX
* @example
*
@mhausenblas
mhausenblas / cli-fu.md
Created July 5, 2018 13:30
Michael's bash snippets
@frankfaustino
frankfaustino / composing.software.md
Last active March 3, 2023 06:20
Eric Elliot: Composing Software Series

Eric Elliott: Composing Software

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.