Skip to content

Instantly share code, notes, and snippets.

View oirodolfo's full-sized avatar
🏳️‍🌈

Rod Kisten (Costa) oirodolfo

🏳️‍🌈
View GitHub Profile
@oirodolfo
oirodolfo / CastsValueObject.php
Created September 19, 2017 02:11 — forked from cmaas/CastsValueObject.php
A Trait to automatically cast value objects in Laravel without needing a Mutator and an Accessor.
<?php
trait CastsValueObjects
{
protected function castAttribute($key, $value)
{
$castToClass = $this->getValueObjectCastType($key);
// no Value Object? simply pass this up to the parent
if (!$castToClass) {
return parent::castAttribute($key, $value);
@oirodolfo
oirodolfo / extract-apps-spotify-directory.txt
Created October 15, 2017 22:46 — forked from MatthewKosloski/extract-apps-spotify-directory.txt
Extracts each .spa file in Spotify's Apps directory without manually doing it yourself.
/*
Extracts each .spa file in Spotify's Apps directory without manually doing it yourself.
The default folder is put on the desktop.
To change that, change the following part of the command:
`~/Desktop/Apps && cd ~/Desktop/Apps`
Procedure:
1. Change directory to /Applications/Spotify.app/Contents/Resources/Apps
2. Copy the files within the directory to ~/Desktop/Apps and change directory
/*
Repacks the Spotify modules
It converts your folder into a .spa file. (e.g., profile -> profile.spa)
All module folders will be deleted after running this.
As a result, the root directory will only contain .spa files. (ready to be placed into Spotify's contents)
To run, simply `cd` into the root Apps folder of your skin.
Then, take said folder and replace it with Spotify's Apps directory found at `/Applications/Spotify.app/Contents/Resources/Apps`
@oirodolfo
oirodolfo / lista-renato4
Created October 17, 2017 22:34 — forked from darkstilo/lista-renato4
lista-renato4
#EXTM3U
#EXTINF:-1 tvg-logo="https://listaiptvbrasil.com/images/seuiptv.png" group-title="", Listaiptvbrasil.com 17/07/17
http://sendvid.com/bn081x1f.mp4
#EXTINF:-1 tvg-logo="https://listaiptvbrasil.com/logo/globo.png" group-title="CANAL ABERTO",Globo Nordeste
http://tv.ec.cx:1935/redecanais-stream-bobo/myStream/chunklist.m3u8
#EXTINF:-1 tvg-logo="https://listaiptvbrasil.com/logo/globo.png" group-title="CANAL ABERTO",Globo Rio
http://95.141.32.136:8081/look/globox/playlist.m3u8
@oirodolfo
oirodolfo / console.saveImg.js
Created October 17, 2017 22:43 — forked from Alxmerino/console.saveImg.js
Download images from a page via the console
(function(console) {
console.saveImg = function(selector) {
var imagesArray = selector || document.querySelectorAll('img');
var imagesObjArray = [];
// Build img data object
for (var i = 0; i < imagesArray.length; i++) {
if ( imagesArray[i].getAttribute('src') !== null ) {
@oirodolfo
oirodolfo / pipe.js
Created November 6, 2017 03:57 — forked from DanielKag/pipe.js
// We're going to create our own pipe function!
// Some basic functions for easily understand the pipe function.
// We'll combine those three function and send the value 4 to it.
// Getting result of - 'The numner is: 10'
const add1 = x => x + 1;
const mul2 = x => x * 2;
const title = x => `The number is: ${x}`;
@oirodolfo
oirodolfo / DynamicComponent.js
Created November 19, 2017 16:05 — forked from jmlweb/DynamicComponent.js
Dynamic Component React
// @flow
import React, { Component } from 'react';
import isSnapshot from '../../utils/isSnapshot';
export default function createDynamicComponent(
importComponent: () => {default: any},
requireComponent: () => {default: any},
) {
type Props = {
[name: string]: any,
@oirodolfo
oirodolfo / readme.md
Created November 19, 2017 21:05 — forked from brauliodiez/readme.md
lodash/fp set and flow

lodash/fp - set / flow

In this gist we are going to learn about basic goodies that we get from the library lodash/fp (fp stands for functional programming, great for ensuring immutability).We'll learn just by doing (step by step guided sample + codepens).

We'll cover lodash set and flow functions

Steps

  • We'll use codepen as our playground, navigate to this page:
@oirodolfo
oirodolfo / coordinating-async-react.md
Created December 4, 2017 00:00 — forked from acdlite/coordinating-async-react.md
Demo: Coordinating async React with non-React views

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

@oirodolfo
oirodolfo / imgdown.sh
Created December 28, 2017 01:39 — forked from dtrailin/imgdown.sh
Imgur downloader
function ImgurDir {
if [ -d ~/imgur\ albums ]
then
cd ~/imgur\ albums
else
mkdir ~/imgur\ albums
cd ~/imgur\ albums
fi
}
function readAlbum {