Skip to content

Instantly share code, notes, and snippets.

View Loschcode's full-sized avatar
🌀
Probably coding

Laurent Schaffner Loschcode

🌀
Probably coding
View GitHub Profile
@nanne007
nanne007 / loop.ex
Created July 22, 2016 15:34
loop, while,break construct in elixir
defmodule Loop do
defmacro while(predicate, do: block) do
quote do
try do
for _ <- Stream.cycle([:ok]) do
if unquote(predicate) do
unquote(block)
else
throw :break
end
@kylemcdonald
kylemcdonald / CameraImage.cpp
Created November 23, 2015 15:30
openFrameworks app for sending images to disk for processing, and reading text back from disk. Used for "NeuralTalk and Walk".
#include "ofMain.h"
#include "ofxTiming.h"
class ofApp : public ofBaseApp {
public:
ofVideoGrabber grabber;
DelayTimer delay;
ofTrueTypeFont font;
string description;
@mattriley
mattriley / post_xml.rb
Created January 25, 2012 22:39
Ruby HTTP POST request containing XML content
require 'net/http'
def post_xml url_string, xml_string
uri = URI.parse url_string
request = Net::HTTP::Post.new uri.path
request.body = xml_string
request.content_type = 'text/xml'
response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
response.body
end