Skip to content

Instantly share code, notes, and snippets.

View skunkworker's full-sized avatar

John Bolliger skunkworker

View GitHub Profile
@skunkworker
skunkworker / ActionViewController.swift
Created October 10, 2020 05:34
Use SwiftUI in Action Extension
import UIKit
import MobileCoreServices
import SwiftUI
class ActionViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Get the item[s] we're handling from the extension context.
@skunkworker
skunkworker / bump_rails_migration_timestamp.zsh
Last active April 30, 2020 18:33
Bump rails migration timestamp
alias bump_migration='rename -i -v "s/(\d{14})/$(date +'%Y%m%d%H%M%S')/" $1'
@skunkworker
skunkworker / signup.html
Created January 28, 2020 06:35
How to override sign in with google button using css selectors and psuedo elements.
<div class="g-signin2 signup-button" data-onsuccess="onSignIn" data-theme="dark" data-longtitle="true" data-width="250" data-height="50">
</div>
@skunkworker
skunkworker / component.js
Created January 1, 2020 09:46
How to use hypernova-vue with rails
console.log("hello vue")
const Vue = require("vue")
// const renderVue = require("hypernova-vue").renderVue // this throws an error.
const renderVue = require("hypernova-vue/server").renderVue
const MyComponentX = Vue.extend({
template: '<h1>hello world</h1>'
})
@skunkworker
skunkworker / route_matcher.ts
Created August 10, 2019 03:56
basic typescript route matcher
export interface StringTMap<T> { [key: string]: T; };
export interface NumberTMap<T> { [key: number]: T; };
export interface StringAnyMap extends StringTMap<any> {};
export interface NumberAnyMap extends NumberTMap<any> {};
export interface StringStringMap extends StringTMap<string> {};
export interface NumberStringMap extends NumberTMap<string> {};
export interface StringNumberMap extends StringTMap<number> {};
@skunkworker
skunkworker / directives.ts
Last active June 22, 2019 05:46
Vuejs directive, have floating window (eg custom dropdown) always be visible on the page.
import Vue from 'vue'
let handleWindowResize
export function moveFromWindowLeft(el, binding) {
const showElement = binding.value
if (!showElement) {
@skunkworker
skunkworker / vue-closable-directives.ts
Created June 19, 2019 23:15
Vue-closable directive (with fixes)
// imported from
// https://medium.com/@Taha_Shashtari/an-easy-way-to-detect-clicks-outside-an-element-in-vue-1b51d43ff634
import Vue from 'vue'
// This variable will hold the reference to
// document's click handler
let handleOutsideClick
Vue.directive('closable', {
bind (el, binding, vnode) {
@skunkworker
skunkworker / ChaffinMethod.go
Last active March 29, 2019 06:20
Transpiled ChaffinMethod to Go
/*
Package main - transpiled by c2go version: v0.25.9 Dubnium 2018-12-30
If you have found any issues, please raise an issue at:
https://github.com/elliotchance/c2go/
*/
// Warning (FieldDecl): /usr/include/_stdio.h:137 : Cannot resolve type 'int ( * _Nullable)(void *)' : Cannot separate function 'int ( * _Nullable)(void *)' : Cannot resolve type 'int ( * _Nullable)' : Cannot separate function 'int ( * _Nullable)' : Cannot resolve type '* _Nullable' : I couldn't find an appropriate Go type for the C type '* _Nullable'.
// Warning (FieldDecl): /usr/include/_stdio.h:138 : Cannot resolve type 'int ( * _Nullable)(void *, char *, int)' : Cannot separate function 'int ( * _Nullable)(void *, char *, int)' : Cannot resolve type 'int ( * _Nullable)' : Cannot separate function 'int ( * _Nullable)' : Cannot resolve type '* _Nullable' : I couldn't find an appropriate Go type for the C type '* _Nullable'.
// Warning (FieldDecl): /usr/include/_stdio.h:139 : Cannot resolve type 'fpos_t ( * _Nullable)(void *, fpos_t,
@skunkworker
skunkworker / set_solver.rb
Last active January 6, 2019 06:35
New York Times SET puzzle solver
# Brute force NYT set Solver.
# from https://www.nytimes.com/puzzles/set - Accessed Jan 6
require 'set'
class Item
include Comparable
attr_accessor :color, :shape, :pattern, :item_count
@skunkworker
skunkworker / fast-font.css
Created December 30, 2018 05:38
Fast font to look consistent everywhere.
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";