This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
//page.paperSize = { width: "10cm", height: "10cm" }; | |
var url = 'http://twitter.github.com/bootstrap/'; | |
var sizes = ["1000*1000","600*600","200*200"]; | |
var sizeLength = sizes.length-1; | |
page.open(url, function(status) { | |
if (status === 'success') { | |
for (var i = sizeLength; i>=0; --i) { | |
console.log(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(), | |
address, | |
output, | |
size; | |
if (phantom.args.length < 1) { | |
console.log('Error: Wrong number of parameters provided'); | |
phantom.exit(); | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
# By default, only instances of Hash itself are extractable. | |
# Subclasses of Hash may implement this method and return | |
# true to declare themselves as extractable. If a Hash | |
# is extractable, Array#extract_options! pops it from | |
# the Array when it is the last element of the Array. | |
def extractable_options? | |
instance_of?(Hash) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Kills ability to click iframe's links | |
$('iframe').on('mouseover', function () { | |
pos = $.extend( { | |
width: $(this).outerWidth(), | |
height: $(this).outerHeight() | |
}, $(this).position()); | |
var cssObj = { | |
position: 'absolute', | |
top: pos.top, | |
left: pos.left, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AllHosts = function() { | |
var host_items = []; | |
return { | |
setHost: function(host) { | |
host_items.push(host); | |
}, | |
hasHost: function(id) { | |
var hasMe = false; | |
$.each(host_items, function(i, host) { | |
if (parseInt(host.host_id) === parseInt(id)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-/macro fio-dec system, june 1963 | |
007652 640500 szm=sza sma-szf | |
007652 650500 spq=szm i | |
007652 761200 clc=cma+cla-opr | |
- define senseswitch A | |
- repeat 3, A=A+A | |
- szs A | |
- term | |
- define init A,B | |
- law B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Testing Handlebars template</title> | |
</head> | |
<body> | |
<div id="test-handlebars"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if variable is array or object | |
// (From underscore.js each() implementation) | |
var array = []; | |
var object = {a:1,b:2}; | |
if (obj == null) return; | |
//actually it is logically equivalent to this ugliness: if ((obj === null) || (obj === undefined)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creates a binary Array Buffer | |
// (нельзя просмотреть просто так, нужен ArrayBufferView) | |
var buffer = new ArrayBuffer(10), | |
// (unsigned = capable of representing only non-negative integers [0,oo) ) | |
ex = new Uint8Array(buffer); | |
// Ex. Size 8-bit (Uint8Array) | |
// 0 0 0 0 0 0 0 0 | |
// 128 64 32 16 8 4 2 1 [low=0|high=255|total=256] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jason("sample", sample_data).sample.flatten().getJsonData(); |
OlderNewer