Skip to content

Instantly share code, notes, and snippets.

View korolr's full-sized avatar
:shipit:
¯\_(ツ)_/¯

Alexsey Ramzaev korolr

:shipit:
¯\_(ツ)_/¯
View GitHub Profile
@Treeki
Treeki / TurnipPrices.cpp
Last active April 21, 2025 04:42
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@rlefevre
rlefevre / elm-dmy-fr.md
Last active August 7, 2024 11:34
Elm using elm.dmy.fr proxies

Update: As package.elm-lang.org IP address has been changed and is not blocked anymore as far as I know, these proxies have been disabled. If you still need them, add a comment describing why.


Here is how to use the proxies:

Packages documentation

Two options:

1. Browse elm.dmy.fr instead of package.elm-lang.org

@aleguerra05
aleguerra05 / image.dart
Created August 24, 2018 18:09
decode image base64 in flutter
@override
Widget build(BuildContext context) {
if (_base64 == null)
return new Container();
Uint8List bytes = BASE64.decode(_base64);
return new Scaffold(
appBar: new AppBar(title: new Text('Example App')),
body: new ListTile(
leading: new Image.memory(bytes),
title: new Text(_base64),
@DreaMinder
DreaMinder / A Nuxt.js VPS production deployment.md
Last active July 31, 2024 13:56
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with [email protected]. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@vvakame
vvakame / index.ts
Created December 7, 2017 09:58
TypeScript + Redux なアレ(React+Redux 3日やってみはじめて期限に間に合わないと判断し作業をやめた人なので信頼性があるかは申し訳ないですが謎です…
import { createStore, applyMiddleware, combineReducers } from "redux";
import thunk from "redux-thunk";
import { userReducer, UserAction, UserState } from "./user";
import { handshakeReducer, HandShakeAction, HandshakeState } from "./handshake";
import { productInfoReducer, ProductInfoAction, ProductInfoState } from "./product";
import { circleReducer, CircleAction, CircleState } from "./circle";
export const store = createStore(combineReducers({
user: userReducer,
@milankorsos
milankorsos / redux-actions.ts
Last active January 10, 2025 19:22
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
@mozkoq
mozkoq / .vimrc
Last active October 9, 2017 10:42
my vim config
let mapleader = ","
if &compatible
set nocompatible " Be iMproved
endif
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
@zmts
zmts / tokens.md
Last active April 27, 2025 21:01
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов

Redux WebSocket Middleware: Example

This Gist provides some code examples of how to implement WebSocket stream handling using a Redux middleware. Please be aware that this is only provided as an example and that critical things like exception handling have not been implemented.

A more complete version has been packaged, tested, and is available on GitHub as redux-websocket. This library has also been published to npm at @giantmachines/redux-websocket.

Middleware

This module represents the foundation of the middleware and implements the ideas presented above. The exported function is used during the creation of the Redux store (see the following snippet).

// @flow
declare type Reducer<S, A> = (state: S, action: A) => S;
type ExtractState = <S>(r: Reducer<S, *>) => S;
declare function combineReducers<O, A>(reducers: O): Reducer<$ObjMap<O, ExtractState>, A>;
type State = {
name: string,
age: number
};