Skip to content

Instantly share code, notes, and snippets.

<------- View randoms/add.ctp -------->
<?php
echo $this->Form->create('Random');
echo $this->Form->input('Random.start_time',
array(
'type' => 'time',
)
);
@romaimperator
romaimperator / .rtorrent.rc
Created February 21, 2012 23:47
My rTorrent rc file
scgi_port = localhost:5000 # This configures the bind address and port that ruTorrent will communicate with rTorrent on
# Directory Configuration
directory = /mnt/Storage/rtorrent/torrents # This directory is the directory to save the data of the torrent to
schedule = watch_directory,5,5,load_start=/mnt/Storage/rtorrent/watch/*.torrent # This sets up a watch directory to watch for .torrent files
session = /mnt/Storage/rtorrent/session/ # This directory is the location to store session data and is required for DHT
# Connection Settings
ip = your_ip # The IP address to report to the tracker. Without this, other users that found you through the tracker can't connect to you.
min_peers = 40 # Sets the desired minimum number of peers for each torrent
@romaimperator
romaimperator / rtorrent
Created February 23, 2012 23:49
The rtorrent rc.d file
#!/bin/sh
# Basically this starts rtorrent on a screen session
# The only important thing to note is the rtorrent_user and rtorrent_group. They are the user and group respectively that rTorrent is started with. If you set these to the user and group you use for the file shares in Freenas you shouldn't have trouble with accessing torrents started by rTorrent through the share.
. /etc/rc.subr
name=rtorrent
rcvar=rtorrent_enable
@romaimperator
romaimperator / unicorn_init_script.sh
Created June 19, 2012 08:08
This file is an Ubuntu init script for Unicorn
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
document.getElementById("button_to_click").addEventListener("click", function anon(event) {
this.removeEventListener("click", anon, false);
var mobi_button = document.getElementById("element_to_append_to");
var new_div = document.createElement("div");
new_div.appendChild(document.createTextNode("Please wait while we prepare the book for you."));
mobi_button.appendChild(new_div);
}, false);
import os
# Where file_path is path + filename, no extension
def convert_file(file_path):
if os.path.exists(file_path + ".mobi"):
#skip
else:
#convert
@romaimperator
romaimperator / helper.rb
Last active December 16, 2015 18:29 — forked from excid3/helper.rb
def nav_link_to(title, url, options={})
li_options = {}
if matches_options?(options)
li_options[:class] = "active"
end
content_tag :li, li_options do
link_to title, url
end
Array.prototype.unique = function(a){
return function(){
return this.filter(a)
}
}(function(a,b,c){
return c.indexOf(a,b+1)<0
});
Array.prototype.unique = function() {
return this.filter(function(a,b,c) {
# Returns true if the "X-Requested-With" header contains "XMLHttpRequest"
# (case-insensitive). All major JavaScript libraries send this header with
# every Ajax request.
def xml_http_request?
@env['HTTP_X_REQUESTED_WITH'] =~ /XMLHttpRequest/i
end
alias :xhr? :xml_http_request?
<specializations>
<specialization>
<type>being awesome</type>
<doctors>
<doctor>
<name>Dan Fox</name>
</doctor>
<doctor>
<name>Nikki Rodriguez</name>
</doctor>