Skip to content

Instantly share code, notes, and snippets.

Avatar

Armin Cifuentes armincifuentes

View GitHub Profile
View stream.jsx
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'
View swipenav.js
/*
* Swipe Navigation
*/
const SwipeWatcher = function (element) {
// This & Public
let watcher = this;
watcher.direction = undefined;
watcher.element = element;
View gist:fe781ccb522e4252dab4e030ef7947b4
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 Nov 22, 2017
Las políticas definen los permisos para ejecutar acciones
View InstitutionPolicy.php
<?php
namespace App\Policies;
use App\User;
use App\Institution;
use Illuminate\Auth\Access\HandlesAuthorization;
class InstitutionPolicy
{
View content_tweets.md

Tweets Content Type

Database

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


                                     ContentNode     ContentNodeRevision
                                   /               /
ContentRequest --> ContentTweets --- ContentNode --- ContentNodeRevision
@armincifuentes
armincifuentes / word-count.js
Created Mar 8, 2017
Count words in a HTML text body
View word-count.js
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;
}
View angular_watcher_sample.js
$scope.$watch(function() {
return variable;
}, function(newValue, oldValue) {
// do things
}
});
View comunas_select.html
<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>
View eloquent_manythroughmany.php
<?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
View gist:68aaabbddc76d4916718
{
"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",
You can’t perform that action at this time.