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 / blogpost.md
Created November 23, 2023 13:21
Technical writing

I was reading some articles on the web and came across something very interesting, and I thought I should share it with you.

Now, starting from Chrome 61 for Android, we have a new API available called Web Share. This API allows us to activate the native Android sharing bar via JavaScript, giving us more possibilities when sharing a URL or text.

Read the original Google Developers article here.

A bit of history...

The Web Share API was originally launched as an 'Origin Trial' in Chrome 55.

@orafaelfragoso
orafaelfragoso / twitter_search.js
Created March 9, 2020 22:58
Fetch Twitter API Recursively
const Twitter = require('twitter')
const fs = require('fs')
const client = new Twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: '',
})
""""""""""""""""
" 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 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]);
@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 / 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 / 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'),
(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 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."
@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'