Skip to content

Instantly share code, notes, and snippets.

View 335g's full-sized avatar

Yoshiki Kudo 335g

View GitHub Profile
@omz
omz / dropboxlogin.py
Created November 7, 2012 21:16
dropboxlogin
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
# access_type can be 'app_folder' or 'dropbox', depending on
# how you registered your app.
access_type = 'app_folder'
@staltz
staltz / introrx.md
Last active July 27, 2024 04:59
The introduction to Reactive Programming you've been missing
@dankogai
dankogai / peekFunc.swift
Last active February 28, 2023 15:38
Get the internal function pointer in swift
/// See
/// https://github.com/rodionovd/SWRoute/wiki/Function-hooking-in-Swift
/// https://github.com/rodionovd/SWRoute/blob/master/SWRoute/rd_get_func_impl.c
/// to find why this works
func peekFunc<A,R>(f:A->R)->(fp:Int, ctx:Int) {
let (hi, lo):(Int, Int) = reinterpretCast(f)
let offset = sizeof(Int) == 8 ? 16 : 12
let ptr = UnsafePointer<Int>(lo+offset)
return (ptr.memory, ptr.successor().memory)
}
@14427
14427 / hkt.rs
Last active February 7, 2024 10:18
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
anonymous
anonymous / playground.rs
Created December 15, 2016 03:40
Shared via Rust Playground
// [Rust で 言語処理100本ノック 第1章 前半 - 僕とコードとブルーハワイ](http://equal-001.hatenablog.com/entry/2016/12/14/232933)
// にコメントフォームがなかったのでコードぶん投げます
//# 00. 文字列の逆順
//文字列"stressed"の文字を逆に(末尾から先頭に向かって)並べた文字列を得よ.
fn no_00() -> String {
let s = "stressed";
s.chars()
.rev()
// 型を入れないとエラーになるのはcollectがジェネリックなため、推論出来ないから。
@chriseidhof
chriseidhof / parsers.swift
Last active December 28, 2020 04:36
Faster Parsers
//
// Operators.swift
// FastParsing
//
// Created by Chris Eidhof on 26/12/2016.
// Copyright © 2016 objc.io. All rights reserved.
//
// TODO: give appropriate credit. Many parts were stolen from SwiftParsec.