Skip to content

Instantly share code, notes, and snippets.

View jch254's full-sized avatar
👽

Jordan Hornblow jch254

👽
View GitHub Profile
@ninest
ninest / keybindings.json
Created June 26, 2020 07:45
Sonic Pi in VSCode
// Place your key bindings in this file to override the defaults
[
// ..
// all your other keybindings
// ...
// for sonic pi
{
"key": "ctrl+alt+s",
@rupertbg
rupertbg / get-codepipeline-execution-id-within-codebuild.sh
Last active April 1, 2024 12:49
Get a CodePipeline Execution ID from within a CodeBuild Job
aws codepipeline get-pipeline-state --region us-west-2 --name ${CODEBUILD_INITIATOR#codepipeline/} --query 'stageStates[?actionStates[?latestExecution.externalExecutionId==`'${CODEBUILD_BUILD_ID}'`]].latestExecution.pipelineExecutionId' --output text
function fixhtml(html) {
var div, dom, hasBlockChild, needWrapping, textOrInlineChildren, treeWalker;
dom = document.createElement('div');
html = html.replace(/\s+/g, " ").replace(/> </g, "><"); // removes white space
while (html.match(/<(h[1-5]|p|strong|div|u|em|a|bi) ?[^>]*>\s?<\/\1>/g)) {
html = html.replace(/<(h[1-5]|p|strong|div|u|em|a|b|i) ?[^>]*>\s?<\/\1>/g, ""); //removes empty tags recursively, except iframes
}
dom.innerHTML = html;
Array.from(dom.querySelectorAll("h1 h1")).forEach(function(node) {
return node.outerHTML = node.innerHTML; //unwrap nested h1's
@interstar
interstar / trap3.rb
Last active August 3, 2021 21:32
Trap beat for sonic pi
use_bpm 145
# Our chord sequence
p1 = [chord(:E3,"minor7"),
chord(:G3,"major7"),
chord(:A3,"minor7"),
chord(:G3,"m9"),
chord(:E3,"m9"),
chord(:C3,"minor7"),
@bengotow
bengotow / deserialize.js
Created January 8, 2018 18:49
Slate HTML deserialize with nested block / inline handling
const DefaultParse = HtmlSerializer.parseHtml;
HtmlSerializer.parseHtml = html => {
const tree = DefaultParse.apply(HtmlSerializer, [html]);
const collapse = require('collapse-whitespace');
collapse(tree);
// ensure that no DIVs contain both element children and text node children. This is
// not allowed by Slate's core schema: blocks must contain inlines and text OR blocks.
// https://docs.slatejs.org/guides/data-model#documents-and-nodes
const treeWalker = document.createTreeWalker(tree, NodeFilter.SHOW_ELEMENT, {
@ibraheem4
ibraheem4 / postgres-brew.md
Last active July 5, 2024 17:29 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@sgnl
sgnl / postgres-brew.md
Last active April 21, 2024 23:18
Installing Postgres via Brew (OSX) (outdated see top most note)

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start