minimal example of using [phantomjs] with [qunit]
$ phantomjs run-qunit.js file://`pwd`/test.html
'waitFor()' finished in 200ms.
Tests completed in 21 milliseconds.
5 tests of 5 passed, 0 failed.
urlencode() { | |
# urlencode <string> | |
old_lc_collate=$LC_COLLATE | |
LC_COLLATE=C | |
local length="${#1}" | |
for (( i = 0; i < length; i++ )); do | |
local c="${1:$i:1}" | |
case $c in |
# Setting up dnsmasq for Local Web Development Testing on any Device | |
Please note, these instructions are for OS X Lion. | |
First, you need to get the IP address of your machine on your local network. In OS X, the easiest place to find this is in System Preferences > Network. If you're using DHCP on your local network, you will want to make sure your computer requests the same IP address when it renews it's IP address lease. I recommend configuring the DCHP Reservation settings on your router to accomplish this. Otherwise, you can specify a manual address in your network settings: | |
1. Go to *System Preferences > Network* | |
1. Click *Advanced...* |
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
<? | |
class Lock { | |
const TIMEOUT = 20; | |
const SLEEP = 100000; | |
/** | |
* Stores the expire time of the currently held lock | |
* @var int |
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="Application" default="build" basedir="../"> | |
<target name="build" depends="prepare,phpunit,phpmd,phpcpd,phpdoc,phpcb,phpdcd,phploc,phpcs"/> | |
<property name="applicationDir" value="${basedir}/source" /> | |
<property name="buildDir" value="${basedir}/build" /> | |
<target name="prepare"> | |
<mkdir dir="${buildDir}/logs" /> |
# This is draft version | |
# so code is ugly | |
# Possible todos: | |
* Code cleanup :) | |
* Accept filenames from command lines | |
* Create new file from date | |
* Create missing Trackpoints (for location based sports, like swimming) | |
* Refactor merge (do believe it might go slow on long distance run) | |
* Update sport name in file |
location /aaa/ { | |
# internal; | |
set $upstream ""; | |
set $referer ""; | |
set $ref $arg_ref; | |
set $url $arg_url; | |
set $tohost ""; | |
set $newuri ""; | |
# add_header Content-Type text/plain; |
import ( | |
"fmt" | |
"net/http" | |
"time" | |
) | |
const transPixel = "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B" | |
func pixelHandler(w http.ResponseWriter, r *http.Request) { | |
// Pixel |