Skip to content

Instantly share code, notes, and snippets.

View bernardoamc's full-sized avatar

Bernardo de Araujo bernardoamc

View GitHub Profile
@bernardoamc
bernardoamc / my_app.ex
Created June 9, 2016 11:07 — forked from alanpeabody/my_app.ex
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@bernardoamc
bernardoamc / gist:a47699201eb7bb02b21cbfa4fbebd1c2
Created May 19, 2016 04:29 — forked from tonymtz/gist:714e73ccb79e21c4fc9c
Uninstall XQuartz.app from OSX Yosemite
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in
@bernardoamc
bernardoamc / chat.rb
Created April 19, 2016 14:26 — forked from HoneyryderChuck/chat.rb
Simple Chat Application, proof of concept for hybrid of thread-server http with evented-server SSE.
# chat.rb
require 'sinatra/base'
# this also loads celluloid io, let's keep that in mind
require 'celluloid/current'
require 'reel'
# The chat server, an IO Event Loop held by the actor
# Collects connections (Reel Event Streams)
#
# Contrary to EventMachine, there is no event callback for
# if you have a directory of files that look like:
# 2015-03-21 11.23.39.jpg
# 2015-04-15 09.55.20.jpg
# 2015-03-21 11.23.42.jpg
# 2015-05-12 13.14.59.png
#
# this Rakefile will move all the files into subdirectories for year/month
task :default do |task|
file_list = FileList['*.jpg', '*.png']