Skip to content

Instantly share code, notes, and snippets.

@smucode
smucode / remix_route_v2_mirgrate.js
Created July 9, 2023 09:46
Migrate from remix.run v1 to v2 route convention. Just needed to fix up imports, npm run build, and rename the root index.tsx to _index.tsx
const fs = require("fs");
const rootPath = "./app/routes";
function migrate(path) {
fs.readdirSync(path).forEach((file) => {
const filePath = `${path}/${file}`;
const stat = fs.statSync(filePath);
if (stat.isDirectory()) {
migrate(filePath);
@smucode
smucode / start-dev-server.js
Created January 23, 2019 11:18
Script that watches the console for elm crashes, and will delete elm-stuff and trigger a recompile by touching Main.elm
const pathToElmStuff = './packages/elm/elm-stuff'
const pathToMain = './packages/elm/src/elm/Main.elm'
const npmCmdToStartDevServer = 'start:frontend'
const { spawn, execSync } = require('child_process')
const proc = spawn('npm', ['run', npmCmdToStartDevServer])
const log = msg => {
const boom = Array.apply(null, { length: 5 })
.map(() => '💥')
.join('')

tl;dr

Types RTS Opts Compile time Artifacts size
Yes -A512M -H128M -n8m 3m7s 91M
Yes -s 6m14s 93M
No -A512M -H128M -n8m 1m22s 13M

For the last one I removed all type declarations apart from our main function. I also had to remove a few files as I kept running into an issue with the type inference algorithm of elm-make: Unable to generalize a type variable, it is unranked.

const { Pact, Matchers } = require('@pact-foundation/pact')
const path = require('path')
const R = require('ramda')
const { eachLike, term, somethingLike: like } = Matchers
const providerPort = 1234
//eslint-disable-next-line fp/no-mutation
module.exports.encodeQuery = R.pipe(JSON.stringify, encodeURIComponent)
@smucode
smucode / gist:96d4a93297a91c5efcbb
Created January 3, 2016 21:37
Testing testing 1-2-3
hello world
@smucode
smucode / gist:6516230
Last active December 22, 2015 18:59
~/.config/fish/functions/fish_prompt.fish
function fish_prompt
if [ $status = 0 ]
set st (set_color -o 27AE60)
else
set st (set_color -o red)
end
#if not set -q -g __fish_smu_functions_defined
# set -g __fish_smu_functions_defined
@smucode
smucode / html_parser.rb
Created February 9, 2012 12:55 — forked from jimweirich/html_parser.rb
Vital Ruby Advance Lab 2
require("nokogiri")
require("./url_fetcher")
class HtmlParser
def parse url
html = UrlFetcher.new.fetch url
Nokogiri::HTML(html).css('a').map{|e| parse_url(url, get_href(e)) }.compact
end
def get_href e
@smucode
smucode / proxy.rb
Created February 8, 2012 08:46 — forked from jimweirich/read_only_proxy.rb
Vital Ruby Lab 5
class Presentation
attr_accessor :title, :presenter
def initialize title, presenter
@title = title
@presenter = presenter
end
end
@smucode
smucode / presentation.rb
Created February 7, 2012 13:54 — forked from jimweirich/presentation.rb
Vital Ruby Lab 4
class Presentation
attr_accessor :title, :author, :scores
def initialize title, author
@title = title
@author = author
@scores = []
end
@smucode
smucode / x.rb
Created February 7, 2012 11:55 — forked from jimweirich/x.rb
Vital Ruby my_each
class Array
def xeach
i = 0
while i < self.size
yield self[i]
i += 1
end
end