Skip to content

Instantly share code, notes, and snippets.

View joshuaswilcox's full-sized avatar

Joshua Wilcox joshuaswilcox

View GitHub Profile
@joshuaswilcox
joshuaswilcox / gist:3715949
Created September 13, 2012 17:20
Everything you can override in a refinerycms project with refinerycms-blog
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*
function _get_gate_form_title($nid, $vid) {
$row = _get_gate_row($nid, $vid);
$title = $row->form_title;
return $title;
}
function _get_gate_row ($nid, $vid) {
$result = db_query("SELECT * FROM gated_content WHERE nid = %d AND vid = %d", $nid, $vid);
$row = db_fetch_object($result);
@joshuaswilcox
joshuaswilcox / xml_rpc_in_wordpress
Created October 8, 2012 19:50
XML RPC in Wordpress
Joshs-Mac-Pro:PEAR josh$ wget https://github.com/pear/XML_RPC2/zipball/trunk
--2012-10-08 15:45:22-- https://github.com/pear/XML_RPC2/zipball/trunk
Resolving github.com... 207.97.227.239
Connecting to github.com|207.97.227.239|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://nodeload.github.com/pear/XML_RPC2/zipball/trunk [following]
--2012-10-08 15:45:23-- https://nodeload.github.com/pear/XML_RPC2/zipball/trunk
Resolving nodeload.github.com... 207.97.227.252
Connecting to nodeload.github.com|207.97.227.252|:443... connected.
HTTP request sent, awaiting response... 200 OK
@joshuaswilcox
joshuaswilcox / Ruby String Trim at Full Word
Created November 8, 2012 21:39
Trims ruby string to set length maintaining full words
def desc_trim
@string = self.description.to_s
@max = 120
if @string
if @string.size > @max
@words = @string.split(' ')
@end = "..."
@output = ''
i = 0
@words.each_with_index do |w, i|
//This is the video player object
//<video id="video-mp4" class="video-js vjs-default-skin"
// controls preload="auto" width="100%" height="350"
// data-setup='{}'
// poster="http://video-js.zencoder.com/oceans-clip.png">
// <source src="http://localhost:3000/assets/barcode64408.mp4" type='video/mp4' />
// </video>
$(function() {
var player = videojs('video-mp4');
Top 10 slowest examples (450.02 seconds, 65.1% of total time):
User searches user search features and there are no results
74.77 seconds ./spec/features/search_spec.rb:11
User searches user search features and they sort by title
62.61 seconds ./spec/features/search_spec.rb:32
User searches user search features and they filter with a facet
54.08 seconds ./spec/features/search_spec.rb:26
User searches user search features and they sort by date
46.35 seconds ./spec/features/search_spec.rb:39
User searches user search features and there are less than 10 results
GIT
remote: https://github.com/jackdempsey/acts_as_commentable.git
revision: e9baa4826f92c80f90b6e589fd73aa5a0a54851b
specs:
acts_as_commentable (4.0.0)
GIT
remote: https://github.com/mbleigh/acts-as-taggable-on.git
revision: 98aecdd86ddf447a88ae6351cc02ab420a78d0ec
specs:
@joshuaswilcox
joshuaswilcox / geek_ch
Last active December 26, 2015 21:29
Get latest Calvin and Hobbes comic and save to folder
#!/usr/bin/env ruby
require 'nokogiri'
require 'net/http'
require 'open-uri'
require 'cgi'
require "fileutils"
# folder where to save the comic to
$basedir = '~/Documents/geeklets/ch_comic'
ac99f3707a11b13f224eba8494a6e52d1147b305
b5cf5f67e39f96d264183d3fa960ba0a4a305486
029cb9028a2e310beff924ae191656156b9c289b
88cbecb8c44ec0ed66f8a677727a61778937b1a9
7c39757cdbf4ac915d598e76baa6d1c8e1a5c943
7e863a767765eebd370a5b61ea624f12fafbb281
5a8a6000bc23806d7150c91173b9093f09e8054b
00436635cae517a3ec2a224896f2a9ed4f2e6525
1871f3fd7cc2e1396e1a4cf90a8cc94a97645f15
f60ffe95124e03f339c241598212a7c3204f0171
@joshuaswilcox
joshuaswilcox / current_song
Last active September 2, 2023 14:12
Applescript to show current playing song and determine if its spottily or iTunes that is playing
if application "Spotify" is running and application "iTunes" is not running then
tell application "Spotify"
if player state is stopped then
set display to "No Track Playing"
else
set track_artist to artist of current track
set track_name to name of current track
set track_duration to duration of current track
set seconds_played to player position
set state to ""