Skip to content

Instantly share code, notes, and snippets.

View tamimibrahim's full-sized avatar

Tamim Bin Ibrahim tamimibrahim

View GitHub Profile
@jonaslund
jonaslund / fbScrape.js
Created August 15, 2012 10:18
Casperjs script to screenshot an entire Facebook Post
// Using Casperjs to screenshot an entire Facebook Post */
var casper = require('casper').create({
clientScripts: [
'jquery.js'
]
});
//login to facebook
casper.start('https://www.facebook.com/', function() {
this.fill('#login_form', { email: 'email', pass: 'password' }, true);
@papoms
papoms / fake-referrer.casper.js
Created August 24, 2012 16:10
Fake Referrer with CasperJS
var fakeReferrer = "http://porzky.com"
var targetUrl = "http://keyworddomains.com"
var casper = require('casper').create();
casper.start(fakeReferrer, function() {
this.echo(this.getCurrentUrl());
});
casper.then(function(){
@nhoizey
nhoizey / screenshots.js
Created November 12, 2012 17:07
Take screenshots at different viewport sizes using CasperJS
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
@ikstob
ikstob / AddMeFastExample.java
Created November 19, 2012 19:38
Example of using Selenium from Java
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
@ganglio
ganglio / fb.js
Created December 13, 2012 14:39
CasperJS: Facebook photos scraper
var casper = require('casper').create({
verbose : true,
logLevel : 'info'
});
var images = [];
var fs=require("fs")
/**
* Configuration here
*/
@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/");
@bshamric
bshamric / cache.js
Last active January 24, 2021 12:08
I like phantomjs, but it doesn't directly support getting images from webpages without requesting them separately like in casperjs. I went through QTNetworking code in the phantomjs repo until I figured out where the cache was. To use this, have all three files in the same directory. Then modify test.js for whatever you need. Call phantom js wit…
var fs = require('fs');
//this is the path that QTNetwork classes uses for caching files for it's http client
//the path should be the one that has 16 folders labeled 0,1,2,3,...,F
exports.cachePath = '/path/to/phantomjs/cache/data/folder';
//this is the extension used for files in the cache path
exports.cacheExtension = "d";
//the resources that are to be saved
@JeffreyWay
JeffreyWay / laravel.js
Last active April 6, 2024 20:12
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
@tareq1988
tareq1988 / settings-api-class-demo.php
Created March 8, 2013 13:46
A simple theme options page created with WordPress Settings API PHP class https://github.com/tareq1988/wordpress-settings-api-class
<?php
require_once dirname( __FILE__ ) . '/class.settings-api.php';
/**
* Theme Admin panel for Tareq's Planet
*
* @author Tareq Hasan
*/
class Tareqs_Planet_Admin {
@imjared
imjared / scraping-with-casperjs.js
Created March 20, 2013 00:33
A CasperJS script that crawled a list of links on then scraped the relevant content on each page and output it to a nicely formatted XML file. Sure beats database dumps/SQL manipulation, in my opinion.
/*jshint strict:false*/
/*global CasperError console phantom require*/
/**
* grab links and push them into xml
*/
var casper = require("casper").create({
});