- Create a gist if you haven't already.
- Clone your gist:
# make sure to replace `<hash>` with your gist's hash git clone https://gist.github.com/<hash>.git # with https git clone [email protected]:<hash>.git # or with ssh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CLI | |
sudo apt update -y | |
sudo apt install -y \ | |
git curl btop \ | |
docker.io docker-buildx \ | |
build-essential pkg-config autoconf bison rustc cargo clang \ | |
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \ | |
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \ | |
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \ | |
rbenv apache2-utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DummyController < ApplicationController | |
def do | |
render json: { balance: 50 } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: | |
# If this file is edited, it must be removed from EC2 instance prior to deploy. | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn_install.sh" : | |
mode: "000775" | |
owner: root | |
group: users | |
content: | | |
#!/usr/bin/env bash | |
set -xe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type tree = Leaf | Node(int, tree, tree); | |
let rec sum = (item) => { | |
switch (item) { | |
| Leaf => 0 | |
| Node(value, left, right) => value + sum(left) + sum(right); | |
} | |
}; | |
let rec height = (root) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iframeURLChange(iframe, callback) { | |
var lastDispatched = null; | |
var dispatchChange = function () { | |
var newHref = iframe.contentWindow.location.href; | |
if (newHref !== lastDispatched) { | |
callback(newHref); | |
lastDispatched = newHref; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
// Add these two imports | |
import Elm from 'react-elm-components'; | |
import Main from "./Main"; | |
function App() { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Extracted from: https://guide.elm-lang.org | |
-- Read more about this program in the official Elm guide: | |
-- https://guide.elm-lang.org/architecture/buttons.html | |
module Main exposing (main) | |
import Browser | |
import Html exposing (Html, button, div, text) | |
import Html.Events exposing (onClick) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/a/30638226 | |
// When printing an “Element” Chrome developer tools will request the 'id' property | |
// If the 'id' property is fetched, then the devtools is open | |
let checkStatus; | |
let customElement = document.createElement('p'); | |
document.body.appendChild(customToString); | |
let element = new Image(); | |
Object.defineProperty(element, 'id', { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidUpdate(prevProps, prevState) { | |
Object.entries(this.props).forEach(([key, val]) => | |
prevProps[key] !== val && console.log(`Prop '${key}' changed`) | |
); | |
Object.entries(this.state).forEach(([key, val]) => | |
prevState[key] !== val && console.log(`State '${key}' changed`) | |
); | |
} |
NewerOlder