Skip to content

Instantly share code, notes, and snippets.

View YuigaWada's full-sized avatar
📛
TOFU ON FIRE ... !

Yuiga Wada YuigaWada

📛
TOFU ON FIRE ... !
View GitHub Profile
@sasanquaneuf
sasanquaneuf / definition.py
Created January 22, 2016 10:22
フォード・ファルカーソン法とその応用 - アルゴリズムクイックリファレンス8章の補足 - ref: http://qiita.com/sasanquaneuf/items/14a4c6459813abf6ccbd
# パスの一覧を取得する…結果はコスト、辺のリスト、係数のリスト
def getAllPath(edges, visited, f, t, r, c, e, a):
if f == t:
r.append((c,e,a))
for k in neighbor[f].keys():
if k not in visited:
getAllPath(edges, visited + [f], k, t, r, c + neighbor[f][k][2], e + [neighbor[f][k][1]], a + [neighbor[f][k][0]])
# パスに対して「今そのパスが取れる最大の値」を返す
def getMaximalFlow(world, (c,e,a)):
@dougdiego
dougdiego / MigrateDefaults.swift
Last active July 13, 2025 19:14
Migrate NSUserDefaults to App Groups - Swift
func migrateUserDefaultsToAppGroups() {
// User Defaults - Old
let userDefaults = NSUserDefaults.standardUserDefaults()
// App Groups Default - New
let groupDefaults = NSUserDefaults(suiteName: "group.myGroup")
// Key to track if we migrated
let didMigrateToAppGroups = "DidMigrateToAppGroups"
@kaipakartik
kaipakartik / tree.go
Created December 25, 2013 07:00
Exercise: Equivalent Binary Trees
package main
import (
"code.google.com/p/go-tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
@Gab-km
Gab-km / github-flow.ja.md
Last active July 1, 2025 15:44 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@remi
remi / commit-msg
Created August 30, 2011 20:56
Git commit message spell check hook (kind of a proof of concept, but still usable)
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
@codiez
codiez / itunes_notifications.py
Created December 20, 2009 20:14
Listen for distributed notifications from iTunes of the current song
'''
This python script listens for distributed notifications from iTunes of new songs playing,
works alot better then constantly polling.
'''
import Foundation
from AppKit import *
from PyObjCTools import AppHelper
class GetSongs(NSObject):
def getMySongs_(self, song):