This file contains 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
# This will render the partial to the browser, then return nothing to Ruby. | |
def controller_action | |
render("partial") and return | |
end |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Hello World</title> | |
<link rel="stylesheet" href="/stylesheets/application.css" type="text/css" /> | |
</head> | |
<body> | |
<div id="container"> | |
... |
This file contains 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
server { | |
listen 80; | |
server_name openvbx.local; | |
root /u/apps/openvbx; | |
access_log /var/log/nginx/openvbx.local.access.log; | |
error_log /var/log/nginx/openvbx.local.error.log; | |
index index.php; | |
if ($request_filename !~ (js|css|jpg|png|gif|robots\.txt|index\.php.*) ) { | |
rewrite ^(.*)$ /index.php?vbxsite=$1 last; |
This file contains 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 'cpanel' | |
# Create a new instance of a server | |
server = Cpanel::Server.new( | |
:url => "http://server.url.com:2086/", | |
:key => "API_KEY", | |
:timepout => 100, # defaults to 300 | |
:api => "xml" # defaults to "json" | |
) |
This file contains 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 'memcached' | |
require 'memcache' | |
# encoding: utf-8 | |
class Currency | |
CACHE = MemCache.new 'localhost:11211' | |
class << self | |
def sterling |
This file contains 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
"string".html_safe? # false | |
"string".html_safe.html_safe? # true | |
("string" + "string".html_safe).html_safe? # false |
This file contains 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
test = nil | |
test.html_safe? # false | |
test.try(:html_safe) # nil | |
test = test.to_s # "" | |
test.html_safe? # false |
This file contains 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
<title>{block:PostSummary}{PostSummary} - {/block:PostSummary}{Title}</title> |
This file contains 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
T.User.find("voxxit").timeline().first(5).each(function(tweet){ | |
if(tweet.text !== undefined){ | |
var tweet_html = '<div class="tweet">'; | |
var link_regex = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi; | |
tweet_html += tweet.text.replace(link_regex, '<a href="$1">$1</a>'); | |
tweet_html += '<div class="tweet_hours">'; | |
tweet_html += '<a href="http://www.twitter.com/'; | |
tweet_html += 'voxxit/status/' + tweet.id + '">'; | |
tweet_html += '<time>' + time_ago_in_words(tweet.createdAt) + ' ago</time><\/a><\/div>'; |