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
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@voluntas
voluntas / open_momo.rst
Last active March 1, 2024 13:51
OpenMomo プロジェクト
@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,
@mikermcneil
mikermcneil / using-raw-socket-io-in-sails.js
Created September 17, 2013 18:32
Using raw socket.io functionality in a Sails.js controller
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
@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...
@dougalcampbell
dougalcampbell / ds-duino.ino
Created September 10, 2013 17:37
Digispark and nodejs - talking to the Digispark Arduino-compatible microcontroller via USB with the node-hid library
/*
* Accept control commands via USB.
*
* Commands start with '!' and end with '.'
* Commands have three parts: action, pin, value: !AAPPVV.
*
* E.g. '!01p101.' is DigitalWrite, Pin1, value = 1
*
* Note: This is currently *very* crude. Much improvement could be made.
* I think the use of strncpy is eating a lot of memory. Refactor?
@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 を使わずに整理していこう。

@kenjiskywalker
kenjiskywalker / aws-ec2-vpc.md
Last active October 31, 2018 11:14
EC2をVPCにアサインして、EIP用のNetwork Interfaceを追加して外部と接続できるようにする

EC2をVPCにアサインして外部から接続する

VPCにアサインされたEC2インスタンスへ
Network Interfaceを追加し、外部からVPC内のインスタンスへ接続できるようにする。

画像がないのでわかりづらいけど自分用メモということで。

Q&A

/*
* 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();