Skip to content

Instantly share code, notes, and snippets.

Victor Quiroz victorhqc

View GitHub Profile
@victorhqc
victorhqc / emojis.js
Created Mar 13, 2018
Get slack Emojis
View emojis.js
// Go to "Customize Slack" in settings. It'll redirect you to https://[organization].slack.com/customize/emoji
// Then run this code in the web terminal.
{
let total = 0;
const contributors = Object.entries([].slice.call(document.querySelectorAll('#custom_emoji a')).reduce((prev, link) => {
total += 1;
if (!prev[link.innerText]) {
return {
...prev,
@victorhqc
victorhqc / controller.js
Created Dec 15, 2017
Angular 1.X Redux-Controller
View controller.js
var myApp = angular.module('myApp',[]);
myApp.controller('MyCtrl', function($scope, TodoService) {
function addTodo($scope, TodoService) {
return function curriedAddTodo(title, description) {
$scope.title = '';
$scope.description = '';
$scope.todos = TodoService.todosReducer(
$scope.todos,
@victorhqc
victorhqc / factory.js
Last active Dec 15, 2017
Angular 1.X Redux-Factory
View factory.js
(function(app) {
function TodoServiceFactory() {
var ADD_TODO = 'ADD_TODO';
var REMOVE_TODO = 'REMOVE_TODO';
var ID = -1;
function findIndex(haystack, needle) {
var isFound = false;
var index = -1;
haystack.some(function mapHaystack(data) {
View build-package.sh
#!/bin/sh
ATOM_CHANNEL="${ATOM_CHANNEL:=stable}"
echo "Downloading latest Atom release on the ${ATOM_CHANNEL} channel..."
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
curl -s -L "https://atom.io/download/mac?channel=${ATOM_CHANNEL}" \
-H 'Accept: application/octet-stream' \
-o "atom.zip"
mkdir atom
@victorhqc
victorhqc / DynamicRenderImplementation.jsx
Created Sep 27, 2017
Dynamic render implementation
View DynamicRenderImplementation.jsx
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Translate from './highOrderComponents/WithTranslate';
import ClickOutside from './highOrderComponents/ClickOutside';
import WithUser from './highOrderComponents/WithUser';
import {
configureUser,
} from './store/actions';
View TranslateDynamicRenderComponent.jsx
import React, { Component } from 'react';
import reduce from 'lodash/reduce';
const TRANSLATIONS = {
US: {
welcome: 'Welcome {{user}}',
},
MX: {
welcome: 'Bienvenido {{user}}',
},
@victorhqc
victorhqc / TranslateHighOrderComponent.jsx
Last active Sep 27, 2017
High Order Component Implementation example
View TranslateHighOrderComponent.jsx
import React, { Component } from 'react';
import {
translateFromCountry,
} from './translate';
// High order Component translate
const translate = (WrappedComponent) => {
return class extends Component {
translate = (key, params) => {
@victorhqc
victorhqc / HighOrderComponentsProblemsExample.jsx
Created Sep 26, 2017
HighOrderComponents Problems Example
View HighOrderComponentsProblemsExample.jsx
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { recompose } from 'recompose';
import translate from './highOrderComponents/withTranslate';
import clickOutside from './highOrderComponents/clickOutside';
import withUser from './highOrderComponents/withUser';
import {
configureUser,
} from './store/actions';
You can’t perform that action at this time.