Skip to content

Instantly share code, notes, and snippets.

View dandehavilland's full-sized avatar

Dan de Havilland dandehavilland

  • Halle (Saale) / London / Budapest
View GitHub Profile
@dandehavilland
dandehavilland / routes.rb
Created September 12, 2019 09:34
Sjabloon routes file
Rails.application.routes.draw do
resource :billing, controller: 'sjabloon/billing', only: [:create, :update, :destroy] do
member do
get 'setup', to: 'sjabloon/billing#new', as: 'new'
get '/', to: 'sjabloon/billing#show'
end
resources :plans, controller: 'sjabloon/plans', only: [:index, :update]
end
resource :card, controller: 'sjabloon/card', only: [:update]
@dandehavilland
dandehavilland / errors
Last active September 12, 2019 08:12
sjbloon install errors
rails generate model Announcement account:references title body:text show_site_wide announcement_type target published_at:datetime
/Users/dan/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/routing/route_set.rb:581:in `add_route': Invalid route name, already in use: 'root'
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explai
ned here:
https://guides.rubyonrails.org/routing.html#restricting-the-routes-created (ArgumentError)
from /Users/dan/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/routing/mapper.rb:1957:in `add_route'
from /Users/dan/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/routing/mapper.rb:1928:in `decomposed_match'
from /Users/dan/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/act
import Ember from 'ember';
import MixinOne from '../mixins/one';
import MixinTwo from '../mixins/two';
const {
on,
RSVP
} = Ember;
export default Ember.Controller.extend(MixinOne, MixinTwo, {
import Ember from 'ember';
import AuthenticatedRoute from 'dashboard/routes/authenticated';
import DateRangedMixin from 'dashboard/routes/mixins/date-ranged';
import ChartMixin from 'dashboard/routes/mixins/chart';
export default AuthenticatedRoute.extend(DateRangedMixin, ChartMixin, {
model: function(options) {
var _this = this;
return this.store.findQueryOne(
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dandehavilland
dandehavilland / tm2-crash.txt
Created January 19, 2015 10:02
.editorconfig
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
@dandehavilland
dandehavilland / _flip_switch.scss
Last active August 29, 2015 13:56
On/Off switch for Ember (Flip Switch)
.flip-switch {
position: relative; width: 68px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.flip-switch-checkbox {
display: none;
}
.flip-switch-label {
display: block; overflow: hidden; cursor: pointer;
border: 2px solid #999999; border-radius: 20px;
# Resources App
app_resources = Dragonfly[:resources]
app_resources.configure_with(:rails) do |c|
c.datastore.root_path = Rails.root.join('public', 'system', 'resources').to_s
# This url_format makes it so that dragonfly urls work in traditional
# situations where the filename and extension are required, e.g. lightbox.
# What this does is takes the url that is about to be produced e.g.
# /system/resources/BAhbB1sHOgZmIiMyMDEwLzA5LzAxL1NTQ19DbGllbnRfQ29uZi5qcGdbCDoGcDoKdGh1bWIiDjk0MngzNjAjYw
# and adds the filename onto the end (say the file was 'refinery_is_awesome.pdf')
# /system/resources/BAhbB1sHOgZmIiMyMDEwLzA5LzAxL1NTQ19DbGllbnRfQ29uZi5qcGdbCDoGcDoKdGh1bWIiDjk0MngzNjAjYw/refinery_is_awesome.pdf
@dandehavilland
dandehavilland / render_template.php
Created December 19, 2011 14:10
render PHP template inline
<?php
function render_template($filename, $locals=array()) {
explode($locals);
ob_start();
include($filename);
return ob_get_clean();
}
# Earl: Strings that do web things
#
#
# Examples:
#
# text = "Blah blah http://tinyurl.com/4bnjzbu blah http://tinyurl.com/4tefu9f"
#
# text.urls # => ["http://tinyurl.com/4bnjzbu", "http://tinyurl.com/4tefu9f"]
#
# text.locations # => ["http://nutrun.com/weblog/2010/11/17/supercharged-ruby-console-output.html", "http://nutrun.com"]