Skip to content

Instantly share code, notes, and snippets.

View pachun's full-sized avatar

Nicholas Pachulski pachun

View GitHub Profile
@pachun
pachun / de.sidneys.jxa.toggle-macos-accessibility-keyboard.scpt
Created June 21, 2022 03:29 — forked from sidneys/de.sidneys.jxa.toggle-macos-accessibility-keyboard.scpt
JavaScript for Automation (JXA) | Toggle macOS Accessibility Keyboard
/**
* toggle-macos-accessibility-keyboard
* javascript for automation (jxa)
*
* description:
* macOS automation script to toggle the macOS Accessibility Keyboard.
* Shows and hides the keyboard depending on its current state.
*
* author: sidneys
* homepage: http://sidneys.github.io
@pachun
pachun / spec.rb
Last active September 24, 2021 16:46
plaid_client_double = instance_double(Plaid::Client)
plaid_transactions_double = instance_double(Plaid::Transactions)
ENV["PLAID_ENVIRONMENT"] = "plaid_environment"
ENV["PLAID_CLIENT_ID"] = "plaid_client_id"
ENV["PLAID_SECRET"] = "plaid_secret"
ENV["PLAID_CLIENT_NAME"] = "plaid_client_name"
allow(Plaid::Client).to receive(:new).with(
env: "plaid_environment",
@pachun
pachun / newc.rb
Last active July 20, 2021 21:16
Create new react native components quickly
#!/usr/bin/env ruby
require "fileutils"
def component_template(component_name)
<<~COMPONENT_TEMPLATE
import React from "react"
import { View } from "react-native"
import styles from "./styles"
import React from "react"
import Grid from "@material-ui/core/Grid"
import Typography from "@material-ui/core/Typography"
import Link from "@material-ui/core/Link"
const things = [
{
name: "A Knight's Tale",
type: "Movie",
},
it "returns true when passed an even number" do
 even = even?(2)
 expect(even).to be(true)
end
import * as React from "react"
import { View, StyleSheet, Animated } from "react-native"
const styles = StyleSheet.create({
imageOverlay: {
position: "absolute",
left: 0,
right: 0,
bottom: 0,
top: 0,
# node/react-native typescript require conflict:
# https://gist.github.com/rawrmaan/be47e71bd0df3f7493ead6cefd6b400c
#!/usr/bin/env bash
ed -s ./node_modules/@types/react-native/index.d.ts <<< $',s/declare global/declare namespace FuckGlobals/g\nw'
@pachun
pachun / gist:171314491201e34589980b67ad081caa
Created November 13, 2017 20:28
Copy a Heroku Postgresql DB into a local DB
$ heroku pg:backups:capture
$ heroku pg:backups:download
Then:
$ pg_restore -c -d torq_api_development latest.dump
openssl pkcs12 -in apns-dev-cert.p12 -out apns-dev-cert.pem -nodes -clcerts
@pachun
pachun / random.rb
Created September 7, 2017 21:04
Generate a random string of a given length (editable character set)
if ARGV[0].to_i == 0 || ARGV[0].to_i == nil
puts "usage: ruby random.rb [random string length (integer)]"
return -1
end
o = [('a'..'z'), ('A'..'Z'), (1...9), ('!'..'/')].map(&:to_a).flatten
string = (0...ARGV[0].to_i).map { o[rand(o.length)] }.join
puts "random: #{string}"