View build-atom.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 |
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, |
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, |
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 |
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}}', | |
}, |
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) => { |
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'; |