Skip to content

Instantly share code, notes, and snippets.

⌨️
Click! Clack!

Łukasz Jan Niemier hauleth

⌨️
Click! Clack!
Block or report user

Report or block hauleth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thequux
thequux / README.md
Last active May 31, 2016
Multirust-compatible racer wrapper
View README.md

This wrapper automatically sets the RUST_SRC_DIRECTORY environment variable for whatever rust compiler is currently active, automatically creating a new checkout whenever necessary. This should be compatible with all of the multirust-alike tools, but it has only been tested with rustup.rs

Installation

Simply place this somewhere on your path before the main racer binary and set the execute bit.

Uninstallation

@paragonie-scott
paragonie-scott / crypto-wrong-answers.md
Last active Jun 30, 2019
An Open Letter to Developers Everywhere (About Cryptography)
View crypto-wrong-answers.md
@andkerosine
andkerosine / raskell.rb
Created Aug 15, 2012
Haskell-like list comprehensions in Ruby
View raskell.rb
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@isa
isa / gist:2571012
Created May 1, 2012
Convert in less than 30 lines
View gist:2571012
Question: Convert following into the latter data structure in less than 30 lines:
List:
A, B, C
A, C, E
E, F, D
D, A, J
E, D, J
List
@amscotti
amscotti / mongo_urlshortener.rb
Created Apr 2, 2012
Example of using MongoMapper and Sinatra to make an url shortener - http://bit.ly/wZw0TO
View mongo_urlshortener.rb
require "rubygems"
require "sinatra"
require "haml"
require "mongo_mapper"
class Shorten
include MongoMapper::Document
key :url, String
key :shorten_id, String
View fibur.markdown

Fibur

Fibur is a library that allows concurrency during Ruby I/O operations without needing to make use of callback systems. Traditionally in Ruby, to achieve concurrency during blocking I/O operations, programmers would make use of Fibers and callbacks. Fibur eliminates the need for wrapping your I/O calls with Fibers and a callback. It allows you to write your blocking I/O calls the way you normally would, and still have concurrent execution during those I/O calls.

Example

Say you have a method that fetches data from a network resource:

@NARKOZ
NARKOZ / whitespace.rake
Created Aug 30, 2011
Whitespaaaaaaaace! WHITESPAAAAAAAACE!
View whitespace.rake
# requires BSD sed
namespace :whitespace do
desc 'Removes trailing whitespace'
task :cleanup do
sh %{for f in `find . -type f | grep -v .git | grep -v ./vendor | grep -v ./tmp | egrep ".(rb|js|haml|html|css|sass)"`;
do sed -i '' 's/ *$//g' "$f";
done}, {:verbose => false}
puts "Task cleanup done"
end
You can’t perform that action at this time.