Skip to content

Instantly share code, notes, and snippets.

View julienXX's full-sized avatar

Julien Blanchard julienXX

View GitHub Profile
(defun restclient-http-send-current-and-stay-in-current-buffer ()
"Standard RESTClient C-c C-c but stays in current buffer"
(interactive)
(restclient-http-send-current)
(other-window -1)
)
-include_lib("eunit/include/eunit.hrl").
-module(simple_server).
-export([start/0]).
basic_test_() ->
{"Test quit message",
fun() ->
simple_server:start(),
?assertEqual("Quit command received. Closing down server", simple_server ! "quit")
end

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

Screenshot

| top margin |
| [label] |
| [label2] [label3] |
| [button] |
| bottom margin |
@julienXX
julienXX / struct.rb
Last active December 11, 2015 13:18
WallInfo = Struct.new(:api_key, :params)
wall = ["apikey", {page_id: 4, token: "token", server: "factory"}]
info = WallInfo.new(*wall)
info.api_key = "api_key"
info.params = {page_id: 4, token: "token", server: "factory"}
much better than info.first or info[0]...
@julienXX
julienXX / time.rb
Created January 21, 2013 09:02
Time class for RubyMotion
class Time
def self.parse(string)
date_formatter = NSDateFormatter.alloc.init
date_formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
date_formatter.dateFromString string
end
def self.ago_in_words(seconds)
return "" unless seconds
λ ruby notifier.rb
DEPRECATION WARNING: Yajl::HttpStream is going to be removed in 2.0
- Listening room 543389
- Listening room 543383
D, [2012-12-19T15:31:03.438930 #12265] DEBUG -- : Terminating 6 actors...
{"room_id"=>543389, "created_at"=>"2012/12/19 14:30:00 +0000", "body"=>nil, "starred"=>false, "id"=>763740860, "user_id"=>nil, "type"=>"TimestampMessage"}
{"room_id"=>543389, "created_at"=>"2012/12/19 14:31:38 +0000", "body"=>"j'ai une piste Étienne Barrié", "starred"=>false, "id"=>763740861, "user_id"=>1320888, "type"=>"TextMessage"}
{"room_id"=>543389, "created_at"=>"2012/12/19 14:32:03 +0000", "body"=>"pour l'upload", "starred"=>false, "id"=>763741181, "user_id"=>1320888, "type"=>"TextMessage"}
{"room_id"=>543389, "created_at"=>"2012/12/19 14:32:10 +0000", "body"=>"yes", "starred"=>false, "id"=>763741282, "user_id"=>1320885, "type"=>"TextMessage"}
{"room_id"=>543389, "created_at"=>"2012/12/19 14:32:17 +0000", "body"=>"faudrait bootstraper ça ou changer de plugin", "starred"=>false, "id"=>763741371, "u
require "uri"
require "yajl/http_stream"
require "terminal-notifier"
require "celluloid"
class Stream
include Celluloid
def initialize(room, token)
@room = room
require "uri"
require "yajl/http_stream"
require "terminal-notifier"
token = TOKEN
room_id = ID
url = URI.parse("http://#{token}:x@streaming.campfirenow.com/room/#{room_id}/live.json")
regexp = Regexp.new('julien', true)
@julienXX
julienXX / gist:2672774bb4d46139435c
Created November 16, 2015 12:46
Rust cross-compilation on OSX
rustc: x86_64-apple-darwin/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd
error: linking with `clang` failed: exit code: 1
note: "clang" "-Wl,--as-needed" "-m64" "-L" "/Users/julien/Code/rust/x86_64-apple-darwin/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "x86_64-apple-darwin/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/std-a5fc0d6c.0.o" "-o" "x86_64-apple-darwin/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a5fc0d6c.so" "x86_64-apple-darwin/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/std-a5fc0d6c.metadata.o" "-Wl,-O1" "-nodefaultlibs" "-Wl,--whole-archive" "/var/folders/ch/w6vlkkr912n00b_t8q6dkgl00000gn/T/rustc.UYg7RveANPbS/libcollections-a5fc0d6c.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/var/folders/ch/w6vlkkr912n00b_t8q6dkgl00000gn/T/rustc.UYg7RveANPbS/liballoc-a5fc0d6c.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/var/folders/ch/w6vlkkr912n00b_t8q6dkgl00000gn/T/rustc.UYg7RveANPbS/librustc_unicode-a5fc0d6c.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archiv