Skip to content

Instantly share code, notes, and snippets.

View unamashana's full-sized avatar

Hana Mohan unamashana

View GitHub Profile
<html>
<body>
<div id="player"></div>
<script type="text/javascript">
Muziboo.Player.embedSingle(); // Won't work as my_javascript_files are not loaded yet
</script>
<script type="text/javascript" src="my_javascript_files"></script>
</body>
</html>
<html>
<script type="text/javascript">
_muzq ||= []
</script>
<body>
<div id="player"></div>
<script type="text/javascript">
_muzq.push(['Muziboo.Player.embedSingle']); // The queue will store this message until the javascript is loaded
</script>
Muziboo.Queue = {
process: function(){
_muzq.each(function(e){
Muziboo.Queue.execute(e);
});
// Queue is no longer needed as the stack is ready
_muzq = {
push: function(e){
@unamashana
unamashana / hsi_notifications
Created February 3, 2011 18:28
Email notifications for HackerStreet India
require 'rubygems'
require 'rb-inotify'
require 'sqlite3'
require 'active_record'
require 'mail'
require 'log4r'
include Log4r
MYLOG = Logger.new 'mylog'
file = FileOutputter.new('fileOutputter', :filename => 'hsi_notifications.log', :trunch => false)
Then I should see :"flash.success.admin_signup" with email: "joedoe@example.com", first_name: "Joe"
Then /^I should see :"([^\"]*)"(?: with #{capture_fields})?$/ do |text, fields|
if page.respond_to? :should
page.should have_content(I18n.t(text, eval("{#{fields}}")))
else
assert page.has_content?(I18n.t(text, eval("{#{fields}}")))
end
end
bundle config build.mysql --with-mysql-config=/usr/local/bin/mysql_config
@unamashana
unamashana / jasmine.yml
Created July 5, 2011 05:24
Jammit and Jasmine
src_files:
# For CI
- public/assets/common.js
- public/assets/app_assets.js
- public/assets/app.js
- public/javascripts/testing/sinon-1.1.0.js
- public/javascripts/testing/jasmine-sinon.js
- public/javascripts/testing/backbone-factory.js
- public/javascripts/testing/backbone_mocks.js
@unamashana
unamashana / js2cs.rb
Created July 6, 2011 05:15
Converting a Javascript Project to CoffeeScript
#SRC_BASE_DIR = "public/javascripts/backbone"
#DEST_BASE_DIR = "app/coffeescripts/backbone"
SRC_BASE_DIR = "spec/javascripts"
DEST_BASE_DIR = "spec/coffeescripts"
JS2COFFEE = "~/node_modules/js2coffee/bin/js2coffee"
dirs = []
files = []
Dir.glob("#{SRC_BASE_DIR}/**/*.js").each do |file|
SB.Collections.TicketList = Backbone.Collection.extend({
model: SB.Models.Ticket,
url: "/tickets",
name: "tickets"
}
ticketView = new SB.Views.TicketView({
model: new SB.Models.Ticket({
id: ticket_id
})
})