Skip to content

Instantly share code, notes, and snippets.

View BillBarnhill's full-sized avatar
💭
Learning Rust

=Bill.Barnhill BillBarnhill

💭
Learning Rust
View GitHub Profile
@prefix : <urn:j:>.
@prefix gage: <urn:j:gage:>.
@prefix howe: <urn:j:howe:>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix windows: <urn:windows:> .
@BillBarnhill
BillBarnhill / hipchat_bot.js
Created April 28, 2011 18:25 — forked from powdahound/hipchat_bot.js
Basic XMPP bot example for HipChat using node.js
// Basic XMPP bot example for HipChat using node.js
// To use:
// 1. Set config variables
// 2. Run `node hipchat_bot.js`
// 3. Send a message like "!weather 94085" in the room with the bot
var request = require('request'); // github.com/mikeal/request
var sys = require('sys');
var util = require('util');
@BillBarnhill
BillBarnhill / BarnhillErlangTip1
Created November 28, 2012 11:58
Connecting erlang nodes before apps start
To do the equivalent of...
net_kernel:connect(a@host1),
net_kernel:connect(b@host1)
...add the following to your config:
{sync_nodes_mandatory, [a@ferdmbp, b@ferdmbp]},
{sync_nodes_timeout, 30000}
% Copyright (c) 2010-2011, Lars Buitinck
% May be used, redistributed and modified under the terms of the
% GNU Lesser General Public License (LGPL), version 2.1 or later
% Heaps/priority queues in Erlang
% Heaps are data structures that return the entries inserted into them in
% sorted order. This makes them the data structure of choice for implementing
% priority queues, a central element of algorithms such as best-first/A*
% search and Kruskal's minimum-spanning-tree algorithm.
@BillBarnhill
BillBarnhill / InventoryArchiveBasics.md
Created May 24, 2014 16:45
Saving and Loading WhiteCore Inventory Archives

= Using Inventory Archives

== Saving an inventory Archive

On one user create the outfit in a new folder underneath Clothing.

Log into your grid as your test user, the one that will create the outfit. In my case this is "Test User".

We'll start with the Donarl avatar from OSAvatars.org, and add some minor tweaks, but you can start with anything you have in your inventory. It's important to make sure you keep any notecards with attributions, and respect any permissions or copyrights. I like to add a notecard titled 'Attributions', which lists the sources for the various Creative Commons items I use.

@BillBarnhill
BillBarnhill / phoenix_headers_snippet.ex
Created October 3, 2015 14:03
Snippet showing how to dump request headers into response as JSON, put in controller
def mapify({k,v}, m) do
Map.put(m, k, v)
end
def show(conn, %{"id" => id, "as" => "headers"}) do
resp_body = conn.req_headers
|> List.foldl(Map.new(), &mapify/2)
|> Poison.encode!
send_resp(conn, 200, resp_body)
end
@BillBarnhill
BillBarnhill / phoenix_read_more_helper_snippet.ex
Created October 4, 2015 15:42
Example of a Phoenix view helper (put in your view or in App views) that inserts a read more link
@doc """
Inserts a link to the show path of a resource item. The
item must implement .id.
##Example
<%= read_more_link @conn, @post %>
"""
def read_more_link(conn, item) do
@BillBarnhill
BillBarnhill / tag_link_list.ex
Last active October 4, 2015 18:31
My snippet for generation of tag list using PhoenixHTML
@BillBarnhill
BillBarnhill / tag_link_list.ex
Created October 4, 2015 18:40
My fixed snippet for generation of tag list using PhoenixHTML
@BillBarnhill
BillBarnhill / Checkstyle pre-commit hook
Created November 23, 2015 12:09 — forked from davetron5000/Checkstyle pre-commit hook
Pre Commit Hook for running checkstyle on changed files
#!/usr/bin/perl
#
# Pre-commit hook for running checkstyle on changed Java sources
#
# To use this you need:
# 1. checkstyle's jar file somewhere
# 2. a checkstyle XML check file somewhere
# 3. To configure git:
# * git config --add checkstyle.jar <location of jar>
# * git config --add checkstyle.checkfile <location of checkfile>