Skip to content

Instantly share code, notes, and snippets.

View raine's full-sized avatar

Raine Virta raine

View GitHub Profile
@raine
raine / ws.sh
Last active December 17, 2015 01:19
Remove whitespace from git diffs
#!/bin/sh
# set -x verbose #echo on
# Find files with trailing whitespace
for file in `git diff --check --cached | grep '^[^+-]' | grep -o '^.*[0-9]\+:'` ; do
file_name=`echo ${file} | grep -o '^[^:]\+'`
line_number=`echo ${file} | grep -oP '(?<=:)[0-9]+(?=:)'`
sed -i '' "${line_number}s/[[:space:]]*$//" ${file_name}
git add ${file_name}
done
$ cat Makefile
.PHONY: all clean
all: check-env
echo $(ENV)
clean:
echo "clean"
check-env:
@raine
raine / html.vim
Created May 21, 2013 15:09
Make vim play nice with HTML templates inside script tags ~/.vim/after/syntax/html.vim
unlet b:current_syntax
syn include @HTML $VIMRUNTIME/syntax/html.vim
syn region htmlTemplate start=+<script [^>]*type *=[^>]*text/template[^>]*>+
\ end=+</script>+me=s-1 keepend
\ contains=@HTML,htmlScriptTag,@htmlPreproc
@raine
raine / gist:5628124
Last active December 17, 2015 14:59
app.SettingsView = Marionette.ItemView.extend({
// ...
initialize: function() {
this.whitelist = new app.TopicsWhitelist();
},
ui: {
'topics': '#topics .checkboxes'
},
render: function() {
this.$el.append(this.topicViews.map(function(view) {
return view.render().el;
}));
return this;
}
render: function() {
this.$el.append(
@raine
raine / .gitconfig
Last active December 17, 2015 16:09
A git alias for fixing (or "amending") an earlier commit in the history.
; 1. Stage the changes you want to have amended to the earlier commit
; 2. `$ git fix <revision>` (e.g. `git fix HEAD~4`or `git fix bbfba98`)
[alias]
fix = "!_() { c=$(git rev-parse $1) && git commit --fixup $c && if grep -qv \"No local changes\" <<<$(git stash); then s=1; fi; git -c core.editor=cat rebase -i --autosquash $c~; if [[ -n "$s" ]]; then git stash pop; fi; }; _"
this.listenTo(app.settings, 'change', this.refresh.bind(this, 'cache'));
refresh: function(arg) {
var type;
if (arg === 'cache') {
// HACK: 'change' fires twice on settings when resetting,
// once from resetting to defaults and again from setting the
// topics. This makes sure that refresh is called only once
// when resetting.
if (app.settings.get('topics') === undefined) {
diff --git a/main.js b/main.js
index 93ed992..2f46a9b 100644
--- a/main.js
+++ b/main.js
@@ -233,7 +233,12 @@ var refreshButton = function(opts) {
}
var getWilting = function(obj) {
- return (obj && (obj.wiltingReduced || obj.wilting)) || 0;
+ if (obj === undefined) { return 0; }
set -g base-index 1
setw -g mode-keys vi
set -g default-terminal "screen-256color"
# act like GNU screen
unbind C-b
set-option -g prefix C-f
setw -g aggressive-resize on
set-option -g renumber-windows on
# split windows like vim
utils = require '../utils'
uglifyFiles =
'options/js/options.min.js' : ['dist/options.concat.js']
'lib/common.min.js' : ['dist/common.concat.js']
'lib/main.min.js' : ['dist/main.concat.js']
uglifyFiles = utils.prependPath uglifyFiles, "build/"
module.exports