An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
function get(uri) { | |
return http(uri,'GET'); | |
} | |
function post(uri,data) { | |
if(typeof data === 'object' && !(data instanceof String || (FormData && data instanceof FormData))) { | |
var params = []; | |
for(var p in data) { | |
if(data[p] instanceof Array) { | |
for(var i = 0; i < data[p].length; i++) { | |
params.push( encodeURIComponenet(p) + '[]=' + encodeURIComponenet(data[p][i]); |
#include <vector> | |
#include <assert.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
typedef int32_t Score; | |
typedef int32_t UserId; | |
typedef int32_t Rank; | |
const Score kInvalidScore = -1; |
#!/bin/bash | |
function remove_dir () { | |
rm -rf "$1_" | |
if [ -d "$1" ] | |
then | |
mv "$1" "$1_" | |
fi | |
} |
using System; | |
using System.Globalization; | |
using System.IO; | |
namespace TestStringFormatPerformance | |
{ | |
public class CorrectnessTester<T> where T : ITextWriterUtils, new() | |
{ | |
public void Test() |
// | |
// JSON.swift | |
// | |
// | |
// Created by ZHANG Yi on 2015-9-1. | |
// | |
// The MIT License (MIT) | |
// | |
// Copyright (c) 2015 ZHANG Yi <zhangyi.cn@gmail.com> | |
// |
#include <cassert> | |
#include <iostream> | |
#include <vector> | |
#include <type_traits> | |
// http://www.embedded.com/electronics-blogs/programmer-s-toolbox/4219659/Integer-Square-Roots | |
uint32_t isqrt0(uint32_t n) { | |
uint32_t delta = 3; | |
for (uint32_t square = 1; square <= n; square += delta) |
Author: Chris Lattner