Skip to content

Instantly share code, notes, and snippets.

View thehydroimpulse's full-sized avatar

Somewhere thehydroimpulse

View GitHub Profile
@HairyFotr
HairyFotr / gist:4995607
Created February 20, 2013 13:38
Scala Clojure interop wrapper
class ClojureWrap(ns: String, objName: String) {
import clojure.lang.{RT,Var}
import scala.collection.mutable.HashMap
RT.loadResourceScript(objName+".clj")
val obj = ns+"."+objName
val funcs = new HashMap[String, Var]
def /(func: String, a: Any): Object =
funcs.getOrElseUpdate(func, RT.`var`(obj, func)).invoke(a.asInstanceOf[Object])
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active August 29, 2026 20:37
A badass list of frontend development resources I collected over time.
@ozkatz
ozkatz / ec2_ssh_config.py
Created June 21, 2013 00:50
generate an ~/.ssh/config file from your EC2 instances, so that you'd never have to lookup those fugly ec2-xx-xx-xx-xxx.compute-1.amazonaws.com hostnames again. Use your instance name instead!
#!/usr/bin/env python
import os
import sys
import argparse
try:
from boto.ec2.connection import EC2Connection
except ImportError:
sys.stderr.write('Please install boto ( http://docs.pythonboto.org/en/latest/getting_started.html )\n')
sys.exit(1)
@nodesocket
nodesocket / bootstrap.flatten.css
Last active June 3, 2026 23:25
Below are simple styles to "flatten" bootstrap. I didn't go through every control and widget that bootstrap offers, only what was required for https://commando.io, so your milage may vary.
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
anonymous
anonymous / foo.rs
Created December 28, 2013 18:14
#[no_uv];
extern mod native;
#[start]
fn start(argc: int, argv: **u8) -> int {
do native::start(argc, argv) {
main();
}
}

RFC: Proposal for enhancing macros

Currently we have a powerful macro system, but custom control structures stick out like a sore thumb due to the extra set of delimiters that are required.

Implementing a control structure with macro_rules!

Here is an example of a custom for-like construct with some added functionality:

@depp
depp / gist:8378663
Created January 12, 2014 00:05
Iterate over a string
fn main() {
let mut x = "hello".chars();
while (true) {
match x.next() {
Some('o') => return,
Some(c) => println!("Char: {}", c),
None => return
}
}
}
@wycats
wycats / hello.rs
Last active January 3, 2016 00:08
fn main() {
do RoutedServer::serve |config, router| {
config.listen("127.0.0.1", 1337);
router.get("/hello", |_,res| res.write("hello world"));
router.get("/posts/:id", |req,res| {
res.write(format!("post {}", req.params["id"]))
});
}
#[crate_type = "rlib"];
#[comment = "A doubly-linked list implementation using Rc and Weak"];
use std::rc::{Rc, Weak};
use std::cell::RefCell;
type RcN<T> = RefCell<Node<T>>;
/// An immutable, doubly-linked list. Use RefCell to store mutable values.
pub struct List<T> {