Skip to content

Instantly share code, notes, and snippets.

View raine's full-sized avatar

Raine Virta raine

View GitHub Profile
{
"-W065" : false, // disable: Missing radix parameter.
"boss" : true,
"loopfunc" : true,
"-W099" : true, // allow mixed tabs and spaces
"funcscope" : true
}
" if exists("g:loaded_myplugin")
" finish
" endif
" let g:loaded_myplugin = 1
function! s:open_url(query, url)
let url = substitute(a:url, '{query}', s:encode_url(a:query), '')
let command = 'open ' . shellescape(url)
call system(command)
endfunction
var callback = function() {
if _.every(_.pluck(arr, 'resolved')) {
console.log('all resolved');
}
};
var arr = models.map(function(m) {
return m.destroy().then(callback);
});
app.Stats = Marionette.ItemView.extend({
initialize: function() {
this.stats = Stats.get();
},
render: function(obj) {
if (!obj) {
return this.stats.done(this.render.bind(this));
}
_.chain(obj)
.pairs()
.sortBy(function(a) {
return a[1];
})
.map(function(e) {
return _.object([e]);
})
.value();
@raine
raine / gist:6152576
Created August 4, 2013 23:56
Open the current url of Google Chrome in VLC
property theURL : ""
tell application "Google Chrome"
set theURL to URL of active tab of window 1
end tell
tell application "System Events"
do shell script "Open -a VLC --args " & theURL
end tell
@raine
raine / README.md
Last active December 22, 2015 02:39

Dropbox deploy script

Useful when working with static web pages.

Put this in the directory you're working in and running the script will copy the directory under ~/Dropbox/Public.

Accepts an optional argument that overrides the name of the directory when copied to Public/.

# Images
image/jpeg; open %s
image/pjpeg; open %s
image/png; open %s
image/gif; open %s
# PDF
application/pdf; open %s
# HTML
renderLinkifyComicSans: function(lines, inlineImages) {
return this.renderLinkifyWithTextFunction(lines, inlineImages, _.bind(function(text) {
return this.escapeText(text).replace(/(comic sans)/gi, '<span style="font-family:comic sans ms;">$1</span>');
}, this));
},
_.mixin({
filterWith: function(list, preds) {
return _.filter(list, function(obj) {
var call = function(a, b) { return b(a); };
return _.every(preds, _.partial(call, obj));
});
}
});
var b = {