Skip to content

Instantly share code, notes, and snippets.

@bryanjswift
bryanjswift / mail_virtual_users.rb
Created February 27, 2014 06:10
Process STDIN containing DB row sets from a command selecting email address and password hash. Used in pipeline like `ssh {{ main_user_name }}@{{ domain }} 'PGPASSWORD={{ mail_db_password }} psql -U {{ mail_db_username }} -h 127.0.0.1 --command="SELECT email, password FROM virtual_users;" {{ mail_db_database }}' | grep '\$6\$' | ./mail_virtual_u…
#!/usr/bin/env ruby
require 'yaml'
# Part of command to sync down hashed user passwords
accounts = []
$stdin.each_line do |line|
email = line.split('|')[0].gsub(/\s+/, '')
hash = line.split('|')[1].gsub(/\s+/, '')
accounts << {
@bryanjswift
bryanjswift / keybase.md
Created August 14, 2014 18:26
Keybase github verification

Keybase proof

I hereby claim:

  • I am bryanjswift on github.
  • I am bryanjswift (https://keybase.io/bryanjswift) on keybase.
  • I have a public key whose fingerprint is A439 647C C223 4E86 D25D 9449 6FD4 B193 F9A5 6D56

To claim this, I am signing this object:

// not optimized for performance because the Fx.Tween object is continually recreated by calling $('big_picture').get('tween') with new options
$('left').addEvent('click', function(){
if(!$('left').hasClass('deactivated')) {
current_id = $('big_picture').get('class').replace('image_', '');
current_id--;
$('big_picture').get('tween',{
onComplete: function() {
$('big_picture').set('src', 'pictures/' + current_id + '.jpg');
$('big_picture').fade(1);
$('big_picture').set('class', 'image_' + current_id);
Window.implement({
fireEvent: function(type, args, delay){
var events = this.retrieve('events');
if (!events || !events[type]) return this;
events[type].keys.each(function(fn){
fn.create({'bind': this, 'delay': delay, 'arguments': args})();
}, this);
if (!type.test(/^after/)) this.fireEvent('after' + type.capitalize());
return this;
}
<h1>First Accordian</h1>
<div class="accordion">
<h3 class="toggler">Heading 1</h3>
<div class="element">
<p>Some text</p>
</div>
<h3 class="toggler">Heading 2</h3>
<div class="element">
<p>Some text</p>
</div>
<!-- Example of the li statement for author commenting based on ID -->
<li id="comment-<?php comment_ID() ?>" class="comment<?php if(!isset($themeOptions)) { $themeOptions = get_option('ThemeOptionStorage'); } if ($themeOptions["owner_id"] == $comment->user_id) { echo ' author'; } ?>">
window.addEvent('domready', function() {
//create our Accordion instance
var myAccordion = new Accordion($('accordion'), 'a.toggler', 'div.element', {
start:'all-close',
alwaysHide: true,
opacity: true,
onActive: function(toggler, element){
toggler.setStyle('background-position', '0 -30px');
},
@bryanjswift
bryanjswift / albedo.html
Created April 21, 2009 19:07
My modification of the nostalgia theme for Tumblr
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{Title}</title>
<link rel="shortcut icon" href="{Favicon}">
<link rel="alternate" type="application/rss+xml" href="/rss">
<style type="text/css">
body {
" Vim syntax file
" Language: LESS Cascading Style Sheets
" Maintainer: Leaf Corcoran <leafot@gmail.com>
" Modifier: Bryan J Swift <bryan@bryanjswift.com>
" URL: http://leafo.net/lessphp/vim/less.vim
" URL: http://gist.github.com/161047
" Last Change: 2009 August 4
" LESS by Leaf Corcoran
" CSS2 by Nikolai Weibull
" Full CSS2, HTML4 support by Yeti
" Vim syntax file
" Language: Velocity Template Language
" Maintainer: Antonio Terceiro <terceiro@im.ufba.br>
" Maintainer: Bryan J Swift <bryan@bryanjswift.com>
" Last Change: 2009 Sep 20
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear