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://dev.to/gugaguichard/replace-clsx-classnames-or-classcat-with-your-own-little-helper-3bf | |
export function cx(...args: unknown[]) { | |
return args | |
.flat() | |
.filter((x) => typeof x === "string") | |
.join(" ") | |
.trim(); | |
} |
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
# lib/stats.rake | |
require "rails/code_statistics" | |
task stats: :more_stats | |
task :more_stats do | |
%w[Forms Policies Presenters Serializers Services].each_with_index do |type, i| | |
STATS_DIRECTORIES.insert i + 5, [type, "app/#{type.downcase}"] | |
STATS_DIRECTORIES.insert i * 2 + 13, ["#{type} tests", "test/#{type.downcase}"] |
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 "benchmark" | |
require "active_support/core_ext/string/strip" | |
n = 10_000 | |
Benchmark.bm do |bm| | |
bm.report("string") do | |
n.times do | |
"hello\nthere\nbear" | |
end |
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
# -colorspace Gray/sRGB | |
convert in.jpg -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG out.jpg |
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
# -movflags +faststart | |
# combine series of pngs into a mp4 movie | |
# frame-0001.png | |
# frame-0002.png | |
ffmpeg -framerate 0.3 -i frame-%04d.png -vf scale=752:424 -vcodec h264 -pix_fmt yuv420p -an -crf 15 -r 24 -y out.mp4 |
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
grep -C500 --group-separator=================== some/url production.log | | |
grep -v "^[Read|Write|Completed|Processing|Act|\/usr|\-]" | | |
grep -v "^[[:space:]][[:space:]]Re" | | |
more |
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
version: 2 | |
jobs: | |
build: | |
parallelism: 1 | |
working_directory: ~/yourapp | |
environment: | |
DATABASE_URL: postgis://postgres@localhost/yourapp_test | |
docker: | |
- image: circleci/ruby:2.4-node-browsers | |
env: |
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
// moved to https://github.com/teeparham/win-paperclip | |
// http://www.decisionproblem.com/paperclips/index2.html | |
function click (id) { | |
document.querySelector(id).click(); | |
} | |
function multiClick (id, n) { | |
for (i = 0; i < n; i++) { |
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
$ time { render "haml" } | |
Rendered _haml.html.haml (0.5ms) | |
----> 1.51 ms | |
$ time { render "erb" } | |
Rendered _erb.html.erb (0.4ms) | |
----> 1.78 ms | |
# using hamlit | |
# there is little difference in rendering erb & haml |
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
class X | |
def x | |
"X" | |
end | |
end | |
module Y | |
class X | |
def x | |
"Y::X" |
NewerOlder