This file contains hidden or 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
| @mixin random-color($selector) { | |
| #{$selector}: unquote("rgba(#{random(256) - 1}, #{random(256)-1}, #{random(256 - 1)}, #{random(100)/100})"); | |
| } | |
| $tags: (h1, h2, h3, h4, h5, p, li, a, strong, small, em); | |
| @each $tag in $tags { | |
| #{$tag} { | |
| @include random-color('color'); | |
| } |
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
This file contains hidden or 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
| First Name Last Name Email Address Phone Number Company Name | |
| Gerhard Kautzer gerhardkautzer@cronabayer.com 1-207-643-1816 Hodkiewicz-Lynch | |
| Myra Crona myracrona@schinner.info (724)196-9470 x998 Champlin-Hahn | |
| Josh Donnelly joshdonnelly@macejkovic.us 081-799-3139 x248 Casper Group | |
| Verna Farrell vernafarrell@schillercorkery.name 731.101.6219 Rosenbaum-Hane | |
| Lauriane Stracke laurianestracke@tremblayturner.biz 1-033-511-1831 x471 Prohaska-Sporer | |
| Kaya Luettgen kayaluettgen@christiansen.name (511)745-9273 Wyman, Trantow and Hane | |
| Steve Davis stevedavis@shields.info 787.315.2611 x747 Kuhic-Lowe | |
| Citlalli Pfeffer citlallipfeffer@lemkeblanda.co.uk 329-584-6962 x047 Gorczany and Sons | |
| Litzy Turcotte litzyturcotte@weber.name 1-084-641-4078 x4410 Hintz-Schmitt |
This file contains hidden or 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
| for f in app/views/devise/**/*.erb; do html2haml -e $f ${f%erb}haml && rm $f; done |
This file contains hidden or 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
| User | |
| has_many :recipes | |
| - name | |
| - location | |
| Recipe | |
| belongs_to :user | |
| has_many :recipe_fermentables |
This file contains hidden or 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 Dog | |
| def initialize(breed, color) | |
| @breed, @color = breed, color | |
| end | |
| def describe_me | |
| "I am a #{@breed} and I am #{@color}" | |
| end | |
| end |
This file contains hidden or 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
| <h1><%= markdown_to_html @post.title %></h1> | |
| <div class="row"> | |
| <div class="col-md-8"> | |
| <small> | |
| <%= image_tag(@post.user.avatar.tiny.url) if @post.user.avatar? %> | |
| submitted <%= time_ago_in_words(@post.created_at) %> ago by | |
| <%= @post.user.name %> |
This file contains hidden or 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
| module ReverseObject | |
| def reverse | |
| case self | |
| when Integer | |
| to_s.reverse.to_i | |
| when Float | |
| to_s.reverse.to_f | |
| end | |
| end | |
| end |
This file contains hidden or 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 'benchmark' | |
| puts "#{RUBY_ENGINE rescue ''} #{RUBY_ENGINE == 'jruby' ? JRUBY_VERSION : RUBY_VERSION}" | |
| def a ; "abc"*100 ; end | |
| def b ; "def"*100 ; end | |
| n = 1000000 | |
| Benchmark.bm(12) do |x| | |
| x.report('"#{a}#{b}"') { n.times { "#{a}#{b}" } } | |
| x.report('"" + a + b') { n.times { "" + a + b } } | |
| x.report('"" << a << b') { n.times { "" << a << b } } | |
| end |
This file contains hidden or 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 ChangeColumnTypeForUserRole < ActiveRecord::Migration | |
| ROLES = User.roles.keys | |
| def up | |
| users = User.all | |
| rename_column :users, :role, :old_role | |
| add_column :users, :role, :integer, default: 0 | |
| users.all.each do |u| | |
| u.update(role: ROLES.index(u.old_role)) |
This file contains hidden or 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 IncomingController < ApplicationController | |
| skip_before_action :verify_authenticity_token, only: [:create] | |
| def create | |
| @user = User.find_by(email: params[:sender]) | |
| if @user.nil? | |
| head 500 | |
| end |