Skip to content

Instantly share code, notes, and snippets.

View glongh's full-sized avatar

Gaston Longhitano glongh

View GitHub Profile
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@glongh
glongh / connect.js
Created June 3, 2020 23:40 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@glongh
glongh / clean_code.md
Created April 14, 2020 21:59 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

React && Firebase Workshop

Contact Information

Prequisite Setup

  • A recent version of Node.js
  • npm install -g create-react-app
@glongh
glongh / ApiUploadedFile.php
Created January 30, 2017 20:55 — forked from kibao/ApiUploadedFile.php
Symfony2 Form Component. Support upload file through API call (e.g. in json, xml, etc.) as base64 encoded content .
<?php
namespace Infun\HttpFoundation\File;
use Symfony\Component\HttpFoundation\File\File;
class ApiUploadedFile extends File
{
public function __construct($base64Content)
@glongh
glongh / maybe.traceur
Created September 1, 2016 01:15 — forked from torgeir/maybe.traceur
An es6 js maybe monad, using generators
log = console.log.bind(console);
maybe = v => {
function * f () {
if (v) yield v;
}
f.bind = f =>
v ? f(v) : maybe();
@glongh
glongh / tailrecursion.php
Created July 26, 2016 15:37 — forked from beberlei/tailrecursion.php
PHP Tail Recursion
<?php
class TailRecursion
{
public $func;
public $acc;
public $recursing;
public function tail()
{
return call_user_func_array($this->func, func_get_args());
@glongh
glongh / Readme.md
Created July 14, 2016 22:13 — forked from supertinou/Readme.md
React component which displays participants statuses and refresh the statuses in Realtime.

Component

Usage

You can display / refresh / add participants by passing to the participants property an array of participants. See the examples below:

Displaying some participants:

participants = [
@glongh
glongh / 1.js
Last active June 16, 2016 22:34 — forked from ToeJamson/1.js
Advanced Channel Groups: Friend Lists, Status Feed and Presence
// Initialize with UUID (from successful authentication response with backend)
var p = PUBNUB.init({
publish_key: "...",
subscribe_key: "...",
uuid: "0c2340c2-8cc1-4898-8868-444ba77d02d2::web"
});
@glongh
glongh / lcs.js
Created June 3, 2016 16:33 — forked from greduan/lcs.js
LCS algorithm in JS. Prettified version of what can be found here: https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_subsequence#JavaScript
// prettified version of what can be found here:
// https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_subsequence#JavaScript
function LCS(a, b) {
var m = a.length,
n = b.length,
C = [],
i,
j;
for (i = 0; i <= m; i++) C.push([0]);