Skip to content

Instantly share code, notes, and snippets.

View bullfight's full-sized avatar
🚀

Patrick Schmitz bullfight

🚀
View GitHub Profile
@bullfight
bullfight / order.js
Created May 30, 2012 08:52
Using HATEOAS and Backbone.js
var Order = Backbone.Model.extend({
});
var HalModel = Backbone.Model.extend({
url: function() {
return get("_links").self;
},
});
parse: function(response) {
class LessonShow
constructor: (@selector) ->
$.ajax
url: $(@selector).data('json-url')
cache: false
dataType: 'json'
success: @success
complete: @complete
success: (object) =>
- return unless article.promotions.present?
%section#associated_freemusic.module.inner
%header.sty-plain
%hgroup
%h3= t('modules.shared.heading.mp3_downloads')
- unless current_user
%section.signup
= link_to "<span class='fg ico-user-silhouette'>&nbsp;</span>#{t("site_header.account_links.sign_up")}".html_safe, janrain_signup_url, :class => "btn sty-blue siz-large with-icon", 'data-lightbox-type' => 'iframe', 'data-lightbox' => janrain_signup_url, 'data-lightbox-width' => '700', 'data-lightbox-height' => '800'
= link_to "<span class='fg ico-lock'>&nbsp;</span>#{t('site_header.account_links.sign_in')}".html_safe, janrain_signin_url, :class => "btn sty-gray size-large with-icon", 'data-lightbox-type' => 'iframe', 'data-lightbox' => janrain_signin_url, 'data-lightbox-width' => '700', 'data-lightbox-height' => '800'
.page-header
%h2= link_to 'LESSONS', lessons_path
.page-wrapper
#lesson{ :data => { "json-url" => lesson_url(@lesson, :format => :json) } }
.lesson-left
.lesson-right
%div
class Search
attr_accessor :params, :locale, :results
def initialize(params, locale)
return if params[:search].blank?
@params = params
@params[:page] ||= "1"
@params[:per_page] ||= "10"
@locale = Localized::Config.locale_to_site_map[locale].to_s #Hacktastic, should work with locale.to_s
self.send(@params[:filter])
class Search
attr_accessor :params, :locale
def initialize(params, locale)
return if params[:search].blank?
@params = params
@locale = locale
self.send(@params[:filter])
end
@bullfight
bullfight / _submissions.html.haml
Created January 18, 2012 14:08
app/views/promotions/parts/
%header.hdg-main
%hgroup
%h3
%span.taggy #{idx + 1}:
= pp.user.display_name
.byline
= "#{t('pages.promotions.text.submitted_on')}:"
= tz_date(pp.created_at)
%details
%summary.pie-clearfix
@bullfight
bullfight / tail.py
Created January 12, 2012 16:48 — forked from sra448/tail.py
sublime text 2 command for tailing and greping the rails logfile
import sublime, sublime_plugin, os
class TailCommand(sublime_plugin.TextCommand):
def run(self, edit):
from datetime import datetime
filtertext = "FLO"
# open sublime console
self.view.window().run_command("show_panel", { "panel": "console", "toggle": "true" })
@bullfight
bullfight / gist:1468812
Created December 12, 2011 19:53
heroku console log
# Initial State
$ heroku ps
Process State Command
------- --------- ------------------------------------
web.1 up for 6h bundle exec thin start -p $PORT -e..
web.2 up for 6h bundle exec thin start -p $PORT -e..
# Scale issued to no effect
$ heroku ps:scale worker=1
jQuery ->
if $("body.lessons.show").length > 0
new LessonShow("#lesson")
$(document).keypress (e) ->
if e.which is 32 and !$(e.target).is('input, textarea') and $(".lesson-video video").length > 0
video = $(".lesson-video video")[0]
if video.paused
sublimevideo.play()
else