Skip to content

Instantly share code, notes, and snippets.

@sirtimbly
sirtimbly / heroku_deploy_with_api.sh
Created March 5, 2020 15:53
Heroku Deploy a Slug from One App to Another
curl -i -n -X GET https://api.heroku.com/apps/$STAGING_APP_NAME/releases \ system
-H "Accept: application/vnd.heroku+json; version=3;" -H "Range: version ..; order=desc"
# EXTRACT THE SLUG ID OUT OF THAT JSON OBJECT
# RELEASE THAT SLUG
curl -X POST -H "Accept: application/vnd.heroku+json; version=3" -n \ system
-H "Content-Type: application/json" \
-d '{"slug": "$SLUG_ID"}' \
https://api.heroku.com/apps/$PROD_APP_NAME/releases
.src/
├── assets
│   ├── images
│   │   └── structure
│   └── multimedia
├── docs
├── patterns
│   ├── 01-objects
│   │   ├── amount
│   │   ├── button
@sirtimbly
sirtimbly / dir-structure-atomic.txt
Last active April 11, 2019 17:02
dir structure atomic
components
│   ├── atoms
│   │   ├── button
│   │   ├── card
│   │   ├── form
│   │   │   └── select
│   │   ├── icon-field
│   │   ├── icons
│   │   ├── input
│   │   ├── text
@sirtimbly
sirtimbly / settings.json
Created December 15, 2018 17:05
turn on the nm script shortcuts
{
"npm.enableScriptExplorer": true,
"npm.scriptExplorerAction": "run"
}
@sirtimbly
sirtimbly / rollup.config.js
Created December 15, 2018 04:06
rollup config for typescript with multiple configs
import typescript from 'rollup-plugin-typescript2';
import { terser } from "rollup-plugin-terser";
import { sizeSnapshot } from "rollup-plugin-size-snapshot";
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import * as globby from "globby";
const globbedConfigs = globby.sync('src/patterns/**/*.ts').map(inputFile => {
const filename = inputFile.split("/")[inputFile.split("/").length-1];
export default () => {
$(document).on("click", ".c-accordion__title", function(event) {
event.preventDefault();
// ... the rest of the old jquery code here
});
}
@sirtimbly
sirtimbly / datepicker.ts
Last active December 15, 2018 03:58
importing jquery-ui widgets in modern code
/// <reference path="../../../../node_modules/@types/jqueryui/index.d.ts" />
import "jquery-ui/ui/core";
import "jquery-ui/ui/keycode";
import "jquery-ui/ui/widgets/datepicker";
$("#my-datepicker").datepicker({
showButtonPanel: true,
changeMonth: true,
changeYear: true,
buttonImage: "/images/structure/calendar-ico.png",
import InitAccordion from "../patterns/02-components/accordion/accordion";
$(() => {
/**
* If it needs to be run when the document is first loaded, then execute it in this function. This might be a useful
* place to return promises or use async if the order or execution is important.
*/
InitAccordion();
});
import PromisePolyfill from "es6-promise";
PromisePolyfill.polyfill();
@sirtimbly
sirtimbly / tsconfig.json
Created December 15, 2018 03:45
tsconfig for a design system with legacy code
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,