Some notes on AI Agent Rule / Instruction / Context files / etc.
This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.
| Description | Syntax |
|---|---|
| Get the length of a string | ${#VARNAME} |
| Get a single character | ${VARNAME[index]} |
| secret = 'cicada' | |
| key = 'wombat' | |
| cipher = OpenSSL::Cipher::AES256.new :CBC | |
| cipher.encrypt | |
| salt = OpenSSL::Random.random_bytes 16 | |
| cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1 key, salt, 20000, 32 | |
| iv = cipher.random_iv |
A curated list of arrrrrrrrr!
This document is written to help JavaScript developers to understand JavaScript's weird parts deeply and to prepare for interviews, the following resources was really helpful to write this document:
| <# | |
| Note: Eliminate `-WhatIf` parameter to get action be actually done | |
| Note: PS with version prior to 4.0 can't delete non-empty folders | |
| #> | |
| Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force -WhatIf |
| sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder |
Zach Caceres
Javascript does not have the typical 'private' and 'public' specifiers of more traditional object oriented languages like C# or Java. However, you can achieve the same effect through the clever application of Javascript's function-level scoping. The Revealing Module pattern is a design pattern for Javascript applications that elegantly solves this problem.
The central principle of the Revealing Module pattern is that all functionality and variables should be hidden unless deliberately exposed.
Let's imagine we have a music application where a musicPlayer.js file handles much of our user's experience. We need to access some methods, but shouldn't be able to mess with other methods or variables.
| #!/bin/bash | |
| iatest=$(expr index "$-" i) | |
| ####################################################### | |
| # SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me | |
| ####################################################### | |
| # Source global definitions | |
| if [ -f /etc/bashrc ]; then | |
| . /etc/bashrc |
npm shrinkwrap is useful, but maddening (once it's in place and you want to update a package).
Say you've got a package.json with module ember-cli as a devDependency currently at version 1.13.1. And you have an npm-shrinkwrap.json file too, generated with the --dev flag.
If you change the version of ember-cli to, say, 1.13.8 in package.json and run npm install, nothing will happen.
If you do that and manually change references in the shrinkwrap file, you will still have trouble (as nested dependencies may now be incorrect).