Skip to content

Instantly share code, notes, and snippets.

View GUIEEN's full-sized avatar
💭
美しい未来に

Seung Kwak GUIEEN

💭
美しい未来に
  • tokyo
View GitHub Profile
@igroomgrim
igroomgrim / LocationService.swift
Last active September 10, 2023 18:06
Simply Singleton CLLocationManager Class in Swift
//
// LocationService.swift
//
//
// Created by Anak Mirasing on 5/18/2558 BE.
//
//
import Foundation
import CoreLocation
@remojansen
remojansen / class_decorator.ts
Last active January 17, 2026 16:35
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@subfuzion
subfuzion / curl.md
Last active April 30, 2026 08:42
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@YoshihideSogawa
YoshihideSogawa / Purchaser.cs
Created May 19, 2016 07:42
UnityIAPでハマりながら作ったクラス
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Purchasing;
/// <summary>
/// 課金処理を扱うクラスです。
/// 非消費、サブスクリプション型は動作未検証です。
/// Android/iOSのみ動作検証しています。
/// INFO:[iOS]未購入のアイテムがあるとInitialize後すぐに認証ダイアログが表示されるので、呼び出すタイミングを調整してください
@goldhand
goldhand / spawn.js
Last active January 8, 2019 22:18
Use a generator to make async stuff look sync.
/**
* Turns generators into async demons
*
* Within the generator function, any "yield" operator becomes enhanced with async powers
* allowing them to yield promises.
*
* @example
* spawn(function *() {
* const data = yield fetch('/foo.json'); // will be resolved and assigned to "data" var
* console.log(data); // write like its sync but its acually async ;)
@coryhouse
coryhouse / ReactBindingApproaches.js
Last active May 4, 2019 18:12
React Binding Approaches
// Approach 1: Use React.createClass
var HelloWorld = React.createClass({
getInitialState() {
return { message: 'Hi' };
},
logMessage() {
// this magically works because React.createClass autobinds.
console.log(this.state.message);
},
@coolaj86
coolaj86 / tcp-http-spy.js
Last active October 16, 2020 07:11
Raw TCP and TLS to HTTP and HTTPS in node.js
'use strict';
var net = require('net');
var http = require('http');
var http80 = http.createServer(function (req, res) {
res.end('Hello, World!');
});
var tcp80 = net.createServer(function (client) {
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active February 15, 2026 08:09
React Native Bridging Cheatsheet
@dalaidunc
dalaidunc / read.js
Last active January 5, 2019 11:44
2 approaches to reading text files with node.js
const fs = require('fs');
const util = require('util');
const readFile = util.promisify(fs.readFile);
const readdir = util.promisify(fs.readdir);
async function read1 (file) {
const label = `read1-${file}`;
console.time(label);
const data = await readFile(file, 'utf8');
@dalaidunc
dalaidunc / makedata.js
Last active February 14, 2019 09:28
Create CSV files with dummy data (using node.js)
const fs = require('fs');
const cols = 8;
function randomChar () {
return String.fromCharCode(Math.floor(Math.random() * (122-65) + 65));
}
function randomString (length) {
let string = '';