Skip to content

Instantly share code, notes, and snippets.

View sc0ttman's full-sized avatar
🏠
Working from home

Scott sc0ttman

🏠
Working from home
  • Calgary
View GitHub Profile
@sc0ttman
sc0ttman / thoughts.md
Last active October 10, 2024 16:47
Mixin POC. Bind form data to a stimulus-accessable object and then allow expressions to be run on data attributes using that data

It would be nice if there was a way to keep a javascript object in a stimulus controller in sync with all the form elements.

It would work both ways. If you updated this.user.email in stimulus controller, the form value would automatically change.

The real power would come from being able to define functionality within the HTML without the need of explicitly defining callbacks and show/hide functionality manually in the stimulus controller. Just a set of tags that allow you to run expressions against the form data and have that functionality added for you.

This would be great for simple validations and show/hide/disable/css functionality leaving you room in the Stimulus controller for more advanced features.

See data-stimulus-hidden, data-stimulus-enabled and data-stimulus-class

@sc0ttman
sc0ttman / vanilla-js-cheatsheet.md
Created June 19, 2024 14:34 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
namespace :haml do
desc "Convert HAML templates to ERB"
task :convert_to_erb do
# Assumes you have faraday in your Gemfile
conn = Faraday.new(url: "https://haml2erb.org") do |f|
f.request :json
f.response :json
end
haml_filenames = Dir["app/views/**/*.haml"]
@sc0ttman
sc0ttman / tmux-cheatsheet.markdown
Created January 5, 2018 20:20 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@sc0ttman
sc0ttman / slack_delete.rb
Created February 10, 2016 19:47 — forked from jamescmartinez/slack_delete.rb
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@sc0ttman
sc0ttman / readme
Created June 4, 2013 22:28
Paste without formatting
Open 'System Preferences'
Select 'Keyboard'
Select tab 'Keyboard Shortcuts'
Select 'Application Shortcuts' from the left listbox
Click '+' below right listbox
Select 'All Applications' for 'Application' input box
Type 'Paste and Match Style' into the 'Menu Title' input box
@sc0ttman
sc0ttman / iphone.sh
Last active December 17, 2015 11:09
Copy iphone simulator to apps
sudo ln -sf /Applications/Xcode.app/Contents/Applications/iOS\ Simulator.app /Applications/iOS\ Simulator.app
# As of iOS 7 the location is:
/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app