Skip to content

Instantly share code, notes, and snippets.

View GeneralD's full-sized avatar
💭
Alcohol makes better code 🥃

YUMENOSUKE GeneralD

💭
Alcohol makes better code 🥃
View GitHub Profile
@rizumita
rizumita / CodePiece.swift
Created February 8, 2020 23:40
Swiftにasync/awaitが無いのでCombineでなんちゃってasync/awaitを書いた。Swift5.2のcallAsFunctionを使うことでyieldが書きやすくなった。 #CodePiece
import Foundation
import Combine
public func async<T>(_ body: @escaping (Yield<T>) throws -> ()) -> Async<T> {
Async(body: body)
}
public func await<P>(_ publisher: P) throws -> P.Output where P: Publisher {
try publisher.await()
}
@mwegner
mwegner / StripGeneratedSolutionSettings.cs
Last active May 9, 2019 23:37
Strip Settings From Unity's Generated .sln Files
/*
v2: Matt Rix pointed out there's an undocumented ONGeneratedCSProjectFiles() callback
https://gist.github.com/MattRix/0bf8de88e16e8b494dbb
v1: Still available in the gist history if you want a FileSystemWatcher solution!
THE PROBLEM:
- Unity constantly rewrites its .sln files whenever you rename/add/remove scripts
@naps62
naps62 / Gruntfile.coffee
Last active January 23, 2017 05:47
quick Grunt.js setup with Sass + Coffee + Slim
module.exports = (grunt) ->
# configuration
grunt.initConfig
# grunt sass
sass:
compile:
options:
style: 'expanded'
@thomd
thomd / LC_COLORS.md
Last active May 19, 2024 11:36
LSCOLORS & LS_COLORS

alternatively use: http://geoff.greer.fm/lscolors/

LSCOLORS

The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color.

The color designators are as follows:

a black

@aoi0308
aoi0308 / string_each.js
Created September 7, 2013 02:46
JavaScriptの文字列をforEachでループ処理する。
// 処理対象の文字列
var str = "Hello, JavaScript!";
// 通常のfor文で行う
for (var i = 0; i < str.length; i++) {
console.log(str[i]);
}
// 一応動くけど、まぁやめた方が良い
for (var i in str) {
@rummelonp
rummelonp / zsh_completion.md
Last active February 22, 2023 15:06
zsh の補完関数の自作導入編

zsh の補完関数の自作導入編

あまり深く理解してないので識者のツッコミ大歓迎

補完を有効にする

取り敢えず最低限だけ

# 補完を有効にする
@leeoades
leeoades / Pausable Observable
Created December 17, 2012 12:27
Pause an RX stream
public static IObservable<T> Pausable<T>(
this IObservable<T> sourceStream,
IObservable<bool> isPausedStream,
bool startPaused = false)
{
return Observable.Create<T>(o =>
{
var subscriptions = new SerialDisposable();
var replaySubjects = new SerialDisposable();
@ts-3156
ts-3156 / detect_skin.cpp
Created September 25, 2011 12:22
OpenCVで肌色を抽出するたぶん一番簡単なサンプル
// HSVに変換して肌色っぽい領域を抽出する
// 顔認識結果は全く使わない
void detect(void)
{
IplImage *image_src; // 元画像 カラーモデルはBGR
IplImage *image_src_hsv; // 元画像をHSV表色系に変換したもの
IplImage *image_only_hadairo; // 肌色領域だけを抽出したマスク画像
IplImage *image_dst; // 何らかのフィルタの結果を入れる予定だけど、今は元画像のまま
char* file_name = "images/purikura.jpg";
if((image_src = loadImage(file_name, CV_LOAD_IMAGE_ANYCOLOR)) == NULL){