Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Working from home

Rafael Fragoso orafaelfragoso

:octocat:
Working from home
View GitHub Profile
@orafaelfragoso
orafaelfragoso / twitter_search.js
Created Mar 9, 2020
Fetch Twitter API Recursively
View twitter_search.js
const Twitter = require('twitter')
const fs = require('fs')
const client = new Twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: '',
})
View gist:e6dff3dae6d5aec74df788949f307252
""""""""""""""""
" 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()
@orafaelfragoso
orafaelfragoso / flatten.js
Created Feb 20, 2018
Flatten an Array with JS
View flatten.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]);
@orafaelfragoso
orafaelfragoso / tmux.md
Created May 7, 2017 — forked from andreyvit/tmux.md
tmux cheatsheet
View tmux.md

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 / jQLite.js
Created May 5, 2017
Angular 1.X Mysteries
View jQLite.js
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);
}
View gulpfile.js
'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'),
View test.js
(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 / ArrayHelper.rb
Created Jan 10, 2017
Flatten an Array without using Array.flatten()
View ArrayHelper.rb
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."
@orafaelfragoso
orafaelfragoso / apple-event.sh
Created Oct 27, 2016
Watch the October 2016 Apple Event on Ubuntu
View apple-event.sh
vlc --ffmpeg-threads=1 'http://p.events-delivery.apple.com.edgesuite.net/16oibfvohbfvoihbdfvoihbefv10/m3u8/hls_mvp.m3u8'
View gnome-shell-xoria256-colors.sh
#!/bin/sh
#
# Shell script that configures gnome-terminal to use xoria256 theme
# colors. Written for Debian Wheezy.
#
# AUTHOR: Igor Kalnitsky <igor@kalnitsky.org>
# LICENSE: GNU GPL v3
PALETTE="#121212121212:#D7D787878787:#AFAFD7D78787:#F7F7F7F7AFAF:#8787AFAFD7D7:#D7D7AFAFD7D7:#AFAFD7D7D7D7:#E6E6E6E6E6E6:#121212121212:#D7D787878787:#AFAFD7D78787:#F7F7F7F7AFAF:#8787AFAFD7D7:#D7D7AFAFD7D7:#AFAFD7D7D7D7:#E6E6E6E6E6E6"
BG_COLOR="#1C1C1C1C1C1C"
You can’t perform that action at this time.