Skip to content

Instantly share code, notes, and snippets.

@silesky
silesky / atom sync (ubuntu)
Last active June 18, 2016 18:19
ubuntu sync
atom sync ubuntu!
atom sync (mac)
@silesky
silesky / Babel.sublime-settings
Last active May 10, 2017 22:16
sublime settings (osx)
{
"debug": false,
"use_local_babel": true,
"node_modules": {
"windows": "C:/Program Files/nodejs/node_modules",
"linux": "/usr/lib/node_modules",
"osx": "/usr/local/lib/node_modules"
},
"options": {}
}
@silesky
silesky / dictionary.ex
Last active December 6, 2016 18:21
dictionary.ex after feedback
defmodule Dictionary do
@moduledoc """
usage: the command "dict -f "atom" should return:
"Atoms are constants with itself as value."
etc...
"""
def main(args) do
IO.puts "main method called..."
args
|> parse_args
const getSums = (intArr) => {
let valuesArray = []
intArr.forEach((eachVal, eachIndex, arr) => {
for (let i = 0; i < arr.length - 1; i++) { // run on every element except the last one
if (valuesArray.every(el => el !== eachVal)) { // don't push duplicate items
valuesArray.push(eachVal + arr[i + 1]) // add adjacent element to selected element
}
}
})
return valuesArray.sort((p, n) => p > n) // sort from lowest to highest for clarity
@silesky
silesky / logic.js
Last active September 13, 2022 00:58
LoginForm/logic.js with async/await
import React from 'react';
import withState from 'recompose/withState';
import withHandlers from 'recompose/withHandlers';
import compose from 'recompose/compose';
import getContext from 'recompose/getContext';
const withConfig = getContext({ config: React.PropTypes.object });
const withEmailState = withState('email', 'setEmail', '');
const withPasswordState = withState('password', 'setPassword', '');
const withFetchState = withState('fetching', 'setFetching', false);
/* eslint camelcase: 0 */
import React from 'react';
import compose from 'recompose/compose';
import lifecycle from 'recompose/lifecycle';
import {
getCountryNameByCode,
getCountryCodeByName,
validCountry,
} from 'utils';
/* eslint camelcase: 0 */
import React from 'react';
import compose from 'recompose/compose';
import lifecycle from 'recompose/lifecycle';
import {
getCountryNameByCode,
getCountryCodeByName,
validCountry,
} from 'utils';
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"baseUrl": "./",
"paths": {
"*": [
"app/shared/*",
"node_modules/*",
"app/components/*"
[...Array(101)].map((_, i) => {
const divBy = num => i % num === 0;
const w = word => `${i}...${word}`;
const output =
divBy(5) && divBy(7) && w`fizzbuzz` ||
divBy(5) && w`fizz` ||
divBy(7) && w`buzz` ||
w``;
output && console.log(output);
})