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
@kelvinauta
kelvinauta / remove_comments.lua
Created July 2, 2025 04:07
This function removes all comments from your code using treesitter in nvim.
local RemoveComments = function()
local ts = vim.treesitter
local bufnr = vim.api.nvim_get_current_buf()
local ft = vim.bo[bufnr].filetype
local lang = ts.language.get_lang(ft) or ft
local ok, parser = pcall(ts.get_parser, bufnr, lang)
if not ok then return vim.notify("No parser for " .. ft, vim.log.levels.WARN) end
local tree = parser:parse()[1]
@luminositystudio
luminositystudio / Disable Device Enrollment Program (DEP) notification on macOS BigSur and Monterey.md
Last active July 13, 2024 21:46
Disable Device Enrollment Program (DEP) notification on macOS BigSur and Monterey

Disable Device Enrollment Program (DEP) notification on macOS BigSur and Monterey

Requirements

  1. Restart in Recovery Mode

    Restart your Mac then hold down the Command & R keys together until you're in the Recovery Mode menu

  2. Click on Utilities then select: Startup Security Utility

@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