Skip to content

Instantly share code, notes, and snippets.

@khajavi
khajavi / assembly.sbt
Last active August 29, 2015 14:22
My Scala Practices
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")
@khajavi
khajavi / ghci.txt
Last active August 29, 2015 14:21
My Haskell Practices
> Constructor "Milad"
> Constructor [Just True, Nothing, Just False]
@khajavi
khajavi / blocked
Last active August 29, 2015 14:18 — forked from fzerorubigd/blocked
code.google.com
googleapis.com
googleusercontent.com
ytimg.com
youtube.com
youtube-nocookie.com
bitbucket.org
thepiratebay.se
humblebundle.com
plus.url.google.com
@khajavi
khajavi / infinite_scroll_phantomjs.js
Created March 7, 2015 21:52
Phatomjs Infinite Scroll
/*jshint devel:true, phantom:true*/
/**
* PhantomJS Cookbook Chapter 3 | Working with webpage Objects Recipe 9 |
* Simulating scrolling in PhantomJS
*/
var webpage = require('webpage').create();
var jquery = "jquery.min.js";
webpage.viewportSize = {
width : 1280,
@khajavi
khajavi / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
var http = require("http");
var phantom = require("phantom");
var util = require('util');
var url = "http://fa-ir.facebook.com/abdolkarimi.org";
var jquery = "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js";
phantom.create(function(ph) {
ph.createPage(function(page) {
console.log(util.inspect(page))
page.evaluate(function() {
var current = 0, delta = 800, total = document.height - delta;
window.scrollTo(0, current);
function fakeScroll() {
if(current < total) {
current = current + delta;
window.scrollTo(0, current);
window.setTimeout(fakeScroll, 100);
@khajavi
khajavi / gist:e53ec2d9fb30ad3c86f0
Created March 1, 2015 21:22
sleep in javascript
function sleep(time, callback) {
var stop = new Date().getTime();
while (new Date().getTime() < stop + time) {
;
}
callback();
}