Skip to content

Instantly share code, notes, and snippets.

Ben Ubois benubois

Block or report user

Report or block benubois

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View delicious_waves.php
!#/usr/bin/php
<?php
# Username
$username = '';
# Location of waves.txt file
$waves_txt = '';
# Private key. Optional if you want to include private bookmarks
$private_key = '';
View block_sort.rb
#!/usr/bin/env ruby
# Block sort in ruby
content = STDIN.read
lines = content.split(/\n\n+/).sort
lines.each { |line| puts line + "\n\n" }
View iphone_convert.sh
# convert video to mp4
for f in "$@"
do
/usr/local/bin/HandBrakeCLI -i "$f" -o "$f.mp4" --preset="iPhone / iPod Touch" --longest -b 256
done
View click.js
// Simulate a click event on the matched id
HTMLElement.prototype.click = function()
{
var evt = this.ownerDocument.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(evt);
}
document.getElementById("id").click();
@benubois
benubois / populate.js
Created Nov 5, 2010
Populate: JavaScript form field populator
View populate.js
var fields = {
'email': {
'value': 'example@example.com',
'aka': ['email', 'email_address', 'emailAddress']
},
'first_name': {
'value': 'First Name',
'aka': ['first_name', 'firstName', 'first', 'firstname']
},
'last_name': {
@benubois
benubois / class.validator.php
Created Nov 5, 2010
Validator: PHP Form Validation
View class.validator.php
<?php
/**
* Validate
*/
class Validator
{
/**
* form validation rules and options
*
View .tm_properties
#-------------------------------------------------------------------------------
# Drawer
#-------------------------------------------------------------------------------
myExtraIncludes = ".tm_properties,.htaccess,.gitignore"
fileBrowserGlob = "{*,$myExtraIncludes}"
include = "{$include,$myExtraIncludes}"
#-------------------------------------------------------------------------------
# Search
#-------------------------------------------------------------------------------
View gist:2998578
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>io.redis.redis-server</string>
<key>ProgramArguments</key>
<array>
@benubois
benubois / tab_select.js
Last active Dec 12, 2015
Select nested jquery tabs within tabs. Using a query string like ?selected_tabs=tab-3,section-tab-2. The selected tabs should be the comma separated ids of the tabs that should be active.
View tab_select.js
tabSelect: function(args) {
var queryString = greenplum.queryString();
if (typeof(queryString.selected_tabs) == 'string') {
var selectedTabs = queryString.selected_tabs.split(',');
var parentTabs = '';
for (var i=0; i < selectedTabs.length; i++) {
var index = jQuery('[href~=#' + selectedTabs[i] + ']', parentTabs).parent('li').index();
var tabs = jQuery(jQuery('#' + selectedTabs[i], parentTabs).parents('.tabs')[0]);
tabs.tabs().tabs('select', index);
var parentTabs = jQuery('#' + selectedTabs[i], parentTabs);
View nokogiri_results.rb
#(Document:0x3fc9e955ba34 {
name = "document",
children = [
#(Element:0x3fc9e955b214 {
name = "feed",
namespace = #(Namespace:0x3fc9e955aeb8 {
href = "http://www.w3.org/2005/Atom"
}),
children = [
#(Text "\n "),
You can’t perform that action at this time.