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 | |
/* | |
* search app 建立資料 | |
* 說明: | |
* | |
* 執行 `patch/search_app_add.php` | |
* php patch/search_app_add.php | |
* | |
* 清除 | |
* php search_app_add.php clear |
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
// TODO: complete this object/class | |
// http://www.codewars.com/kata/515bb423de843ea99400000a/train/javascript | |
// The constructor takes in an array of items and a integer indicating how many | |
// items fit within a single page | |
function PaginationHelper(collection, itemsPerPage){ | |
this.items = collection; | |
this.itemsPerPage = itemsPerPage; | |
} |
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.onConsoleMessage = function(msg) { | |
console.log(msg); | |
}; | |
page.open("https://www.facebook.com", function(status) { | |
if ( status === "success" ) { | |
page.evaluate(function() { |
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(); | |
var fillLoginInfo = function(){ | |
var frm = document.getElementById("login_form"); | |
frm.elements["email"].value = 'your fb email/username'; | |
frm.elements["pass"].value = 'password'; | |
frm.submit(); | |
} | |
page.onLoadFinished = function(){ |
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> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var w= document.documentElement.clientWidth || document.body.clientWidth; | |
var h= document.documentElement.clientHeight || document.body.clientHeight; | |
document.write("Width:"+w+"<br>"+"Height:"+h) |
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 | |
$number = 2; | |
$str = "Shanghai"; | |
$txt = sprintf("There are %u million cars in %s.",$number,$str); | |
echo $txt; | |
?> |
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 vehicle1 = {type: "Motorboat", capacity: 6, storedAt: "Ammunition Depot"}; | |
var vehicle2 = {type: "Jet Ski", capacity: 1, storedAt: "Reef Dock"}; | |
var vehicle3 = {type: "Submarine", capacity: 8, storedAt: "Underwater Outpost"}; | |
var vehicles = [vehicle1, vehicle2, vehicle3]; | |
var findVehicle = function (name, list){ | |
for(var i = 0; i<list.length; i++){ | |
if(list[i].type == name){ | |
return list[i].storedAt; | |
} |
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
<style id="jsbin-css"> | |
.spinner { | |
margin: 100px auto; | |
width: 20px; | |
height: 20px; | |
position: relative; | |
} | |
.container1 > div, .container2 > div, .container3 > div { | |
width: 6px; |
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
pollingLoop(); | |
function pollingLoop(){ | |
var cp = require('child_process'); | |
var child = cp.fork('./worker'); | |
var num = Math.floor((Math.random() * 100) + 1); | |
child.on('message', function(m) { |
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
<html> | |
<head> | |
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> | |
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400;300' rel='stylesheet' type='text/css'> | |
<link href='style.css' rel='stylesheet'> | |
<style id="jsbin-css"> | |
/* Initial body */ | |
body { | |
left: 0; |