Skip to content

Instantly share code, notes, and snippets.

View joshuaswilcox's full-sized avatar

Joshua Wilcox joshuaswilcox

View GitHub Profile

Ubuntu 14.04, RoR, Nginx, Puma, Postgresql and Capistrano deploy#

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress
    • accept the RSA key
    • use the password that was provided when you set up the new server:
  • change the password:
# Colours
txtgrn='\[\e[0;32m\]' # Green
txtylw='\[\e[0;33m\]' # Yellow
txtblu='\[\e[0;34m\]' # Blue
txtpur='\[\e[0;35m\]' # Purple
txtcyn='\[\e[0;36m\]' # Cyan
txtwht='\[\e[0;37m\]' # White
bldblk='\[\e[1;30m\]' # Black - Bold
bldred='\[\e[1;31m\]' # Red - Bold
bldgrn='\[\e[1;32m\]' # Green - Bold
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@joshuaswilcox
joshuaswilcox / current_song
Last active July 29, 2024 00:14
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 ""
ac99f3707a11b13f224eba8494a6e52d1147b305
b5cf5f67e39f96d264183d3fa960ba0a4a305486
029cb9028a2e310beff924ae191656156b9c289b
88cbecb8c44ec0ed66f8a677727a61778937b1a9
7c39757cdbf4ac915d598e76baa6d1c8e1a5c943
7e863a767765eebd370a5b61ea624f12fafbb281
5a8a6000bc23806d7150c91173b9093f09e8054b
00436635cae517a3ec2a224896f2a9ed4f2e6525
1871f3fd7cc2e1396e1a4cf90a8cc94a97645f15
f60ffe95124e03f339c241598212a7c3204f0171
@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'
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:
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
//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');
@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|