Skip to content

Instantly share code, notes, and snippets.

import React from 'react'
import PropTypes from 'prop-types'
import axios from 'axios';
import LoadingStream from './loading-stream'
import ProjectStory from './stories/project-story'
import PhotosStory from './stories/photos-story'
import ArticleStory from './stories/article-story'
import FolderStory from './stories/folder-story'
import BookmarksStory from './stories/bookmarks-story'
@armincifuentes
armincifuentes / swipenav.js
Last active March 8, 2018 14:12
Swipe to event
/*
* Swipe Navigation
*/
const SwipeWatcher = function (element) {
// This & Public
let watcher = this;
watcher.direction = undefined;
watcher.element = element;
@armincifuentes
armincifuentes / gist:fe781ccb522e4252dab4e030ef7947b4
Created December 15, 2017 00:24
Remove local branches not on master
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
@armincifuentes
armincifuentes / InstitutionPolicy.php
Created November 22, 2017 14:16
Las políticas definen los permisos para ejecutar acciones
<?php
namespace App\Policies;
use App\User;
use App\Institution;
use Illuminate\Auth\Access\HandlesAuthorization;
class InstitutionPolicy
{

Tweets Content Type

Database

Initially I'd go with ContentRequest -> ContentTweets -> ContentNode -> ContentNodeRevision:


                                     ContentNode     ContentNodeRevision
                                   /               /
ContentRequest --&gt; ContentTweets --- ContentNode --- ContentNodeRevision
@armincifuentes
armincifuentes / word-count.js
Created March 8, 2017 20:07
Count words in a HTML text body
function wordCount(text) {
return text
.replace(/[–,;.:!¡¿\-\?\(\)]/g, '') // remove punctuation
.replace(/<[^>]+>/g, ' ') // convert tags into whitespaces
.split(/\s/) // split across whitespaces
.filter(word => word.length) // remove empty keys
.length;
}
@armincifuentes
armincifuentes / angular_watcher_sample.js
Created December 29, 2015 20:13
Angular Watcher syntax
$scope.$watch(function() {
return variable;
}, function(newValue, oldValue) {
// do things
}
});
<option value=""></option>
<option value="ALGARROBO">ALGARROBO</option>
<option value="ALHUE">ALHUE</option>
<option value="ALTO BIOBIO">ALTO BIOBIO</option>
<option value="ALTO DEL CARMEN">ALTO DEL CARMEN</option>
<option value="ALTO HOSPICIO">ALTO HOSPICIO</option>
<option value="ANCUD">ANCUD</option>
<option value="ANDACOLLO">ANDACOLLO</option>
<option value="ANGOL">ANGOL</option>
<option value="ANTOFAGASTA">ANTOFAGASTA</option>
@armincifuentes
armincifuentes / eloquent_manythroughmany.php
Last active August 29, 2015 14:23
Eloquent manyThroughMany()
<?php
/*
* manyTroughMany()
*
* Enables access to distant relations
* using many-to-many pivot tables.
*
* Proposed by @terion-name at Laravel.io Forums
* http://laravel.io/forum/03-04-2014-hasmanythrough-with-many-to-many
@armincifuentes
armincifuentes / gist:68aaabbddc76d4916718
Created May 15, 2015 20:05
Formato request Centinela
{
"id_local" : "123",
"imagen" : "archivo.jpg-O-arvhivo.png",
"observaciones" : "Un texto de que paso",
"georeferencia" : {
"latitud" : "23.234522",
"logitud" : "-12.44334"
},
"ultima_aplicacion_producto" : "2014-12-15 15:45:12",
"fecha_real_tomada" : "2014-12-15 15:45:12",