Skip to content

Instantly share code, notes, and snippets.

@walidvb
walidvb / soundcloud_filter.module
Created February 11, 2014 00:21
Adds visual and height manipulation to the html5 player
/*
* Modified on 11.02.2014 by walidvb
* to add a 'visual' checkbox, added by the soundcloud API
*
*
*
*/
<?php
<div class="top-swiper-container" swiper="vert" my-fullscreen="y" ng-controller="mainCtrl" ng-class="{'info-open': infoOpen, 'nav-open': navOpen}">
<navigation ng-controller="infoCtrl">
<div id="info">
<div id="info-wrapper" my-info="data.info" ng-click="toggleInfo()">
</div>
</div>
<div class="nav-trigger" ng-click="toggleNav();"><span></span></div>
<div class="pagination-wrapper">
def mail_subscribers(book, attrs = {})
@book = book
@body ||=attrs[:body]
if attrs[:attachments]
puts attrs[:attachments]
attrs[:attachments].all? {
|attachment|
attachments[attachment[:filename]] = attachment[:content]
-----o-----master
\------o-------int
\--------------br1
To:
-----o-----master
\--------------int
Book
has_many chapters
accepts_nested_attributes_for :chapters, :allow_destroy => true
Chapter
belongs_to :book
has_one :storyboard
has_many :tiles, :through => :storyboard
accepts_nested_attributes_for :tiles, :allow_destroy => true
class Chapter < ActiveRecord::Base
has_attached_file :file,
:storage => :filesystem
def to_file
if Rails.env != "test"
#open(file.url) { |f| @content = f.read}
@content = file.copy_to_local_file.read
@filename = file_file_name
else
if fetching /*, fetch /app/*
if ! request.referer is collinfontaine.ch
if ! (/drupal/user || /drupal/admin || drupal/node/*/edit)
rewrite /drupal to /app #to avoid people visiting the drupal site
if crawler
rewrite / to /drupal/home
Scenario: Book is private
Given there is a published book
And the book is private
When I visit the book
Then I should be on the home page
@walidvb
walidvb / thedirective
Created June 15, 2014 13:04
A tumblr service to embed tumblr in a second
<my-tumblr></my-tumblr>
def search(hashtag)
@client = Twitter::REST::Client.new do |config|
config.consumer_key = ENV["TWITTER_CONSUMER_KEY"]
config.consumer_secret = ENV["TWITTER_CONSUMER_SECRET"]
config.access_token = ENV["TWITTER_ACCESS_TOKEN"]
config.access_token_secret = ENV["TWITTER_ACCESS_SECRET"]
end
@client.search(hashtag).attrs[:statuses]
end