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
@allanesquina
allanesquina / sshfs.sh
Created January 30, 2015 16:33
Mount Remote File Systems Over SSH
mkdir /home/mount
sudo sshfs -o allow_other root@myipaddress:/ /home/mount -p 21
#!/bin/bash
# ./renamefiles.sh directory
#
ls *$1 | egrep 'regex here+' \
| while read f
do
# if you need remove some character
tna=$(echo $f | sed 's/regex here//')
@allanesquina
allanesquina / convertvideo.sh
Last active August 29, 2015 14:13 — forked from franklinjavier/convertvideo.sh
Convert video using avconv
#!/bin/bash
# ./convertvideo.sh Directory filetype
#
# Ex:
# ./convertvideo.sh /videos mp4
ls *$1 \
| while read f
@allanesquina
allanesquina / onpopstateeq.js
Last active August 29, 2015 14:06
onpopstate equivalent
// dep: jQuery
//armazena state
var __old = history.state;
// checa state
setInterval( function() {
if( history.state !== __old ) {
//triga o evento
$( window ).trigger( 'meuevento', [1,3,2] );
// cacheia state atual
@allanesquina
allanesquina / render.js
Last active August 29, 2015 14:01
Render function
function render( tplName, data ) {
try {
var tpl = $( '#' + tplName )[0].innerHTML || {},
k, rx = /{\|\|.*?\|\|}/g, tmp ;
for( k in data ) {
tmp = new RegExp( '{\\|\\|data\\.'+ k +'\\|\\|}', 'g' );
tpl = tpl.replace( tmp, data[ k ] );
}
@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);
<div class="row">
<div class="col-4"><p>col-4</p></div>
<div class="col-4"><p>col-4</p></div>
<div class="col-4">
<div class="row">
<div class="col-4"><p>A</p></div>
<div class="col-4"><p>B</p></div>
<div class="col-4"><p>C</p></div>
</div>
</div>