Skip to content

Instantly share code, notes, and snippets.

View allanesquina's full-sized avatar
💭
New horizon!

Allan Esquina allanesquina

💭
New horizon!
View GitHub Profile
@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"
@letanure
letanure / estados-cidades.json
Last active November 4, 2024 18:03
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@hacknightly
hacknightly / riffwave.js
Created September 24, 2012 15:20
riffwave.js
/*
* RIFFWAVE.js v0.03 - Audio encoder for HTML5 <audio> elements.
* Copyleft 2011 by Pedro Ladaria <pedro.ladaria at Gmail dot com>
*
* Public Domain
*
* Changelog:
*
* 0.01 - First release
* 0.02 - New faster base64 encoding
@cobyism
cobyism / gh-pages-deploy.md
Last active November 11, 2024 00:02
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@allanesquina
allanesquina / xRandom.js
Last active August 29, 2015 13:56
JavaScript function that returns an array of random numbers without repetition
/*
* xRandom
* Returns an array of random numbers without repetition
* array range, int limit
*/
function xRandom( range, limit ) {
if( --limit >= range[1] || limit < 0 ) return;
return (function _xr( i, r, result ) {
var max = range[1], min = range[0], j = r.length, c=0,
rand = Math.floor(Math.random() * (max - min + 1) + min);
@franklinjavier
franklinjavier / convertvideo.sh
Last active August 29, 2015 13:56
Convert video using avconv
#!/bin/bash
# ./convertvideo.sh file file
#
# Ex:
# ./convertvideo.sh mp4 webm
# ./convertvideo.sh video.avi video.mp4
ls *$1 \
@tkadlec
tkadlec / perf.js
Created April 23, 2015 11:54
Super simple example of adding perf timing to the page display during dev work
(function () {
var perfBar = function(budget) {
window.onload = function() {
window.performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {};
var timing = window.performance.timing,
now = new Date().getTime(),
output, loadTime;
@ivanbanov
ivanbanov / responsive-grid.scss
Last active August 29, 2015 14:23
Responsive grid focused on mobile first
// BREAKPOINTS
// https://jdsteinbach.com/css/sass-maps-breakpoint-mixin/
$breakpoints: (
small : 320px,
medium: 768px,
large : 992px,
wide : 1400px
);
$columns: 12;
$gutter : 1em;
@wesleybliss
wesleybliss / docker-compose-node-mongo.yml
Created September 9, 2016 21:37
Docker Compose with example App & Mongo
version: '2'
services:
myapp:
build: .
container_name: "myapp"
image: debian/latest
environment:
- NODE_ENV=development
- FOO=bar
volumes:
@SagiMedina
SagiMedina / ImageTools.js
Last active September 7, 2024 04:39
Resize and crop images in the Browser with orientation fix using exif
import EXIF from 'exif-js';
const hasBlobConstructor = typeof (Blob) !== 'undefined' && (function checkBlobConstructor() {
try {
return Boolean(new Blob());
} catch (error) {
return false;
}
}());