Skip to content

Instantly share code, notes, and snippets.

View tamimibrahim's full-sized avatar

Tamim Bin Ibrahim tamimibrahim

View GitHub Profile
run:
casperjs index.js && convert *.jpg video.mpeg && gify video.mpeg out.gif && rm *.jpg video.mpeg
@akiyoshi83
akiyoshi83 / scrape.js
Created May 15, 2014 15:10
CasperJS scraping sample
var system = require('system');
var fs = require('fs');
var args = system.args;
// args is phantomjs api.
// args [3] and later arguments of casperjs
var _args = args.slice(3);
if(_args.length < 2) {
console.log("USAGE: casperjs scrape.js URL");
phantom.exit();
require 'watir-webdriver'
puts "== Album Description Updater =="
description = File.read(ARGV[0])
parts = description.scan(/https:\/\/www\.facebook\.com\/.*?\/media_set\S+/)
puts "There are #{parts.length} albums whose descriptions are to be updated!"
browser = Watir::Browser.new :firefox, :profile => 'watir'
@billywhizz
billywhizz / vhost.js
Created April 28, 2011 19:51
Example of vhosts in node.js
var http = require("http");
/*
add following to your hosts config to test:
10.11.12.8 www.vhost1.net
10.11.12.8 www.vhost2.com
10.11.12.8 www.vhost3.test.com
10.11.12.8 static.vhost1.net
@julienb74
julienb74 / gist:2157299
Created March 22, 2012 09:23 — forked from firedfox/gist:2037411
check google ads with phantomjs
var page = require('webpage').create();
page.settings.loadImages = false;
page.onConsoleMessage = function(msg) { console.log(msg); };
var pageUrl = 'http://www.bloggersentral.com/2010/08/how-put-add-adsense-on-blogger.html';
var num = 0;
var max = 2;
page.onLoadFinished = function() {
var text = page.evaluate(function() {
@n1k0
n1k0 / sublime-day.js
Created June 28, 2012 09:32
Finds your daily SublimeText2 package using CasperJS. Yeah, randomly.
/**
* Finds your daily SublimeText2 package. Yeah, randomly.
*
* Requires CasperJS: http://casperjs.org/
*
* Usage: $ casperjs sublime-day.js
*/
var casper = require('casper').create();
var f = require("utils").format;
var packages = [];
@iwek
iwek / cookies.js
Created July 17, 2012 14:31
view and disable cookies in casperjs and phantomjs
//to disable cookies, run casperjs --cookies-file=/dev/null? cookies.js
var casper = require('casper').create();
casper.start('http://wordpress.org/', function() {
this.echo('Browser Cookie: ' + this.evaluate(function() {
return document.cookie;
}));
});
@brunobord
brunobord / kill.js
Created January 30, 2013 23:21
Casper Script: restart Alwaysdata processes.
/**
* Casper script to restart Alwaysdata processes.
*
* Usage:
* $ casperjs kill.js email@example.com mysecretpassword
*/
var casper = require('casper').create();
casper.start("https://admin.alwaysdata.com/login/");
@shuuheyhey
shuuheyhey / capture.js
Created May 20, 2013 22:51
casperjs > capture.js
var screenshotUrl = 'http://example.com/'
var casper = require("casper").create({
viewportSize: {
width: 1280,
height: 1280
}
});
if (casper.cli.args.length < 1) {
var casper = require('casper').create({
verbose: true,
logLevel: 'debug',
pageSettings: {
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4'
}
});
var url = 'https://www.pinterest.com/login/';