Skip to content

Instantly share code, notes, and snippets.

On vacation

Yuichi Tateno (secon) hotchpotch

On vacation
View GitHub Profile
krnlde / promisify-http.js
Last active Jan 29, 2021
util.promisify.custom and http.get example
View promisify-http.js
const http = require('http');
const {promisify} = require('util');
http.get[promisify.custom] = function getAsync(options) {
return new Promise((resolve, reject) => {
http.get(options, (response) => {
response.end = new Promise((resolve) => response.on('end', resolve));
}).on('error', reject);
megahertz / MobxRnnProvider.js
Last active Jan 11, 2020
This is a provider which allows to use mobx-react Provider with wix/react-native-navigation.
View MobxRnnProvider.js
import { Provider } from 'mobx-react/native';
const SPECIAL_REACT_KEYS = { children: true, key: true, ref: true };
export default class MobxRnnProvider extends Provider {
props: {
store: Object
context: {
motemen /
Last active Mar 14, 2021
  • その面白そうな話、私も参加していいよね?なぜなら私は無条件に受け入れられているからおじさん(闖入おじさん) #おじさんパターン
  • 後出し難癖おじさん #おじさんパターン
  • 困難は成長のチャンス!だから君たちに成長の機会をあげようおじさん (成長おじさん) #おじさんパターン
  • あらゆる事案に一般論コメントおじさん #おじさんパターン
  • 俺ってあらゆることに精通してるじゃん?だから力になるよおじさん (精通おじさん) #おじさんパターン
kishikawakatsumi / main.m
Created Jan 14, 2014
One-line fix for UITextView on iOS 7
View main.m
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[])
@autoreleasepool {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"UIDisableLegacyTextView"];
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
uupaa /
Last active Jun 2, 2020

(new Image()).src = URL; がお勧めです。




View gist:7939659
# 私が考える安全なプログラムを書くために必要なこと
- ファイルを開こうとしたらコマンドを実行できてしまったり
- CSSセレクタを書いてるつもりがHTMLタグを生成してしまったり
- SELECT文を発行するつもりがDELETE文を発行できてしまったり
- 入力値検証をしないと危険になる
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

onishi / mysqldiff
Created Aug 19, 2011
mysqldiff - mysql scheme diff
View mysqldiff
#!/usr/bin/env perl
use strict;
use warnings;
# - drop key
@ARGV == 2 or die 'Usage: mysqldiff dbname1 dbname2';
my @tables = map {
View gist:500145
// The `quickEach` method will pass a non-unique jQuery instance
// to the callback meaning that there will be no need to instantiate
// a fresh jQuery instance on each iteration. Most of the slow-down
// inherent in jQuery's native iterator method (`each`) is the constant
// need to have access to jQuery's methods, and so most developers
// see constructing multiple instances as no issue... E.g.
// $(...).each(function(){ $(this)... $(this)... $(this)... });
// A better approach would be `quickEach`.
jQuery.fn.quickEach = (function(){
miyagawa / gitweb.psgi
Created Mar 27, 2010
Running gitweb.cgi on Plack
View gitweb.psgi
# 1. Download git and make gitweb/gitweb.cgi (See gitweb/INSTALL how to set gitweb root etc.)
# 2. Copy this file as gitweb/app.psgi
# 3. cd gitweb; plackup
# 4. Access http://localhost:3000/gitweb.cgi
use Plack::Builder;
use Plack::App::WrapCGI;
use Plack::App::File;
builder {