Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jnbt on github.
  • I am jnbt (https://keybase.io/jnbt) on keybase.
  • I have a public key whose fingerprint is BCCE F4A6 1E3A D605 63B0 3FF7 762C C75F 88DB 7BEC

To claim this, I am signing this object:

#!/bin/sh
set -e
MATTERMOST_API="FILL-IN-MATTERMOST-ENDPOINT"
MATTERMOST_TOKEN="FILL-IN-INTEGRATION-TOKEN"
MATTERMOST_USERNAME="AN-USERNAME"
MATTERMOST_ICON="AN-URL-TO-AN-IMAGE"
die() {
def create(conn, %{"posting" => posting_params}) do
posting_params = posting_params
|> extract_valid_params
|> to_create_params(conn)
changeset = Posting.changeset(%Posting{}, posting_params)
if changeset.valid? do
posting = Repo.insert!(changeset)
posting |> Publisher.after_create
@jnbt
jnbt / batman.filters.niceTruncate.js
Created February 16, 2015 10:16
Nicer truncation for Batman.js using jquery.truncate
// Truncates (HTML) content
// Requirements: jquery.truncate (https://github.com/pathable/truncate/blob/master/jquery.truncate.js)
// Usage:
// <p data-bind="message.content | truncateHTML 200 | raw"></p>
Batman.mixin(Batman.Filters, {
niceTruncate: function(content, length, stripTags, words, noBreak, ellipsis){
if(typeof(content) === "undefined" || content === null)
return undefined;
if(length == null) length = Infinity;
@jnbt
jnbt / batman.filters.emojify.js
Last active August 29, 2015 14:15
Renders emojis from the emoji-cheat-sheet.com
// Renders emojis from the emoji-cheat-sheet.com
// Requirements: emojify.js (https://github.com/hassankhan/emojify.js)
// Usage:
// <p data-bind="message.text | emojify | raw"></p>
Batman.mixin(Batman.Filters, {
emojify: function(content){
if(typeof(content) === "undefined" || content === null)
return undefined;
return emojify.replace(content);
private class FrameQueueWorker<T>{
private List<T> items;
private Action<T,int> block;
private int i, imax;
public FrameQueueWorker(List<T> items, Action<T,int> block){
this.items = items; this.block = block;
i = 0; imax = items.Count;
}
#!/bin/bash
#
# Fixes MKV files to be more complient to XMBC, PLEX and other media server / players.
# Work for OSX. Needs mkvtoolnix (http://www.downloadbestsoft.com/MKVToolNix.html)
#
#####################################################################################
##
## PREFERENCES
##
@jnbt
jnbt / sitemap.xml.erb
Created October 22, 2012 14:03 — forked from ls-lukebowerman/sitemap.xml.erb
Sitemap (sitemaps.org) generator for Middleman
<% base_url = "http://youdomain.com/" %>
<% pages = sitemap.resources.find_all{|p| p.source_file.match(/\.html/) } %>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<% pages.each do |p| %>
<url>
<loc><%= base_url + p.destination_path.gsub('index.html','') %></loc>
<% if priority = p.metadata[:page]['priority'] %>
<priority><%= priority %> </priority>
<% end %>