Skip to content

Instantly share code, notes, and snippets.

View jubishop's full-sized avatar
💭
Vibing

Justin Bishop jubishop

💭
Vibing
View GitHub Profile
#!/usr/bin/env ruby
require 'set'
def parse(filename)
if filename.start_with?('clip')
return filename.match(/^clip-(\d+)-(\d+)-(\d+)\s+(\d+);(\d+);(\d+)/).captures
else
return filename.match(/^(\d+)-(\d+)-(\d+)\s+(\d+)\.(\d+)\.(\d+)/).captures
end
#!/usr/bin/env ruby
require 'set'
files = Dir.glob('**/*.ARW') + Dir.glob('**/*.RAF')
files.each { |old_file|
new_file = "#{File.join(File.dirname(old_file), File.basename(old_file, File.extname(old_file)))}.heic"
if File.exist?(new_file)
puts "Deleting #{old_file}"
File.delete(old_file)
require 'sinatra'
get '/long_process' do
child_pid = Process.fork do
# hard work is done here...
sleep 10
Process.exit
end
require:
- rubocop-performance
AllCops:
EnabledByDefault: true
Exclude:
- '**/test.rb'
TargetRubyVersion: 3.0
Bundler/GemComment:
import SwiftUI
func EnumList<T: Identifiable, V: View>(_ ary: Array<T>,
block:@escaping (Int, T) -> V) ->
List<Never, ForEach<Array<(offset: Int, element: T)>, T.ID, HStack<V>>> {
return List(Array(ary.enumerated()), id: \.element.id) { idx, item in
block(idx, item)
}
}
@jubishop
jubishop / Erb.rb
Created September 2, 2020 02:06
Erb on Jekyll
require 'erb'
require 'recursive-open-struct'
module EmbeddedRuby
def render_liquid(content, payload, info, path = nil)
liquid = super(content, payload, info, path)
site = RecursiveOpenStruct.new(payload.site.to_h,
recurse_over_arrays: true)
page = RecursiveOpenStruct.new(payload.page,
require 'down'
src = File.open("about-me.html", "r") { |file| file.read }
count = 0
src.gsub!(/(src|data-flickity-lazyload)="(\S+)"/) { |match|
extension = if ($2.include? 'jpg' or $2.include? 'jpeg')
"jpg"
elsif ($2.include? 'png')
"png"
@jubishop
jubishop / css-grid-periodic-table.markdown
Created July 10, 2020 23:24
CSS Grid: Periodic Table

CSS Grid: Periodic Table

My very first CSS Grid Experiment!

So I can't actually group them together in a cluster like an actual periodic table or it wouldn't make sense or would look too forced 😔

One of my fondest memories of 2018 is when I found the resolve to deactivate Facebook, only to have my team lead tell me I'm in charge of Facebook ads a week later. No escape from Zuckerberg!

A Pen by Olivia Ng on CodePen.

### Added by Zplugin's installer
source ~/.zplugin/bin/zplugin.zsh
autoload -Uz _zplugin
(( ${+_comps} )) && _comps[zplugin]=_zplugin
### End of Zplugin installer's chunk
##### BEGIN Zplugin stuff #####
### needs: exa, fzy, lua, python3
# autosuggestions, trigger precmd hook upon load
const tracker = {};
const NEIGHBOR_ABOVE = "above";
const NEIGHBOR_BELOW = "below";
function updateConnected(current, value, direction) {
const neighbor = getNeighbor(current, direction);
if (neighbor !== false) {
tracker[neighbor] = value;
updateConnected(neighbor, value, direction);
}