Skip to content

Instantly share code, notes, and snippets.

View obrien-k's full-sized avatar
👩‍🚀

Kyle OBrien obrien-k

👩‍🚀
View GitHub Profile
@obrien-k
obrien-k / .zshrc
Last active June 16, 2024 15:02
~/.zshrc 0.0.1
# Fetch local machine data
neofetch
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
### Keybase proof
I hereby claim:
* I am obrien-k on github.
* I am 0kyleobrien (https://keybase.io/0kyleobrien) on keybase.
* I have a public key ASChwAer8YATMvh_A3MsgWF_Cl-xu4J9lZ27d2pO0lNvkQo
To claim this, I am signing this object:
@obrien-k
obrien-k / How to connect a PS3 controller.md
Created October 10, 2020 00:09 — forked from hlung/How to connect PS3 controller to a Mac or PC.md
How to connect PS3 controller on Mac OSX, PC

How to connect PS3 controller on Mac OSX, PC, etc.

This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness, get up of your chair, and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It DOES NOT! From my testings, the controller keeps paring with the last machine it was CONNECTED VIA A USB CABLE.

Here are the steps:

@obrien-k
obrien-k / server.js
Created October 5, 2020 01:09 — forked from zprima/server.js
medium_p1_c4
// Routes
app.get("/api/login", (req, res) => {
// generate a constant token, no need to be fancy here
const token = jwt.sign({ "username": "Mike" }, jwtSecret, { expiresIn: 60 }) // 1 min token
// return it back
res.json({ "token": token })
});
app.get("/api/token/ping", (req, res) => {
// Middleware will already catch if token is invalid
@obrien-k
obrien-k / iterm2.md
Last active May 26, 2020 01:02 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
/*
Utility functions for rendering
*/
// Based on the browser locale, provide a localized price
function formatLocalizedPrice (price) {
return new Intl.NumberFormat(navigator.language, {style: 'currency', currency: price.currencyCode}).format(price.value);
}
// Create a srcset string for responsive images
{{~inject 'template' template}}
{{inject 'token' settings.storefront_api.token}}
<!-- Declare an empty Array as arr
Then iterate over the custom fields for the intended name ('foo' here)
Inject into the current context -->
<script>
let jsContext = JSON.parse({{jsContext}});
let arr = [];
{{#forEach product.custom_fields}}
{{#if name '===' 'foo'}}
function addMultiToCart(productIds, cartId){
/* Sets the URL to an existing cart id + /items, if not use the cart endpoint to create a new cart */
let url = cartId ?
`/api/storefront/carts/${cartId}/items`:
`/api/storefront/cart`
/* Set a data variable to our lineItems object with the product ids mapped with a quantity of 1 */
let data = {
lineItems: productIds.map(id => ({
quantity: 1,
productId: id
<!-- This will cause the button to only appear for each is_bundle field -->
{{#if product.custom_fields}}
{{#each product.custom_fields}}
{{#if this.name "is_bundle"}}
<div>
<input id="multiButton" data-wait-message="{{lang 'products.adding_to_cart'}}" class="button button--primary" type="submit"
value="Combo to Cart">
</div>
{{else}}
{{/if}}
{{~inject 'template' template}}
{{inject 'token' settings.storefront_api.token}}
<!-- Declare an empty Array as arr
Then iterate over the custom fields for the intended name ('foo' here)
Inject into the current context -->
<script>
let jsContext = JSON.parse({{jsContext}});
let arr = [];
{{#forEach product.custom_fields}}
{{#if name '===' 'foo'}}