Skip to content

Instantly share code, notes, and snippets.

View devth's full-sized avatar
Hacking on @yetibot

Trevor Hartman devth

Hacking on @yetibot
View GitHub Profile
@jthegedus
jthegedus / next-aso-ssg-export.js
Last active April 20, 2022 18:57
Next.js static asset hoisting for Firebase Hosting CDN
var shell = require("shelljs");
var nextjsConfig = require("../next.config");
var distDir = nextjsConfig.distDir || ".next";
var BUILD_ID = shell.cat(`${distDir}/BUILD_ID`);
function hoistPages(fileExt, outputPath) {
console.log(
`${distDir}/server/static/${BUILD_ID}/pages/**/*${fileExt} -> ${outputPath}/`
);
shell.mkdir("-p", outputPath);
@legendpeng
legendpeng / sample-response-has-import-charge.json
Created October 24, 2017 21:33
sample-response-has-import-charge.json
{
"checkoutSessionId": "728974898",
"lineItems": [
{
"itemId": "252715456954",
"title": "Late 2015 Retina 5K iMac 27\" 3.3GHz i5/8GB/2TB Fusion/R9 M395/MK482LL/A Warranty",
"summary": {
"shippingCost": {
"value": 109.02,
"currency": "USD"
@frenchy64
frenchy64 / bash_profile.sh
Created July 19, 2017 13:55
Update clojure spec alpha
update_spec_alpha () {
git grep -l clojure.spec | xargs sed -i '' 's/clojure.spec /clojure.spec.alpha /g'
git grep -l clojure.spec | xargs sed -i '' 's/clojure.spec.test /clojure.spec.test.alpha /g'
git grep -l clojure.spec | xargs sed -i '' 's/clojure.spec.gen /clojure.spec.gen.alpha /g'
}
@travisbrown
travisbrown / queens.scala
Last active October 4, 2017 07:38
Aphyr's n-queens solution from Typing the technical interview, but Scala
class Nil
class Cons[X, Xs]
class First[List] { type X }
object First {
type Aux[List, X0] = First[List] { type X = X0 }
implicit val nilFirst: Aux[Nil, Nil] = ???
implicit def consFirst[X0, Xs]: Aux[Cons[X0, Xs], X0] = ???
}
@hpstuff
hpstuff / TransformUtil.js
Created March 14, 2017 16:32
ReactNativeTransformHelper
import MatrixMath from 'react-native/Libraries/Utilities/MatrixMath';
class TransformUtil {
constructor(matrix) {
this.matrix = matrix || MatrixMath.createIdentityMatrix();
}
perpective(x) {
MatrixMath.reusePerspectiveCommand(this.matrix, x)
@knowbody
knowbody / RNfontWeights.js
Created July 14, 2016 13:42
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black
@jeroenvandijk
jeroenvandijk / user.clj
Created June 15, 2016 08:56
Repl commands for Onyx development
(ns user
(:require [clojure.tools.namespace.repl :refer [refresh]]
[com.stuartsierra.component :as component]
[onyx api
[test-helper :refer [load-config validate-enough-peers!]]]
;; Implicit requires for env
[onyx.plugin.seq]
))
@swannodette
swannodette / spec.cljs
Last active March 5, 2018 23:24
om.next query spec
(ns om.next.spec
(:require [cljs.spec :as s]))
(s/def ::ident (s/and vector? (s/cat :ident keyword? :value #(not (coll? %)))))
(s/def ::join-key (s/or :prop keyword? :ident ::ident))
(s/def ::join (s/and (s/map-of ::join-key ::query) #(= (count %) 1)))
(s/def ::union (s/and (s/map-of keyword? ::query) #(> (count %) 1)))
(s/def ::param-expr
(s/cat :query-expr ::query-expr
@cvan
cvan / HOWTO.md
Last active May 7, 2024 15:23
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you

Source range lb:

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/load-balancer-source-ranges: "10.0.0.0/8"
  name: netexec
  labels:
 app: netexec