Skip to content

Instantly share code, notes, and snippets.

View kamiyam's full-sized avatar
🏠
Working from home

kamiyam kamiyam

🏠
Working from home
View GitHub Profile
@tkdn
tkdn / 2018-3-28.md
Created December 29, 2018 11:53
HOCs と TypeScript における型付けの肝

React HOCs on TypeScript

参考: https://medium.com/@jrwebdev/react-higher-order-component-patterns-in-typescript-42278f7590fb

まだ HOC と TypeScript の良い落としどころが見えてないが、何となく理解しつつある現状。 「TypeScript こわい」から卒業したのと、良記事があったので簡単にまとめておきます。

HOCs と TypeScript の相性

悪い。 => 型を設定することが難しい。 しかしやっていきたいので、any を使わずに整理していこう。

@voluntas
voluntas / open_momo.rst
Last active March 1, 2024 13:51
OpenMomo プロジェクト
/*
* config/bootstrap.js
* Example of how to redirect all http request to https
* See http://jsbot.io/node/http-and-https-handle-with-sailsjs
*
*/
module.exports.bootstrap = function(cb) {
var express = require("express")
var app = express();
@boopathi
boopathi / README.md
Last active August 28, 2023 14:35
Creating a Swift-ReactNative project

Settings

  1. Create a project in XCode with the default settings
    • iOS > Application > Single View Application
    • Language: Swift
  2. Under project General settings, add ReactKit to Linked Framework and Libraries
    • + > Add Other... and choose /path/to/react-native/ReactKit/ReactKit.xcodeproj
  3. Now ReactKit would have been imported. Link it by choosing it from the list.
    • + > lib.ReactKit.a
  4. Under project Build Settings,
@tmarshall
tmarshall / aws-sns-example.js
Last active October 30, 2022 06:12
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
var attempts = 1;
function createWebSocket () {
var connection = new WebSocket();
connection.onopen = function () {
// reset the tries back to 1 since we have a new connection opened.
attempts = 1;
// ...Your app's logic...
@jstcki
jstcki / README.md
Last active April 12, 2017 13:24
Transitions with React and D3 II

Using D3 in a React TransitionGroup to transition elements. D3 is used purely for transitions, not for data joins. The distinction between entering and exiting elements is handled by the TransitionGroup component. See the React documentation for further information.

Alternative implementations only with D3 and using React without addons.

Note: This implementation is around 30% slower in processing 1000 circles than the other two.

/**
* POST to create a new user.
*/
exports.create = function *(){
var body = yield parse(this);
// password
var pass = body.password;
assert(pass, 400, 'password is required');
@yuka2py
yuka2py / modernizer.environ.js
Last active December 29, 2015 18:59
デバイスやブラウザを判定する Modernizr 用の追加テストです。 えっと…。いや、実務では要りますよ。やっぱり。今回まとめました。
(function() {
if (!window.Modernizr) {
return;
}
var ua = new String(window.navigator.userAgent.toLowerCase());
ua.has = function (cond) {
return this.indexOf(cond) != -1;
};
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- Make the app behave more like a native app -->
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width, height=device-height" />
<!-- Bootstrap styles -->
<link href="css/bootstrap.css" rel="stylesheet" media="screen" />