Skip to content

Instantly share code, notes, and snippets.

View Mooophy's full-sized avatar
😏

Yue Wang Mooophy

😏
  • Auckland, New Zealand
View GitHub Profile
var UserDetail = $resource('/api/Users', null, {
'update': { method: 'PUT' }
});
UserDetail.update({
'UserId': 'b1d9d320-15cc-4d44-ad4d-9bd57d48ecd5',
'NickName': '王月'
}, function (data) {
console.log(data);
});
b = 99999;
function Foo() {
var a = 123;
this.a = 456;
(function () {
alert(a);
alert(this.a);
alert(this.b);
})();
<?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),
#include <string>
#include <iostream>
#include "dll.h"
#include "aes.h"
using CryptoPP::AES;
#include "modes.h"
using CryptoPP::CBC_Mode;
# 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)
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
/***************************************************************************
* @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?
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);
#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
#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);
}