This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
url = URI.parse('http://stream.kpsu.org:8080/listen') | |
# This thread is used to kill the recording thread after the | |
# designated amount of time. | |
timelimit = Thread.new do | |
# running_time_in_seconds is how many seconds the clip should be | |
# one hour = 3600 seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PGP.net goes down from time to time, and incase it does you can use this to add the NewRelic key: | |
wget -O - http://download.newrelic.com/548C16BF.gpg | apt-key add - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# As always, I hope I didn't reinvent the wheel or do something stupid... If I have please let me know! | |
# | |
# I'm currently using this with async_sinatra; haven't tested it without (sorry!) | |
# | |
# Example method usage: | |
# | |
# before_filter [[:apost, "/users/?"] do | |
# require_login | |
# end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Usage: | |
# class ApplicationController < ActionController::Base | |
# include ErrorPages | |
# end | |
# | |
require 'active_support/core_ext/array/extract_options' | |
module ErrorPages | |
extend ActiveSupport::Concern |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
# -- | |
# Copyright (C) 2008-2011 10gen Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'vips' | |
class Photo < ActiveRecord::Base | |
# Include the VIPS moduel in model so we have access to the `Image` class | |
include VIPS | |
# Basic attributes | |
attr_accessible :image, :image_cache, :crop_x, :crop_y, :crop_w, :crop_h | |
# mount Carrierwave | |
mount_uploader :image, PhotoUploader | |
# Call the minimum_dimensions method on validation | |
validate :minimum_dimensions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'watir-webdriver' | |
capabilities = Selenium::WebDriver::Remote::Capabilities.phantomjs("phantomjs.page.settings.userAgent" => "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36") | |
driver = Selenium::WebDriver.for :phantomjs, :desired_capabilities => capabilities | |
browser = ::Watir::Browser.new driver | |
# Quick test to make sure it's set | |
browser.goto 'http://www.useragentstring.com/' | |
browser.textarea(:id => "uas_textfeld").value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model < ActiveRecord::Base | |
attr_accessor :was_new_record | |
def was_new_record? | |
@was_new_record == true ? true : false | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[UIBarButtonItem configureFlatButtonsWithColor:[UIColor peterRiverColor] | |
highlightedColor:[UIColor belizeHoleColor] | |
cornerRadius:3]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Notes: | |
# | |
# FlatUIKit: https://github.com/Grouper/FlatUIKit | |
# | |
# Their Example: | |
# [UIBarButtonItem configureFlatButtonsWithColor:[UIColor peterRiverColor] | |
# highlightedColor:[UIColor belizeHoleColor] | |
# cornerRadius:3]; | |
# |
OlderNewer