Skip to content

Instantly share code, notes, and snippets.

View orafaelfragoso's full-sized avatar
:octocat:
Working from home

Rafael Fragoso orafaelfragoso

:octocat:
Working from home
View GitHub Profile
@orafaelfragoso
orafaelfragoso / compareArrays.js
Last active October 15, 2015 22:35
A function to compare two Arrays
let compareArrays = (arr1, arr2) => {
if (!arr1 || !arr2)
return false;
if (arr1.length !== arr2.length)
return false;
for(let i=0; i<arr1.length; i++) {
if (arr1[i] instanceof Array && arr2[i] instanceof Array) {
if (compareArrays(arr1[i], arr2[i]))
@orafaelfragoso
orafaelfragoso / gnome-shell-xoria256-colors.sh
Created September 22, 2016 20:30
Gnome Shell Xoria256 Colors
#!/bin/sh
#
# Shell script that configures gnome-terminal to use xoria256 theme
# colors. Written for Debian Wheezy.
#
# AUTHOR: Igor Kalnitsky <[email protected]>
# LICENSE: GNU GPL v3
PALETTE="#121212121212:#D7D787878787:#AFAFD7D78787:#F7F7F7F7AFAF:#8787AFAFD7D7:#D7D7AFAFD7D7:#AFAFD7D7D7D7:#E6E6E6E6E6E6:#121212121212:#D7D787878787:#AFAFD7D78787:#F7F7F7F7AFAF:#8787AFAFD7D7:#D7D7AFAFD7D7:#AFAFD7D7D7D7:#E6E6E6E6E6E6"
BG_COLOR="#1C1C1C1C1C1C"
@orafaelfragoso
orafaelfragoso / apple-event.sh
Created October 27, 2016 16:51
Watch the October 2016 Apple Event on Ubuntu
vlc --ffmpeg-threads=1 'http://p.events-delivery.apple.com.edgesuite.net/16oibfvohbfvoihbdfvoihbefv10/m3u8/hls_mvp.m3u8'
@orafaelfragoso
orafaelfragoso / ArrayHelper.rb
Created January 10, 2017 03:09
Flatten an Array without using Array.flatten()
module ArrayHelper
def flatten(arr)
arr.each_with_object([]) do |el, flat|
flat.push *(el.is_a?(Array) ? self.flatten(el) : el)
end
end
" Creating a module function to the flatten method
So it can be called without being instantiated."
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("angular"));
else if(typeof define === 'function' && define.amd)
define("angular-image-preloader", ["angular"], factory);
else if(typeof exports === 'object')
exports["angular-image-preloader"] = factory(require("angular"));
else
root["angular-image-preloader"] = factory(root["angular"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {
@orafaelfragoso
orafaelfragoso / gulpfile.js
Created May 4, 2017 14:46
Angular 1.X + Gulp
'use strict';
var gulp = require('gulp'),
path = require('path'),
del = require('del'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
eslint = require('gulp-eslint'),
cssimport = require('gulp-cssimport'),
@orafaelfragoso
orafaelfragoso / jQLite.js
Created May 5, 2017 21:41
Angular 1.X Mysteries
if (!(this instanceof JQLite)) {
if (argIsString && element.charAt(0) !== '<') {
throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
}
return new JQLite(element);
}
@orafaelfragoso
orafaelfragoso / tmux.md
Created May 7, 2017 16:39 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@orafaelfragoso
orafaelfragoso / flatten.js
Created February 20, 2018 17:55
Flatten an Array with JS
const assert = require('assert');
const input1 = [1, [2, 3], Object, [], 5, 6];
const input2 = [1, 2, [3, 4, [5, 6, 7], 8], 9, [[10]]];
const input3 = [1, 2, 3, 4, 5];
function flatten(arr) {
return Array.isArray(arr) ? [].concat.apply([], arr.map(flatten)) : arr;
}
assert.deepEqual(flatten(input1), [1, 2, 3, Object, 5, 6]);
""""""""""""""""
" VUNDLE BEGIN "
""""""""""""""""
set nocompatible " Disable vi-compatibility
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()