A Pen by Mohamad El-Husseini on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('ready page:change', function() { | |
$('selector').tooltip('show'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/routes.rb | |
resources :documents do | |
scope module: 'documents' do | |
resources :versions do | |
post :restore, on: :member | |
end | |
resource :lock | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- provide :title, ts(:title) | |
- page_header :projects | |
= form_for [@workspace, @project, Upload.new], html: { class: 'form-horizontal' } do |f| | |
div class="panel panel-default panel-upload" | |
/ div class="panel-heading" | |
div class="panel-title" Upload Files | |
/ div class="panel-body text-center" |
This describes the workflow to use Heroku as a staging environment. It assumes you already have an existing heroku app in production.
# rename your git remote heroku to something else like production
git remote rename heroku production
# so now you will push as: git push production master
# create the staging app
heroku apps:create staging-appname
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@doc ~s""" | |
Takes a string and an atom that refers to any function name in `Gibran.Counter`. | |
It tokenises the string, then applies the given function to the resulting tokens. The function | |
name must be an `atom`. You can pass a list of options to the tokeniser as `opts` and a list | |
of options to the receiving function as `fn_opts`. | |
For example, the following two calls are equivalent: | |
Gibran.from_string("The Prophet", :token_count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1_0_0_1_ | |
'{ "1": 0, "2": 1, "3": 0, "4": 0 }' | |
{ "1" => 0, "2" => 1, "3" => 0, "4" => 0, }.hash | |
WorkspaceTypes: | |
id: [Int] | |
name: [String] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpdateDocument | |
def self.call_on_collection(documents, attributes) | |
Document.transaction do | |
documents.map { |document| new(document) }.each { |service| service.call_without_job(attributes) } | |
end.each(&:queue_job) | |
end | |
attr_reader :document | |
def initialize(document) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def alert_tag(options, &block) | |
content_tag :div, options do | |
yield | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class DummyController < ApplicationController | |
include Authable | |
end | |
class AuthableTest < ActionController::TestCase | |
setup do | |
include_default_request_headers | |
@dummy = DummyController.new |