Skip to content

Instantly share code, notes, and snippets.

View alexesDev's full-sized avatar

Alexey Yurchenko alexesDev

  • Digital Nomad
View GitHub Profile
@alexesDev
alexesDev / code1.c
Last active December 21, 2016 20:09
#define FIRST_PIN 2
#define COUNT 6
void setup() {
for (int i = 0; i < COUNT; ++i) {
pinMode(i + FIRST_PIN, OUTPUT);
}
}
int current = 0;
@alexesDev
alexesDev / example.js
Last active November 2, 2016 11:01
QueryMatch for react-router v4 (idea)
// Show elements like modal with router
// /catalog?cart (open catalog with cart modal)
// /about?menu (open menu on about page)
// /about?cart&menu (open menu on about page with cart modal)
const App = () => (
<BrowserRouter>
<MainLayout>
<QueryMatch query={{ menu: null }} component={Menu} />
#ifndef REDUX_MIDDLEWARE_CALLER_H
#define REDUX_MIDDLEWARE_CALLER_H
namespace Redux {
template<template<typename> typename Current, template<typename> typename ...Others>
struct MiddlewareCaller;
template<template<typename> typename Current>
struct MiddlewareCaller<Current> {
@alexesDev
alexesDev / main.cpp
Last active December 13, 2022 09:00
Redux c++ implementation
#include <mapbox/variant.hpp>
#include <redux.hpp>
struct Increment
{
};
struct Decrement
{
};
<!doctype html>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
@alexesDev
alexesDev / example.js
Created August 2, 2016 23:39
Reselect profit
const { createSelector } = require('reselect');
const state = {
data: [1, 2, 3],
};
const filter = (data) => {
console.log('call super show filter');
return data.filter(i => i < 3);
};
@alexesDev
alexesDev / keyboard-avoid.js
Created July 27, 2016 14:17
Avoiding the Keyboard in React Native
import React, { PropTypes } from 'react';
import { View, DeviceEventEmitter, Animated } from 'react-native';
const KeyboardAvoid = React.createClass({
propTypes: {
duration: PropTypes.number.isRequired,
additionalHeight: PropTypes.number.isRequired,
},
getInitialState() {
const data = [1, 2, 3];
const sum = a => b => a + b;
const result = data.map(sum(3));
console.log(result);
var data = [1, 2, 3];
var sum = function (a) {
return function (b) {
return a + b;
}
};
var result = data.map(sum(3));
console.log(result); // [4, 5, 6]
extract() {
local c e i
(($#)) || return
for i; do
c=''
e=1
if [[ ! -r $i ]]; then