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
# From Ruby Tapas ep. 249 | |
def unindent(s) | |
s.gsub(/^#{s.scan(/^[ \t]+(?=\S)/).min}/, "") | |
end | |
puts unindent(<<-'EOS') | |
This is an indented document in Markdown. | |
It contains blank lines and a code block: | |
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
(function() { | |
function AjaxError(jqXHR, textStatus, errorThrown) { | |
this.name = 'AjaxError'; | |
this.message = textStatus; | |
this.jqXHR = jqXHR; | |
this.errorThrown = errorThrown; | |
} | |
AjaxError.prototype = new Error(); | |
AjaxError.prototype.constructor = AjaxError; |
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
#!/bin/bash | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
if [ -f ".rubocop.yml" ]; then | |
changed_ruby_files=$(git diff --cached --name-only --diff-filter=ACM | grep -e '\.rb$' | grep -v 'db/schema') | |
if [ "$changed_ruby_files" != "" ]; then | |
cd . # Cause RVM to change Ruby version to the one specified in the Gemfile or .ruby-version | |
bundle exec rubocop -n $changed_ruby_files || exit 1 | |
fi | |
fi |
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
# Allow Rails to use assets from Node packages | |
package_json = Rails.root.join("package.json") | |
Rails.configuration.watchable_files << package_json | |
Rails.configuration.to_prepare do | |
node_config = JSON.parse(package_json.read) | |
paths = Rails.configuration.assets.paths | |
node_modules = Rails.root.join("node_modules") | |
paths.reject! { |p| p.to_s.start_with?(node_modules.to_s) } | |
node_config["dependencies"].keys.each do |node_module| | |
module_dir = node_modules.join(node_module) |
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
# http://EditorConfig.org | |
root = true | |
[*] | |
charset = utf-8 | |
indent_size = 2 | |
indent_style = space | |
insert_final_newline = true | |
trim_trailing_whitespace = true |
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
git rev-parse HEAD > latest | |
git reset --hard HEAD^ | |
# make changes | |
git add -p | |
git commit --amend | |
git cherry-pick $(cat latest) | |
rm latest |
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
function AjaxError(jqXHR, textStatus, errorThrown) { | |
this.name = "AjaxError"; | |
this.message = textStatus; | |
this.jqXHR = jqXHR; | |
this.errorThrown = errorThrown; | |
} | |
AjaxError.prototype = new Error(); | |
AjaxError.prototype.constructor = AjaxError; | |
(function($) { |
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 "ruby-plsql" | |
require "thread" | |
module PLSQL | |
module SynchronizedProcedure | |
def ensure_tmp_tables_created(overload) | |
@@semaphore ||= Mutex.new | |
@@semaphore.synchronize { super } | |
end | |
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 "base64" | |
require "rack" | |
module Sass::Script::Functions | |
def radial_gradient_image_data_url(color = Sass::Script::Color.new([0, 0, 0]), height = Sass::Script::Number.new(5)) | |
assert_type height, :Number | |
svg_data_url(<<-SVG) | |
<svg xmlns="http://www.w3.org/2000/svg"> | |
<defs> | |
<radialGradient id="gradient"> |