Skip to content

Instantly share code, notes, and snippets.

View tioover's full-sized avatar

ACCOUNT MOVED tioover

View GitHub Profile
@yshui
yshui / number_parser.rs
Last active November 1, 2020 15:39
GitCafe格调秀第二周第一题,Proof-of-concept。需要rust-peg
#![feature(plugin)]
#![feature(collections)]
#![feature(str_char)]
#![feature(convert)]
#![plugin(peg_syntax_ext)]
use std::io;
peg! pynum(r#"
digit -> i64
= digit_nozero
/ "ling" {0i64}
@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> {
@nrc
nrc / tools.md
Last active August 2, 2023 16:40
Rust tooling

Rust developer tools - status and strategy

Availability and quality of developer tools are an important factor in the success of a programming language. C/C++ has remained dominant in the systems space in part because of the huge number of tools tailored to these lanaguages. Succesful modern languages have had excellent tool support (Java in particular, Scala, Javascript, etc.). Finally, LLVM has been successful in part because it is much easier to extend than GCC. So far, Rust has done pretty well with developer tools, we have a compiler which produces good quality code in reasonable time, good support for debug symbols which lets us leverage C++/lanaguge agnostic tools such as debuggers, profilers, etc., there are also syntax highlighting, cross-reference, code completion, and documentation tools.

In this document I want to layout what Rust tools exist and where to find them, highlight opportunities for tool developement in the short and long term, and start a discussion about where to focus our time an

@Javran
Javran / gist:8142839
Created December 27, 2013 05:16
a generic `curry` implementation in mit-scheme
(define (curry f)
(define (curry-aux f args arity)
(lambda (a)
(let ((new-args (cons a args)))
(cond ((= arity 1)
(apply f (reverse! new-args)))
((> arity 1)
(curry-aux f new-args (- arity 1)))
; fail otherwise
))))
@tioover
tioover / gtran.py
Last active December 10, 2015 08:28
#!/usr/bin/env python2
#coding=utf8
import gtk
import webkit
url = "http://translate.google.com/"
class Main(gtk.Window):
max_size = (780, 400)
min_size = (140, 50)
browser_size = (760, 340)
@bearice
bearice / p.go
Created December 6, 2012 07:17
package main
import "fmt"
import "sync"
import "math"
import "runtime"
import "sync/atomic"
//Dead slow
func pseq(max int) chan int{
out := make(chan int)
@sillygwailo
sillygwailo / Open in Chrome from Safari.scpt
Created September 23, 2011 07:16
Open in Chrome from Safari and vice versa
-- from http://www.tuaw.com/2011/03/14/use-applescript-to-open-current-safari-url-in-google-chrome/
-- install FastScripts http://www.red-sweater.com/fastscripts/ and place this AppleScript in the Scripts applications folder for Google Chrome.
-- For me that was ~/Library/Scripts/Applications/Safari
-- You can then assign it a keyboard shortcut. I went with Cmd-Shift-C
property theURL : ""
tell application "Safari"
set theURL to URL of current tab of window 1
end tell
tell application "Google Chrome"