Skip to content

Instantly share code, notes, and snippets.

View jrolfs's full-sized avatar

Jamie Rolfs jrolfs

View GitHub Profile
@addyosmani
addyosmani / notes.md
Created August 29, 2012 17:44
Better Model Property Validation On Set/Save

(rough-cut for Backbone Fundamentals)

Better Model Property Validation On Set/Save

As we learned earlier in the book, the validate method on a Model is called before set and save, and is passed the model attributes updated with the values from these methods.

By default, where we define a custom validate method, Backbone passes all of a Model's attributes through this validation each time, regardless of which model attributes are being set.

This means that it can be a challenge to determine which specific fields are being set or validated without being concerned about the others that aren't being set at the same time.

@torgeir
torgeir / build.boot
Last active May 12, 2017 15:16
Figwheel boot clj setup, live reloading cljs and css
(set-env! :dependencies '[
[org.clojure/clojure "1.8.0" :scope "provided"]
[org.clojure/clojurescript "1.9.89" :scope "provided"]
[ajchemist/boot-figwheel "0.5.4-5"] ;; latest release
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[figwheel-sidecar "0.5.4-5" :scope "test"]
[pandeiro/boot-http "0.7.2" :scope "test"]])
@tamakiii
tamakiii / .zshrc
Last active August 19, 2018 13:23
Fix "(eval):setopt:3: no such option: NO_warnnestedvar" with Zsh
We couldn’t find that file to show.
@svenk
svenk / ViewSourceWith.ps1
Created November 17, 2017 11:59
A Firefox Quantum ViewSourceWith extension workaround with Firefox's source.editor.external
# A Firefox Quantum ViewSourceWith replacement for Windows
#
# Usage:
# (1) Save as C:\path\to\script.ps1
# (2) In order to run your own powershell scripts, start PowerShell
# as Administrator and run the command
#
# Set-ExecutionPolicy RemoteSigned
#
# (2) You can test the proper running (from a user cmd):
@tbranyen
tbranyen / app.js
Created September 22, 2011 16:51
backbone.js sub routing
/* Pretend app setup stuff is here */
/* Kick off app */
jQuery(function($) {
var Gallery = app.module("gallery");
app.Router = Backbone.Router.extend({
initialize: function() {
this.gallery = new Gallery.Router("gallery/");
import { useEffect, useLayoutEffect } from 'react';
// eslint-disable-next-line max-len
// See https://github.com/reduxjs/react-redux/blob/316467a/src/hooks/useSelector.js#L6-L15
export const useIsomorphicLayoutEffect =
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
export const useServerNoopLayoutEffect =
typeof window !== 'undefined' ? useLayoutEffect : () => ({});
@jrolfs
jrolfs / Makefile
Last active August 27, 2021 18:30
Machine bootstrap
home := $${HOME}
shell := /bin/bash
nix := /nix/var/nix
nix_darwin := /run
brew := /opt/homebrew
key := id_ed25519
public_key := .ssh/$(key).pub
github_key := .ssh/github.txt
@fats
fats / weechat_theme.txt
Last active October 27, 2023 18:22
[weechat] The Theme™
# requires: 256 color terminal
/script install iset.pl
/script install buffers.pl
/script install colorize_nicks.py
/set weechat.look.buffer_notify_default message
/set weechat.look.color_nick_offline on
/set weechat.look.prefix_action " •"
/set weechat.look.prefix_join "▬▶"
@andsens
andsens / bootstrap_homeshick.sh
Last active December 27, 2023 12:47
Script that can set up an entire user account with homeshick automatically
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
@andyfowler
andyfowler / .vimrc
Created September 5, 2011 18:08
Swap iTerm2 cursors in vim insert mode when using tmux
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif