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
// run this with phantomjs | |
//create new webpage object | |
//var page = new WebPage(); | |
var page = require('webpage').create(); | |
//load the page | |
page.open('http://mfyz.com', function (status) { | |
//fire callback to take screenshot after load complete | |
page.render('mfyz.png'); |
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
<?php | |
// sample: <img src="counter.php?counter=total_visits"> | |
function hex2rgb($color){ | |
$color = str_replace('#', '', $color); | |
if (strlen($color) != 6){ return array(0,0,0); } | |
$rgb = array(); | |
for ($x=0;$x<3;$x++){ | |
$rgb[$x] = hexdec(substr($color,(2*$x),2)); |
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 express = require('express'); | |
var app = express(); | |
var fs = require('fs'); | |
var auth = express.basicAuth(function(user, pass) { | |
return user === 'test' && pass === 'pass'; | |
}); | |
app.get('/', auth, function(req, res) { | |
res.setHeader('Content-Type', 'text/html'); |
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 tapStartX, tapStartY; | |
list_item.on(Events.TouchStart, function(e){ tapStartX = e.pageX; tapStartY = e.pageY; }); | |
list_item.on(Events.TouchEnd, function(e){ | |
if (Math.abs(e.pageX - tapStartX) < 20 && Math.abs(e.pageY - tapStartY) < 20) { | |
// real tap happened | |
} | |
}); |
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 ng-app="webApp"> | |
<head> | |
<title>Title</title> | |
<meta charset="utf-8"> | |
<script src="jquery-1.11.3.min.js"></script> | |
<script src="jquery-ui-1.11.4/jquery-ui.min.js"></script> | |
<!-- http://ghusse.github.io/jQRangeSlider/ --> | |
<script src="jQRangeSlider-5.7.1/jQDateRangeSlider-min.js"></script> |
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
<?php | |
//set POST variables | |
$url = 'http://c.docverter.com/convert'; | |
$fields = array('from' => 'html', | |
'to' => 'pdf', | |
'input_files[]' => "@/".realpath('input.html').";type=text/html; charset=UTF-8", | |
); | |
$ch = curl_init(); |
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
<? | |
function update_url($_data, $url = NULL){ | |
if (!$url) $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | |
$_url = parse_url($url); | |
if (isset($_url['query']) AND $_url['query']) parse_str($_url['query'], $_params); | |
else $_params = array(); | |
$_updated_params = array_merge($_params, $_data); |
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
// Change font (ctrl a) | |
var doc = context.document, | |
selection = context.selection, | |
font_name = [doc askForUserInput:"Font name:" initialValue:"SF UI Display"]; | |
function check_layer(layer){ | |
log(layer) | |
var className = layer.className() | |
log("Checking layer " + layer + " of klass: " + className) | |
if (className == "MSTextLayer") { |
OlderNewer