Skip to content

Instantly share code, notes, and snippets.

View chip's full-sized avatar

Chip Castle chip

View GitHub Profile
@chip
chip / logging.rkt
Created May 24, 2023 20:56 — forked from Metaxal/logging.rkt
Simple usage of Racket's logging facility
#lang racket/base
; One way to define a logger
(define lg (make-logger 'my-logger))
; Define a receiver for this logger, along with a log level
(define rc (make-log-receiver lg 'error)) ; also try with 'debug
; Another way to define a logger, with additional forms
(define-logger lg2)
(define rc2 (make-log-receiver lg2-logger 'debug))
@chip
chip / GIF-Screencast-OSX.md
Created February 24, 2022 21:10 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@chip
chip / example.app.vue
Created April 19, 2021 20:44 — forked from vonvick/example.app.vue
App.vue example
<template>
<div id="app">
<router-view></router-view>
<div class="refresh-container" v-if="hashChanged && $root.env !== 'development'">
<div class="notification-header">
<button type="button" class="close-refresh-modal" @click="closeModal" aria-label="Close">
<span aria-hidden="true"><i class="fal fa-times fa-sm"></i></span>
</button>
</div>
<div class="notification-body">
@chip
chip / refresh-page.mixin.js
Created April 19, 2021 20:44 — forked from vonvick/refresh-page.mixin.js
Mixin to be injected into App.vue
import axios from 'axios';
export const refreshPageMixin = {
data() {
return {
currentHash: '{{POST_BUILD_ENTERS_HASH_HERE}}',
token: localStorage.getItem('user-token'),
hashChanged: false,
newHash: ''
}
@chip
chip / example.package.json
Created April 19, 2021 20:43 — forked from vonvick/example.package.json
Vue.JS auto refresh package.json example file
{
"scripts": {
"build": "node build/build.js && npm run post:build",
"post:build": "node build/post-build.js"
},
}
@chip
chip / post-build.js
Created April 19, 2021 20:43 — forked from vonvick/post-build.js
Post Build file for creating hash version
const path = require('path');
const fs = require('fs');
const util = require('util');
// get application version from package.json
const appVersion = require('../package.json').version;
// promisify core APIs
const readDir = util.promisify(fs.readdir);
const writeFile = util.promisify(fs.writeFile);
@chip
chip / install-java.sh
Created June 11, 2018 19:53
HomeBrew Revert to Java8 from Java9
#!/usr/bin/env bash
set -e
# Uninstall Java 9 off the bat, so we can fix our local installation
if brew cask ls --versions "java" &>/dev/null; then
echo "Uninstalling Java"
brew cask uninstall java
fi
# Install jenv, java8 and java9
brew install jenv
brew cask install caskroom/versions/java8
@chip
chip / multiprocess_migration.sh
Created April 4, 2018 18:46 — forked from tanema/multiprocess_migration.sh
migrate files from gridfs to aws s3
#! /bin/bash
###################### USAGE ######################################
usage() {
echo "
Usage: mongotos3 [-t n] mongo_host mongo_collection s3_bucket
-t : number of parallel processes to use
mongo_host : the host of the mongodb server
mongo_collection : the collection to collecthe gridfs data from
s3_bucket : the name of the bucket you want to cp the files to
"
@chip
chip / sets.js
Created March 21, 2018 14:47 — forked from clohr/sets.js
ES6 Sets: Intersection, Difference, and Union
const a = new Set([1, 2, 3, 4, 4, 4])
const b = new Set([3, 4, 5, 6])
const intersect = (set1, set2) => [...set1].filter(num => set2.has(num))
const differ = (set1, set2) => [...set1].filter(num => !set2.has(num))
const joinSet = (set1, set2) => [...set1, ...set2]
const myIntersectedSet = new Set(intersect(a, b))
console.log('myIntersectedSet', myIntersectedSet)
@chip
chip / rnb.erb
Created May 29, 2017 16:32 — forked from romainl/_rnb.md
RNB, a Vim colorscheme template
<%
# RNB, A VIM COLORSCHEME TEMPLATE
# Author: Romain Lafourcade (https://github.com/romainl)
# Canonical URL: https://gist.github.com/romainl/5cd2f4ec222805f49eca
# This template is designed to help vimmers create their own colorschemes
# without much effort.
#
# You will need Ruby to generate your colorscheme but Ruby knowledge is
# not needed at all.