Skip to content

Instantly share code, notes, and snippets.

View jubishop's full-sized avatar
🎼
Making a podcast app.

Justin Bishop jubishop

🎼
Making a podcast app.
View GitHub Profile
function longestConsecutive(nums) {
let longestConsecutiveLength = 0,
longestKey; // FOR TESTING: This stores the key of a number in the longest sequence, used to build the list for display
const tracker = {};
const NEIGHBOR_ABOVE = "above";
const NEIGHBOR_BELOW = "below";
for (let i = 0; i < nums.length; i++) {
let currentValue = nums[i],
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);
}
### 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
@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.

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 / 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,
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)
}
}
require:
- rubocop-performance
AllCops:
EnabledByDefault: true
Exclude:
- '**/test.rb'
TargetRubyVersion: 3.0
Bundler/GemComment:
require 'sinatra'
get '/long_process' do
child_pid = Process.fork do
# hard work is done here...
sleep 10
Process.exit
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)