Skip to content

Instantly share code, notes, and snippets.

View sylbru's full-sized avatar
🎻

Sylvain Brunerie sylbru

🎻
View GitHub Profile
@sylbru
sylbru / single-elm-json-migration.md
Last active January 22, 2024 16:00
Migrating separate Elm apps into a single elm.json
  • Run elm init at the top-level (in the directory containing your separate Elm apps), creating a new elm.json
  • If using elm-watch, run elm-watch init, creating a new elm-watch.json
  • For each Elm app, open its elm.json and :
    • take the list of direct dependencies, install them all in your new elm.json
      • preferably using elm-json (although I don’t remember what doesn’t work with regular elm install)
      • don’t worry about dependencies that are already installed, it will just ignore them. It’s safer to just mechanically copy them all.
      • I guess you can encounter conflicts between dependencies of different versions. If that’s the case, you will have to decide on one version, and update code accordingly.
    • do the same for test dependencies
    • take the list of source-directories, add them to your new elm.json (usually something like my-app/src)
      • be careful to adapt the paths since you’re moving to the parent directory
@sylbru
sylbru / elm-detector-bookmarklet.js
Last active November 15, 2022 19:07
Elm detector (bookmarklet)
javascript:(async function(){let elmDetected;if(typeof window.Elm==="object"){elmDetected=true}else{let scriptTags=document.scripts;let scriptIsElm=script=>script.match(/throw (new )?Error\([\'\"]https:\/\/github\.com\/elm\/core\/blob\/1\.0\.0\/hints\//);for(scriptTag of scriptTags){let scriptContents;if(!scriptTag.src){scriptContents=scriptTag.textContent}else{await fetch(scriptTag.src).then(response=>response.text()).then(text=>scriptContents=text).catch(err=>{console.error(err); scriptContents=null;})}if(scriptContents===null){continue;}if(scriptIsElm(scriptContents)){elmDetected=true;break}}}if(elmDetected){alert("%F0%9F%8C%B3 Yep, seems to be an Elm app! \\o/ %F0%9F%8C%B3")}else{alert("Nope, doesn%E2%80%99t seem to be Elm (but I might be wrong).")}})();
@sylbru
sylbru / Git push deployment in 7 easy steps.md
Created June 8, 2018 14:27 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook