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 UserDetail = $resource('/api/Users', null, { | |
'update': { method: 'PUT' } | |
}); | |
UserDetail.update({ | |
'UserId': 'b1d9d320-15cc-4d44-ad4d-9bd57d48ecd5', | |
'NickName': '王月' | |
}, function (data) { | |
console.log(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
b = 99999; | |
function Foo() { | |
var a = 123; | |
this.a = 456; | |
(function () { | |
alert(a); | |
alert(this.a); | |
alert(this.b); | |
})(); |
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 | |
date_default_timezone_set ("Pacific/Auckland"); | |
$url = 'https://wholesale.layer2.co.nz/api/login'; | |
$content = array('username' => 'omnitech.b2b', 'password' => 'Omnit3ch1119'); | |
$options = array( | |
'http' => array( | |
'header' => "Content-type: application/x-www-form-urlencoded\r\n} ", | |
'method' => 'POST', | |
'content' => http_build_query($content), |
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 <string> | |
#include <iostream> | |
#include "dll.h" | |
#include "aes.h" | |
using CryptoPP::AES; | |
#include "modes.h" | |
using CryptoPP::CBC_Mode; |
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
# from https://leetcode.com/problems/range-sum-query-immutable/ | |
class NumArray(object): | |
def __init__(self, nums): | |
self.sums = [] | |
sum = 0 | |
for num in nums: | |
sum += num | |
self.sums.append(sum) | |
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
np.percentile([1,2,3,4,5,6,7,8,9,10], 50) | |
#5.5 | |
np.percentile([1,2,3,4,5,6,7,8,9,10], 25) | |
#3.25 | |
np.percentile([1,2,3,4,5,6,7,8,9,10], 75) | |
#7.75 |
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
/*************************************************************************** | |
* @file main.cpp | |
* @author Alan.W | |
* @date 11 Mar 2014 | |
* @remark This code is for the exercises from C++ Primer 5th Edition | |
* @note | |
***************************************************************************/ | |
//! | |
//! Exercise 18.1: | |
//! What is the type of the exception object in the following throws? |
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 optval = 1; | |
setsockopt(soc, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval); | |
auto bind_result = bind(soc, (struct sockaddr *)&my_addr, sizeof(my_addr)); | |
if (bind_result != 0) | |
printf("%d\n", errno); |
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 <stdlib.h> | |
#include <pthread.h> | |
#define NUM_THREADS 1 | |
// The function executed by each thread | |
void *PrintHello(void *threadid) | |
{ | |
// Print greeting with thread ID info |
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 <iostream> | |
#include <vector> | |
#include <tuple> | |
#include <algorithm> | |
std::pair<int, int> max_min(int lhs, int rhs) | |
{ | |
return lhs > rhs ? std::make_pair(lhs, rhs) : std::make_pair(rhs, lhs); | |
} |