Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
EventMachine.run do | |
EM::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => false) do |ws| | |
ws.onopen do | |
ws.onmessage { |data| | |
# ... | |
# ws.send | |
} |
var ws = new WebSocket("ws://localhost:8080/"); | |
ws.onopen = function() { | |
this.send(JSON.stringify({event: "init",data: { c_wid: "51396e790662720c10000002" } })); | |
}; | |
ws.onmessage = function(evt){ | |
var json = JSON.parse(evt.data); | |
console.log(json); | |
this.dispatch(json.event, json.data); | |
}; |
String.prototype.toHHMMSS = function () { | |
sec_numb = parseInt(this); | |
var hours = Math.floor(sec_numb / 3600); | |
var minutes = Math.floor((sec_numb - (hours * 3600)) / 60); | |
var seconds = sec_numb - (hours * 3600) - (minutes * 60); | |
if (hours < 10) {hours = "0"+hours;} | |
if (minutes < 10) {minutes = "0"+minutes;} | |
if (seconds < 10) {seconds = "0"+seconds;} | |
var time = hours+':'+minutes+':'+seconds; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Google Developers</title> | |
<link rel="stylesheet" type="text/css" href="/_static/css/screen.css" /> | |
<link rel="stylesheet" href="//www.google.com/cse/style/look/default.css" type="text/css" /> | |
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400' rel='stylesheet' type='text/css'> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> | |
<script id="jqueryui" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js" defer async></script> | |
<!--[if lt IE 9]> |
Fortunately, if you are trying to get the stream of a Facebook Page, there IS a better way. And one to get access tokens that never expire for pages. | |
Note: You need to A) be logged into FB, and B) be an admin for the page for which you are trying to get the stream. | |
1. Create an app on FB for your website. After creating it, make sure toe add your domain to App Domains and check Website with Facebook Login underneath “Select how your app integrates w FB” and provide your Site URL (which will be the oauth redirect_uri). | |
2. Visit the following to generate a new SHORT-LIVED (1 hour) access token: | |
https://www.facebook.com? | |
client_id=[APPID]& |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
class Numeric | |
def roundup(nearest=10) | |
self % nearest == 0 ? self : self + nearest - (self % nearest) | |
end | |
def rounddown(nearest=10) | |
self % nearest == 0 ? self : self - (self % nearest) | |
end | |
end | |
puts 2.roundup #=> 10 | |
puts 23.roundup #=> 30 |
Array.prototype.clean = function(deleteValue) { | |
for (var i = 0; i < this.length; i++) { | |
if (this[i] == deleteValue) { | |
this.splice(i, 1); | |
i--; | |
} | |
} | |
return this; | |
}; |