{% embed https://asciinema.org/a/330532 %}
{% embed https://codepen.io/elisavetTriant/pen/KKvRRyE %}
class SomeClass | |
def self.client | |
true | |
end | |
end | |
class UsesClient | |
def self.call | |
client.nil? | |
end |
require 'rake/task' | |
module Logging | |
module Rake | |
module Task | |
def execute(args) | |
message = { | |
rake_task: { | |
name: self.name, | |
arguments: args.to_a |
# this is constant space, linear time, no memoization. | |
def fib(n) | |
counter, current, previous = 0, 0, 1 | |
while counter < n | |
counter, current, previous = counter + 1, current + previous, current | |
end | |
current | |
end |
{% embed https://asciinema.org/a/330532 %}
{% embed https://codepen.io/elisavetTriant/pen/KKvRRyE %}
(defun de-ansify () | |
"apply ansi color codes in currently selected region" | |
(interactive) | |
(ansi-color-apply-on-region | |
(region-beginning) | |
(region-end))) |
;; Thanks @bschmeck | |
(defun shmk/ivy--regex-dashes (str) | |
"Build a regex sequence from STR. | |
Insert .* before each -." | |
(let ((subs (split-string str "-"))) | |
(if (= (length subs) 1) | |
(ivy--regex str) | |
(ivy--regex (concat "^" (string-join subs "[[:alnum:]]*-")))))) |
# step should have NODE_VERSION and YARN_VERSION environment variables declared | |
- run: | |
name: Download NodeJS things | |
command: | | |
mkdir -p nodejs-downloads/ | |
cd nodejs-downloads/ | |
[ -f node-v${NODE_VERSION}-linux-x64.tar.xz ] || curl -O https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz | |
[ -f yarn-v${YARN_VERSION}.tar.gz ] || curl -O -L https://yarnpkg.com/downloads/${YARN_VERSION}/yarn-v${YARN_VERSION}.tar.gz |
## | |
## A stegosaur with a top hat? | |
## | |
$the_cow = <<EOC; | |
$thoughts . . | |
$thoughts / `. .' " | |
$thoughts .---. < > < > .---. | |
$thoughts | \\ \\ - ~ ~ - / / | | |
_____ ..-~ ~-..-~ | |
|CRUFT| \\~~~\\.' `./~~~/ |
class Array | |
# group elements by their identity, and count each distinct item | |
def counts | |
group_by(&:itself).map {|k,v| [k, v.count] } | |
end | |
end |