Skip to content

Instantly share code, notes, and snippets.

View franklinjavier's full-sized avatar

Franklin Javier franklinjavier

View GitHub Profile
@franklinjavier
franklinjavier / save-credentials.sh
Last active August 29, 2015 13:56
Cache your Git credentials #password #git #cache
git config --global credential.helper # 15 minutes (default).
git config --global credential.helper 'cache --timeout=3600' # timeout in seconds
# 86400 = 1 day
@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 \
@franklinjavier
franklinjavier / yeoman-generator-git.js
Created April 15, 2014 21:54
Using git with Yoeman generator
InfoGenerator.prototype.gitCommit = function gitCommit() {
var done = this.async();
this.log('\n\nInitializing Git repository. If this fail, try running ' +
chalk.yellow.bold('git init') +
' and make a first commit manually');
var async = require('async');
@franklinjavier
franklinjavier / dataurl.js
Created May 30, 2014 13:50
Print out data URLs for all images / canvases on the page.
// dataurl.js
// https://github.com/bgrins/devtools-snippets
// Print out data URLs for all images / canvases on the page.
(function() {
console.group("Data URLs");
[].forEach.call(document.querySelectorAll("img"), function(i) {
var c = document.createElement("canvas");
@franklinjavier
franklinjavier / requirejs-with-commonjs-wrapper.js
Last active August 29, 2015 14:02
Better way to require AMD modules - SUGAR “simplified CommonJS wrapper”
define(function( require, exports ) {
'use strict';
var defaults = require('lodash-amd/modern/objects/defaults'),
flatten = require('lodash-amd/modern/arrays/flatten'),
commands = require('./plugins/core/commands');
...
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'app/assets/img/',
src: ['**/*.{png,jpg,gif}'],
dest: 'dist/img/'
}]
}
}
@franklinjavier
franklinjavier / Loader-experiment.markdown
Created June 21, 2014 05:53
A Pen by Franklin Javier.
@franklinjavier
franklinjavier / install-dependencies.sh
Last active August 29, 2015 14:03
Screencasting on Gnu/Linux
sudo add-apt-repository ppa:fossfreedom/byzanz
sudo apt-get update && sudo apt-get install byzanz
#
# If you are behind a firewall
#
#!/bin/bash
sudo apt-get update 2> /tmp/keymissing;
@franklinjavier
franklinjavier / bootstrap.sh
Created July 2, 2014 03:59
Script to control my dot files
#!/usr/bin/env bash
backup_file() {
test -e $HOME/$1 && cp -LiR $HOME/$1 $HOME/$1.dotbackup && rm -rf $HOME/$1
true
}
backup_directory() {
test -d $HOME/$1.dotbackup && echo -n "~/$1.dotbackup: " && rm -rI $HOME/$1.dotbackup
test -d $HOME/$1 && cp -LR $HOME/$1 $HOME/$1.dotbackup && rm -rf $HOME/$1
@franklinjavier
franklinjavier / unix-tricks.md
Last active August 29, 2015 14:03
Unix tricks

font: http://cfenollosa.com/misc/tricks.txt

I have marked with a * those which I think are absolutely essential Items for each section are sorted by oldest to newest. Come back soon for more!

BASH

  • In bash, 'ctrl-r' searches your command history as you type
  • Input from the commandline as if it were a file by replacing 'command < file.in' with 'command <<< "some input text"'
  • '^' is a sed-like operator to replace chars from last command