Skip to content

Instantly share code, notes, and snippets.

View lfzawacki's full-sized avatar
💭
Millennials just wanna have 🥑s

Lucas lfzawacki

💭
Millennials just wanna have 🥑s
View GitHub Profile
@lfzawacki
lfzawacki / user.rb
Created March 3, 2015 20:01
Users logged last month
class User < ActiveRecord::Base
def self.login_last_month
self.select { |u| u.last_sign_in_at && (u.last_sign_in_at + 30.days) >= Date.today }.count
end
end
In a new Ubuntu Trusty lxc-container:
sudo lxc-create -t ubuntu -n bbb-html5 -- -r trusty
Install BBB090: https://code.google.com/p/bigbluebutton/wiki/090InstallationUbuntu
Install development stuff: https://code.google.com/p/bigbluebutton/wiki/090Developing
Install nodejs
@lfzawacki
lfzawacki / convertmp3.sh
Last active August 29, 2015 14:08
convertmp3
#!/bin/bash
# Convert lots of *.flac into *.mp3 for consumption in devices without flac support
# Usage is:
# $ cd yourflacfolder
# $ convertmp3
# Files will be created in a new directory
MP3DIR="`basename \"$PWD\"` - mp3"
@lfzawacki
lfzawacki / bbb-whiteboard.css
Created July 21, 2014 18:11
BBB whiteboard meteor
/* CSS declarations go here */
svg {
border: 1px solid #000;
}
#messages {
margin-left: 400px;
}
@lfzawacki
lfzawacki / changedb
Created May 14, 2014 15:54
Simple script to manage different database.yml files in a rails development environment
#!/home/lucas/.rbenv/shims/ruby
# Use an appropriate file path for your ruby interpreter
require 'fileutils'
class ChangeDB
def initialize dir='config/.changedb', db_yml='config/database.yml'
@dir = dir
@db_yml = db_yml
@lfzawacki
lfzawacki / auto-run.sh
Created October 31, 2013 20:49
Speeding up your BBB tests
#!/bin/sh
while inotifywait -e modify $1; do
gradle --daemon test
done
@lfzawacki
lfzawacki / bbb.md
Last active December 26, 2015 22:19
BBB Html5 bridges

BBB Bridges / REDIS / HTML5

From https://github.com/bigbluebutton/bigbluebutton/tree/html5-bridge In bigbluebutton / bigbluebutton-apps / src / main / java / org / bigbluebutton / conference / service / Service Classes call methods from the bridge methods and write date to a redis instance

ChatService -> ChatBridge

Service Bridges

@lfzawacki
lfzawacki / generate_test.rb
Created August 20, 2013 16:26
Read a Rails model file and print to stdout an rspec describe block for each method
def warn_and_exit
puts "Prints to stdout a describe block for each method in the model file."
puts "\tusage \"#{__FILE__}\" [MODEL_FILE]"
exit 0
end
warn_and_exit if ARGV.size != 1
content = IO.read(ARGV[0])
@lfzawacki
lfzawacki / title.rb
Created August 19, 2013 16:07
Get title from a lot of links
#/usr/bin/ruby
require 'open-uri'
require 'nokogiri'
links = IO.read('links.txt').split("\n")
links.each do |link|
f = open(link)
doc = Nokogiri::HTML(f)
@lfzawacki
lfzawacki / remove.rb
Created August 13, 2013 17:54
remove accents ruby
def self.remove_accents(str)
accents = {
['á','à','â','ä','ã'] => 'a',
['Ã','Ä','Â','À'] => 'A',
['é','è','ê','ë'] => 'e',
['Ë','É','È','Ê'] => 'E',
['í','ì','î','ï'] => 'i',
['Î','Ì'] => 'I',
['ó','ò','ô','ö','õ'] => 'o',
['Õ','Ö','Ô','Ò','Ó'] => 'O',