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
jQuery('a').click(function(e){ | |
var url = jQuery(this).attr('href'); | |
if (!/^([javascript]|[mailto])/.test(url)){ | |
e.preventDefault(); | |
location=url+location.search+location.hash; | |
} | |
}); |
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
//1~4 | |
for (var i=1; i<5; ++i){ | |
$('#menu_'+i).click(function(){ | |
$('#tab_'+$(this).attr('id').split('_')[1]).trigger('click'); | |
}); | |
} |
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(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'YOUR-GA-CODE', 'auto'); | |
ga('require', 'displayfeatures'); | |
ga('send', 'pageview'); | |
$(document).ready(function() { | |
page_id = $('body').attr('data-tracking-id'); | |
page_type = $('body').attr('data-tracking-type'); | |
ga('send', 'event', 'page', page_id, 'total-view'); |
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
/** | |
* Auto-generated code below aims at helping you parse | |
* the standard input according to the problem statement. | |
* --- | |
* Hint: You can use the debug stream to print initialTX and initialTY, if Thor seems not follow your orders. | |
**/ | |
var inputs = readline().split(' '); | |
var lightX = parseInt(inputs[0]); // the X position of the light of power | |
var lightY = parseInt(inputs[1]); // the Y position of the light of power |
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
#include <stdio.h> | |
#include <sys/types.h> | |
#include <ifaddrs.h> | |
#include <netinet/in.h> | |
#include <string.h> | |
#include <arpa/inet.h> | |
int main (int argc, const char * argv[]) { | |
struct ifaddrs * ifAddrStruct=NULL; | |
struct ifaddrs * ifa=NULL; |
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
#!/bin/bash | |
ip=`ip -4 route get 1 | head -1 | cut -d' ' -f8 | tr -d '\n'` | |
now=`date` | |
printf -v data '{"IP":"%s","UpdatedAt":"%s"}' $ip "$now" | |
curl -X PATCH -d "$data" 'http://path.to/server/log' |
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 | |
$reqMethod = getenv('REQUEST_METHOD'); | |
$reqIP = filter_var(getenv('HTTP_CLIENT_IP'), FILTER_VALIDATE_IP) ? getenv('HTTP_CLIENT_IP') : (filter_var(getenv('HTTP_X_FORWARDED_FOR'), FILTER_VALIDATE_IP) ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR')); | |
$salt = "Only_U_Know_Me: {$reqIP} in ".round(time() / 604800, 0); | |
$clientKey = md5($salt); | |
$expires = gmdate("l, d-M-Y H:i:s T", time() + 604800); // 7 days | |
if (strtoupper($reqMethod) == 'POST' /*&& EXCLUDE API URL REQUEST*/) { | |
if (!isset($_COOKIE[$clientKey])){ | |
exit(); |
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 | |
function sms_api($username,$password,$dest_addr,$text_str){ | |
$api_host = 'http://202.39.48.216/kotsmsapi-1.php'; | |
if ( $text_str=='' || !preg_match("/^[0-9]{10}$/", $dest_addr) || $username=='' || $password=='' ){ | |
return 'ERROR Params.'; | |
} | |
$data = array( | |
'username'=>$username, | |
'password'=>$password, | |
'dstaddr'=>$dest_addr, |
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
#!/bin/bash | |
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash | |
chmod +x ~/.git-completion.bash | |
. ~/.git-completion.bash | |
echo 'if [ -f ~/.git-completion.bash ]; then' >> ~/.bash_profile | |
echo ' . ~/.git-completion.bash' >> ~/.bash_profile | |
echo 'fi' >> ~/.bash_profile |
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 | |
//修正管理後台頁尾顯示 | |
function dashboard_footer_design() { | |
echo 'Design by <a href="https://www.mxp.tw">Mxp</a>'; | |
} | |
add_filter('admin_footer_text', 'dashboard_footer_design'); | |
//修正管理後台頁尾顯示 | |
function dashboard_footer_developer() { | |
echo '<br/><span id="footer-thankyou">Developed by <a href="http://www.mxp.tw">Mxp</a></span>'; |