The script:
/*global casper:true*/
var casper = require('casper').create({
pageSettings: {
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Firefox/31.0"
}
#!/usr/bin/env ruby | |
=begin | |
install Sinatra: gem install sinatra | |
install Shotgun: gem install shotgun (this auto-reloads sinatra on every http request - which means every time you make a change in your code you don't have to stop then start sinatra) | |
To just run your code using Sinatra: ruby name-of-file.rb | |
To run your code using Shotgun (which is just Sinatra but with ability to auto-reload when changes are made to files): shotgun name-of-file.rb | |
The following examples are run using Shotgun and the URL is: http://127.0.0.1:9393/ |
function FBshares(url) { | |
var jsondata = UrlFetchApp.fetch("http://graph.facebook.com/"+url); | |
var object = Utilities.jsonParse(jsondata.getContentText()); | |
return object.shares; | |
} | |
function Tweets(url) { | |
var jsondata = UrlFetchApp.fetch("http://urls.api.twitter.com/1/urls/count.json?url="+url); | |
var object = Utilities.jsonParse(jsondata.getContentText()); | |
return object.count; |
Note: these are pretty rough notes I made for my team on the fly as I was reading through some pages. Some could be mildly inaccurate but hopefully not terribly so. I might resort to convenient fiction & simplification sometimes.
My top contenders, mostly based on popularity / community etc:
Mostly about MVC (or derivatives, MVP / MVVM).
This tutorial demonstrates how to use Google Apps Script to:
Create copies of the Google Sheet in the desired destination folder automatically at set intervals.
Append the time stamp with each backup file's name.
Adjust time trigger for backing up every day/hour/minute.
// XPath CheatSheet | |
// To test XPath in your Chrome Debugger: $x('/html/body') | |
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
// 0. XPath Examples. | |
// More: http://xpath.alephzarro.com/content/cheatsheet.html | |
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class |
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |