Skip to content

Instantly share code, notes, and snippets.

View clamstew's full-sized avatar
🤷

Clay Stewart clamstew

🤷
View GitHub Profile
@kahole
kahole / index.html
Last active April 26, 2024 06:04
*scratch*.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>*scratch*</title>
<style>
body {
font-family: Hack, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
white-space: pre;
import {
Component,
OnInit,
Input,
HostBinding,
AfterContentInit,
SimpleChanges
} from "@angular/core";
import { css } from "emotion";
import { BehaviorSubject } from "rxjs/internal/BehaviorSubject";
@antmdvs
antmdvs / ReactHooks.code-snippets
Last active November 7, 2018 17:51
Snippets for React's *EXPERIMENTAL* `useState()` hook -- See https://reactjs.org/hooks
{
"useState()": {
"prefix": "us",
"scope": "javascript,javascriptreact,typescript,typescriptreact",
"body": [
"const [${1}, set${1/(.*)/${1:/capitalize}/}] = useState($2);",
"$0"
],
"description": "React: useState()"
},
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
// per https://docs.npmjs.com/misc/scripts, npm exposes a bunch of variables to
// the environment prefixed with npm_config_*, npm_package_* and npm_lifecycle_*.
// Here's a list of all variables exposed in my setup.
npm_config_access=
npm_config_allow_same_version=
npm_config_also=
npm_config_always_auth=
npm_config_argv='{"remain":[],"cooked":["run","foo"],"original":["run","foo"]}'
npm_config_auth_type=legacy
@clamstew
clamstew / npm-check-updates.sh
Created October 21, 2017 23:01
A bash script to be able to run `yarn display-npm-updates` and safely run ncu (npm-check-updates) with a warning message if the user / dev does not have it installed
#!/bin/bash
echo 'checking for package.json updates using npmjs.com/package/npm-check-updates' >&2
# define some fun output colors - https://stackoverflow.com/questions/5947742
RED='\033[0;31m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
@addyosmani
addyosmani / workbox.md
Last active January 20, 2024 16:14
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()
@jimpick
jimpick / Dockerfile
Created June 24, 2017 02:54
Hosting dathttpd on now.sh - https://dat.jimpick.com/
FROM ubuntu:16.04
RUN apt-get update --yes && apt-get upgrade --yes
RUN apt-get update --yes && apt-get upgrade --yes
RUN apt-get -y install curl
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN apt-get -y install ffmpeg zlib1g-dev automake autoconf git \
var nextLink;
function open_page(url) {
console.log("Opening " + url);
osmosis.get(url)
.find('#nav td:last a')
.set({
'nextLink': '@href'
})
.find('.g')
.set({
@clamstew
clamstew / delete_all_merged_branches_on_git_repo.sh
Created February 28, 2017 20:05
deletes all merged branches on git repo
git branch --remote --merged |
grep origin |
grep -v '>' |
grep -v master |
grep -v develop |
# grep -v <any-other-branch-name-you-want-to-keep> |
xargs -L1 |
cut -d"/" -f2- |
xargs git push origin --delete