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
| Paperclip.interpolates(:placehold_it) do |attachment, style| | |
| # assumes using dimensions specified as integer, eg "250x250#" | |
| params = attachment.styles[style][:geometry].match(/\d+x\d+/).to_s + "&text=#{attachment.instance.name}" | |
| "http://www.placehold.it/" + params | |
| 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
| <snippet> | |
| <content><![CDATA[ | |
| respond_to do |format| | |
| if @${1:${TM_FILENAME/(.*?)(s?)(_controller\..+)/$1/}}.save! | |
| format.html { redirect_to @${1:${TM_FILENAME/(.*?)(s?)(_controller\..+)/$1/}}, notice: "${2:${TM_FILENAME/(.*?)(s?)(_controller\..+)/\u$1/}} has been saved successfully" } | |
| format.json { render json: @${1:${TM_FILENAME/(.*?)(s?)(_controller\..+)/$1/}} } | |
| else | |
| format.html { render action: "new" } | |
| format.json { render json: @${1:${TM_FILENAME/(.*?)(s?)(_controller\..+)/$1/}}.errors, status: :unprocessable_entity } | |
| 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
| <cfif thisTag.ExecutionMode is 'end'> | |
| <cfset THISTAG.Content = THISTAG.GeneratedContent /> | |
| <cfset THISTAG.GeneratedContent = "" /> | |
| <cfparam name="to" default="#attributes.to#" /> | |
| <cfparam name="from" default="#attributes.from#" /> | |
| <cfparam name="subject" default="#attributes.subject#" /> | |
| <cfparam name="cc" default="" /> | |
| <cfparam name="bcc" default="" /> |
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
| namespace :taco do | |
| resources :ingredients do | |
| get :search1, on: :member | |
| resource :search2, only: :show | |
| end | |
| end | |
| search1_taco_ingredient GET /taco/ingredients/:id/search1(.:format) taco/ingredients#search1 | |
| taco_ingredient_search2 GET /taco/ingredients/:ingredient_id/search2(.:format) taco/search2s#show |
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
| mkdir -p ~/scripts/git | |
| echo 'git branch --merged | grep -wiv -e "main" -e "master" | xargs -n 1 git branch -d' > ~/scripts/git/git-bomb | |
| echo 'git remote prune origin' >> ~/scripts/git/git-bomb | |
| chmod +x ~/scripts/git/git-bomb | |
| sudo ln -s ~/scripts/git/git-bomb /usr/bin/git-bomb |
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
| when using single line declaration, and a property is added later | |
| #foo { width: 10px; } | |
| becomes... | |
| - #foo { width: 10px; } | |
| + #foo { | |
| + width: 10px; | |
| + height: 20px; |
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
| array.map { |a| "<p>#{a}</p>" }.join("\n") |
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
| source 'https://rubygems.org' | |
| gem 'octokit' | |
| gem 'axlsx' |
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 'octokit.rb' | |
| # export GITHUB_TOKEN=000000000000000 | |
| # export GITHUB_API_ENDPOINT=http://0.0.0.0/api/v3 | |
| # export GHE_HOST=0.0.0.0 | |
| # export GHE_PROTOCOL=https | |
| ACCESS_TOKEN = ENV.fetch("GITHUB_TOKEN") | |
| API_ENDPOINT = ENV.fetch("GITHUB_API_ENDPOINT") | |
| HOST = ENV.fetch("GHE_HOST") # github.com |
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 RachelsPoem | |
| attr_accessor :holes_per_year, :years, :split_after_years | |
| attr_reader :total_holes | |
| def initialize(holes_per_day:3, years:23, days_per_year:365.25, split_after_years:7) | |
| @total_holes = 0 | |
| self.holes_per_year = holes_per_day * days_per_year | |
| self.years = years | |
| self.split_after_years = split_after_years | |
| end |
OlderNewer