-
Open a browser
# start an instance of firefox with selenium-webdriver $browser_type = 'firefox' $host = 'http://localhost:4444/wd/hub'
$capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => $browser_type);
sudo kill -9 `sudo ps -ef | grep php-fpm | grep -v grep | awk '{print $2}'` | |
ps -A | grep php-fpm | awk '{print $1}' | xargs kill -9 $1 |
# GOROOT is the location where Go package is installed on your system | |
export GOROOT=/usr/lib/golang | |
# GOPATH is the location of your work directory | |
export GOPATH=$HOME/go | |
# PATH in order to access go binary system wide | |
export PATH=$PATH:$GOROOT/bin |
sass-convert -F scss -T sass application_styles.css.scss application_styles.css.sass |
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: caddy | |
# Required-Start: $local_fs $network $named $time $syslog | |
# Required-Stop: $local_fs $network $named $time $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the caddy web server | |
# Description: starts caddy using start-stop-daemon | |
### END INIT INFO |
#!/bin/bash | |
# Hosted Zone ID e.g. BJBK35SKMM9OE | |
ZONEID="enter zone id here" | |
# The CNAME you want to update e.g. hello.example.com | |
RECORDSET="enter cname here" | |
# More advanced options below | |
# The Time-To-Live of this recordset |
/** | |
* $.unserialize | |
* | |
* Takes a string in format "param1=value1¶m2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array. | |
* | |
* Example: | |
* | |
* Input: param1=value1¶m2=value2 | |
* Return: { param1 : value1, param2: value2 } | |
* |
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit | |
colors="true" | |
stopOnFailure="false" | |
backupGlobals="false" | |
backupStaticAttributes="false" | |
convertErrorsToExceptions="true" | |
convertNoticesToExceptions="true" | |
convertWarningsToExceptions="true" |
// Author - Santosh Rajan | |
import Foundation | |
let string = "{\"name\": \"John\", \"age\": 35, \"children\": [\"Jack\", \"Jill\"]}" | |
func JSONParseDictionary(jsonString: String) -> [String: AnyObject] { | |
if let data = jsonString.dataUsingEncoding(NSUTF8StringEncoding) { | |
if let dictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions(0), error: nil) as? [String: AnyObject] { | |
return dictionary |
//npm install b64url | |
//A signed_request for testing: | |
//WGvK-mUKB_Utg0l8gSPvf6smzacp46977pTtcRx0puE.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyOTI4MjEyMDAsImlzc3VlZF9hdCI6MTI5MjgxNDgyMCwib2F1dGhfdG9rZW4iOiIxNTI1NDk2ODQ3NzczMDJ8Mi5ZV2NxV2k2T0k0U0h4Y2JwTWJRaDdBX18uMzYwMC4xMjkyODIxMjAwLTcyMTU5OTQ3NnxQaDRmb2t6S1IyamozQWlxVldqNXp2cTBmeFEiLCJ1c2VyIjp7ImxvY2FsZSI6ImVuX0dCIiwiY291bnRyeSI6ImF1In0sInVzZXJfaWQiOiI3MjE1OTk0NzYifQ | |
function parse_signed_request(signed_request, secret) { | |
encoded_data = signed_request.split('.',2); | |
// decode the data | |
sig = encoded_data[0]; | |
json = base64url.decode(encoded_data[1]); | |
data = JSON.parse(json); // ERROR Occurs Here! |