Skip to content

Instantly share code, notes, and snippets.

View blockloop's full-sized avatar

Brett Jones blockloop

  • Lithic (privacy.com)
View GitHub Profile
@blockloop
blockloop / gist:5600341
Created May 17, 2013 16:41
Plain text Jekyll excerpt plugin. How it works: - Reads markdown into html - Converts the html to plain text - grabs the first X characters (default 160) - adds to the post (use post.excerpt) Reasons I wrote it: - supports the ability to add your own excerpt in the front matter (does not override) - creates text-only excerpt for a footer message…
require 'maruku'
require 'nokogiri'
module Jekyll
class ExcerptBuilder < Generator
safe true
priority :high
EXCERPT_LENGTH = 160
@blockloop
blockloop / Gruntfile.js
Created May 26, 2013 03:27
hexo gruntfile generate example
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
watch: {
sourceFiles: {
files: ['themes/**','scaffolds/**','scripts/**','source/**','app.js'],
tasks: 'shell:hexoGen'
},
@blockloop
blockloop / MyCtrl.js
Last active December 18, 2015 03:38
localStorage with angularjs and node webkit
myApp.controller('MyCtrl', ['$scope','storageService',
function($scope, storageService) {
var brain = storageService.getBrain();
$scope.items = [];
$.extend($scope, brain); // load from memory
$scope.addItem = function(item) {
$scope.items.push(item);
$scope.refresh();
" Swig syntax
" Language: Swig
" Maintainer: Brett
" Last Change: Jul 6th, 2013
" Version: 0.1
" URL: https://github.com/brettof86/vim-swigjs
if version < 600
syntax clear
elseif exists("b:current_syntax")
@blockloop
blockloop / Program.cs
Last active March 10, 2020 10:56
Ruby-ish *rescue* for C#. Swallowing exceptions in C# is almost always imprudent, but sometimes it's just necessary.
public T Rescue<T>(T defValue, Func<T> fn)
{
try
{
return fn();
}
catch
{
return defValue;
}
@blockloop
blockloop / rdio-media-keys.ahk
Created October 1, 2013 21:16
Control Rdio with key combinations using autohotkey. NOTE: this works with either the Rdio desktop app or a Chrome application shortcut but I've noticed that the Chrome shortcut works better and since the Rdio desktop application is basically just a Site-specific browser I just use Chrome.
#SingleInstance force
SetTitleMatchMode 2
RControl & UP::
Send {Volume_Up}
return
RControl & DOWN::
@blockloop
blockloop / spotify-media-keys.ahk
Created October 1, 2013 21:21
Control Spotify with key combinations using autohotkey.
#SingleInstance force
SetTitleMatchMode 2
RControl & UP::
Send {Volume_Up}
return
RControl & DOWN::
Send {Volume_Down}
return
@blockloop
blockloop / media-keys-basic.ahk
Last active December 25, 2015 05:39
Send media controls via shortcuts (play/pause, skip, back, volume up/down)
#SingleInstance force
RControl & UP::
Send {Volume_Up}
return
RControl & DOWN::
Send {Volume_Down}
return
#! /bin/sh
### BEGIN INIT INFO
# Provides: calibre
# Required-Start: network
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Controls the Calibre content server
# Description: Controls the Calibre content web server
#
@blockloop
blockloop / .vimrc
Created April 1, 2014 03:06
.vimrc
" vim: se ff=unix :
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Variables
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let $DBVIMRC = '~/Dropbox/configs/dotfiles/.vimrc'
let $DBGVIMRC = '~/Dropbox/configs/dotfiles/.gvimrc'
" Auto watch vimrc and reload it if it changes
augroup myvimrc
au!