Skip to content

Instantly share code, notes, and snippets.

View HashNuke's full-sized avatar
💭
Life happened. I now have varied interests. I may be slow to respond.

Akash Manohar HashNuke

💭
Life happened. I now have varied interests. I may be slow to respond.
View GitHub Profile
@HashNuke
HashNuke / stimulus-controllers.mdc
Created June 10, 2025 06:46
cursor stimulus rules
# Stimulus.js rules for Cursor
## Always register new stimulus controllers index.js
* When adding new stimulus controllers, always register the controller in @index.js
## Adding/modifying html markup via stimulus controllers
Prefer not to add hardcoded html markup to stimulus controllers.
@HashNuke
HashNuke / cloudflare-r2-download-worker.js
Last active May 7, 2025 19:47
Cloudflare worker that downloads files from R2 bucket
import jwt from '@tsndr/cloudflare-worker-jwt'
// Add following config to wrangler.toml
//
// r2_buckets = [
// { binding = "STORAGE_BUCKET", bucket_name = "your_bucket_name" }
// ]
//
// Also requires download_jwt_secret in the worker env
@HashNuke
HashNuke / SwiftUI-SplitView-MacOS.swift
Last active January 27, 2025 16:52
Using a NSSplitViewController with SwiftUI on mac to render SwiftUI views as split panes. Drop this code into a playground to try it out. SORRY MAC-OS ONLY. DOES NOT WORK ON IOS
import AppKit
import SwiftUI
// Delete this line if not using a playground
import PlaygroundSupport
struct ContentView: View {
var body: some View {
// if spacing is not set to zero, there will be a gap after the first row
@HashNuke
HashNuke / README.md
Last active November 28, 2024 13:00
Put this in your $HOME directory. And then run it from any git repository.

howlong.sh

Usage

  1. Copy the script (scroll below) into $HOME directory on your linux or mac.
  2. Run the command below within any git repository.
bash ~/howlong.sh
@HashNuke
HashNuke / irbrc-emoji-prompts.md
Last active September 3, 2024 04:21
Emoji-powered IRB prompts to differentiate between Rails environments

Add this to the .irbrc file in the rails app directory.

rails_env = "🤗"
if ENV['RAILS_ENV'] == 'production'
  rails_env = "🥶"
elsif ENV['RAILS_ENV'] == 'staging'
  rails_env = "🧘"
end
@HashNuke
HashNuke / gist:608259
Created October 3, 2010 04:13
to undo push and commits
# to undo a git push
git push -f origin HEAD^:master
# to get to previous commit (preserves working tree)
git reset --soft HEAD
# to get back to previous commit (you'll lose working tree)
git reset --hard HEAD^
import Combine
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
var publisher = PassthroughSubject<Int, Error>()
let cancellable = publisher
.flatMap { Just($0).setFailureType(to: Error.self) }
.handleEvents(

Keybase proof

I hereby claim:

  • I am hashnuke on github.
  • I am hashnuke (https://keybase.io/hashnuke) on keybase.
  • I have a public key ASCYpt4PklMYqN6rB6wy0mf9_rBfUepaKcY3u8GYNeb1QQo

To claim this, I am signing this object:

@HashNuke
HashNuke / riak-advanced-config-start.txt
Last active December 29, 2015 21:08
Riak doesn't start when I add an etc/advanced.config. When there's none, it starts fine.
# I'm using Riak v2.0pre7 (latest tagged release from the github repo)
$ cat etc/advanced.config
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et
[
{riak_kv, [
{add_paths, ["/Users/akashmanohar/projects/rinket/_build/shared/lib/firebrick/ebin"]}
]}
]
@HashNuke
HashNuke / auto-scroll-explanation.coffee
Last active December 21, 2015 16:09
Autoscroll implementation in CoffeeScript. From my latest hobby project. If the user is reading history that's way behind, then do not scroll to the latest message. If the user is reading history that's less than 4 lines away from the latest message, then scroll to the latest message.
# My markup looks like this
#
# <div class="activities">
# <div class="activities-inner-wrapper">
# <div class="activity">something here</div>
# <div class="activity">another thing here</div>
# <div class="activity">Wowowowowwo</div>
# </div>
# </div>
#