Skip to content

Instantly share code, notes, and snippets.

@telekosmos
telekosmos / uniq.js
Last active November 15, 2022 17:13
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@Layzie
Layzie / chrome-tech-night-8.md
Last active August 29, 2015 14:25
Chrome Tech Night #8 メモ
@mikechau
mikechau / video.jsx
Last active August 20, 2021 12:50
videojs react component
var React = require('react');
var cx = require('classnames');
var vjs = require('video.js');
var _forEach = require('lodash/collection/forEach');
var _debounce = require('lodash/function/debounce');
var _defaults = require('lodash/object/defaults');
var DEFAULT_HEIGHT = 800;
var DEFAULT_WIDTH = 600;
var DEFAULT_ASPECT_RATIO = (9 / 16);
@azu
azu / Node.js/JavaScriptの情報収集手段 ~変化が激しいOSSは、直接GitHubをウォッチしない.md
Last active May 14, 2022 16:01
Node.js/JavaScriptの情報収集手段 ~変化が激しいOSSは、直接GitHubをウォッチしない

Node.js/JavaScriptの情報収集手段 ~変化が激しいOSSは、直接GitHubをウォッチしない

GitHubのWatch機能はそのリポジトリに対するContributor向けの機能風味なので、 数が多くなると一瞬で破綻してしまう問題がある。

特にメールで購読しようとするのは無理なので、ウォッチしたくてWatchを安易に使うのは疲れてしまうので別の手段を考えよう。

ライブラリの更新だけをチェックしたいだけなら、GitHubにはリポジトリのリリース(tag or releaseページ)のRSSがあるのでこちらを活用しましょう。

String.isNyaN = function (val) {
if (typeof val !== 'string') return false;
var nyan = ['cat', 'kitty', 'kitten', 'doraemon', '🐱', '😿', '😺', '😸', '😼', '😹', '😻', '😽', '😾', '🙀'];
return nyan.indexOf(val.toLowerCase()) !== -1;
}
@justinwoo
justinwoo / using-rxjs-instead-of-flux-with-react.md
Last active October 21, 2023 10:16
Using RxJS instead of Flux with React to organize data flow

Reposted from Qiita

For almost a year now, I've been using this "flux" architecture to organize my React applications and to work on other people's projects, and its popularity has grown quite a lot, to the point where it shows up on job listings for React and a lot of people get confused about what it is.

Why I'm tired of using and teaching flux

There are a billion explainations on the internet, so I'll skip explaining the parts. Instead, let's cut to the chase -- the main parts I hate about flux are the Dispatcher and the Store's own updating mechanism.

If you use a setup similar to the examples in facebook/flux, and you use flux.Dispatcher, you probably have this kind of flow:

React/FluxでSPAを開発してぶちあたった問題

(この資料は専用のプリプロセッサで動くことを全体にしたドキュメントです)

React/FluxでSPAを開発してぶちあたった問題

mizchi / Increments, Inc.

@ React Meetup #1

@nkbt
nkbt / .eslintrc.js
Last active April 1, 2025 03:07
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@deiu
deiu / webcryptoapi.html
Last active November 18, 2024 01:55
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})