- Some utilities:
sudo apt-get install vim tmux git
- Copy/paste from the command line:
sudo apt-get install xclip
var html = require('fs').readFileSync(__dirname+'/helloworld.html'); | |
var server = require('http').createServer(function(req, res){ | |
res.end(html); | |
}); | |
server.listen(8080); | |
var nowjs = require("now"); | |
var everyone = nowjs.initialize(server); | |
everyone.now.distributeMessage = function(message){ |
def index | |
if current_member.subscription.nil? | |
redirect_to new_subscription_path | |
end | |
end |
# You can use What ever type of View you want ERB, SLIM, HAML | |
# | |
# Once you have your list of ActiveRecord objects inside of @impressions | |
# instance variable from your controller, run the variable through a | |
# for loop to get the count for each ActiveRecord object | |
# | |
# Optionally, you can create new instance variables and add to their | |
# values when running the loop so you can get total number of views for | |
# that specific user. |
// It is important to declare your variables. | |
(function() { | |
var foo = 'Hello, world!'; | |
print(foo); //=> Hello, world! | |
})(); | |
// Because if you don't, the become global variables. | |
(function() { |
$(document).ready(function(){ | |
function distance(element) { | |
// About object is returned if there is no 'element' parameter | |
var about = { | |
Version: 0.1, | |
Author: "James Qualls", | |
Created: "Dec 5th, 2012", | |
Updated: "Not yet" | |
}; |
// add this to your API controller in Yii | |
public function actionPreflight() { | |
$content_type = 'application/json'; | |
$status = 200; | |
// set the status | |
$status_header = 'HTTP/1.1 ' . $status . ' ' . $this->_getStatusCodeMessage($status); | |
header($status_header); | |
#How Current Header(Content-Type)
{"content-type":"text/html; charset=UTF-8"}
Render JSON With this content type
{"content-type":"application/json; charset=UTF-8"}
There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.
From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?
=============================================================================== | |
Some setup you must do manually if you haven't yet: | |
1. Ensure you have defined default url options in your environments files. Here | |
is an example of default_url_options appropriate for a development environment | |
in config/environments/development.rb: | |
config.action_mailer.default_url_options = { :host => 'localhost:3000' } |