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 'open-uri' | |
require 'nokogiri' | |
doc = Nokogiri(URI('https://www.nutritionix.com/taco-bell/menu/premium').read) | |
headers = doc.css('thead th a span span[aria-hidden]').map do |header| | |
header.text.strip | |
end | |
rows = doc.css('tbody tr').map do |row| |
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
ApplicationRecord.descendants.flat_map do |c| | |
c.reflect_on_all_associations.select do |a| | |
ActiveRecord::Reflection::BelongsToReflection === a && !a.options[:polymorphic] | |
end | |
end.map do |r| | |
[r.active_record.table_name, r.plural_name, r.options.slice(:optional, :foreign_key)] | |
end.uniq.sort |
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
https://www.graphviz.org/ |
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
task graph: :environment do | |
result = ActiveRecord::Base.connection.execute <<~SQL | |
select source.relname as source, dest.relname as dest | |
from pg_catalog.pg_constraint as fk | |
join pg_catalog.pg_class as source on source.oid = fk.conrelid | |
join pg_catalog.pg_class as dest on dest.oid = fk.confrelid | |
where contype = 'f'::char | |
SQL | |
relations = result.map(&:symbolize_keys).reduce({}) do |h, source:, dest:| |
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
;; very simple example on how to use Animated with reagent | |
;; https://facebook.github.io/react-native/docs/animations.html | |
(def animated (.-Animated js/React)) | |
(def animated-value (.-Value animated)) | |
(def animated-view (r/adapt-react-class (.-View animated))) | |
(defn bounce [] | |
(let [bounce-value (new animated-value 0)] | |
(.setValue bounce-value 1.5) |
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
live_loop :squiggle, sync: :drums do | |
#stop | |
s = synth :blade, note: :e, sustain: 1, slide: halves(0.5, 3).tick(:h), amp: 0.15 | |
4.times do | |
sleep halves(1, 5).tick | |
control s, note: degree(range(1,7).tick(:b), :c3, :major), | |
pan: rand(2) - 1, | |
amp: 0.3 | |
end | |
sleep vt.ceil - vt |
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
cljs.user=> (cljs.test/run-tests 'seqseq.test) | |
WARNING: Use of undeclared Var cljs.core/volatile! at line 1 <cljs repl> | |
WARNING: Use of undeclared Var cljs.core/concat at line 1 <cljs repl> | |
WARNING: Use of undeclared Var cljs.core/concat at line 1 <cljs repl> | |
WARNING: Use of undeclared Var cljs.core/concat at line 1 <cljs repl> | |
WARNING: Use of undeclared Var cljs.core/-vreset! at line 1 <cljs repl> | |
WARNING: Use of undeclared Var cljs.core/partial at line 1 <cljs repl> | |
WARNING: Use of undeclared Var cljs.core/merge-with at line 1 <cljs repl> | |
WARNING: Use of undeclared Var cljs.core/+ at line 1 <cljs repl> | |
WARNING: Use of undeclared Var cljs.core/-deref at line 1 <cljs repl> |
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
# project Ardour3 (3.5.357) configured on Fri Apr 4 11:02:56 2014 by | |
# waf 1.6.11 (abi 98, python 20706f0 on darwin) | |
# using ./waf configure | |
# | |
---------------------------------------- | |
Setting top to | |
/Users/brian/src/ardour | |
---------------------------------------- | |
Setting out to | |
/Users/brian/src/ardour/build |
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 get_step_name(scenario) | |
if Cucumber::Ast::OutlineTable::ExampleRow === scenario | |
outline = scenario | |
return outline.backtrace_line | |
else | |
scenario.instance_variable_get :@current_step | |
visitor = scenario.instance_variable_get :@current_visitor | |
listeners = visitor.instance_variable_get :@listeners | |
formatter = listeners.first | |
step = formatter.instance_variable_get :@current_step |
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
QuickFix | |
-------- | |
Overview: | |
rational: Vim has a lot of great ways to navigate a project. But if your computer already knows where the problem is, we should be able to jump straight there without searching again. | |
:help quickfix | |
Supports "edit-compile-edit" | |
Inspired by an Amega compiler |
NewerOlder