Skip to content

Instantly share code, notes, and snippets.

View akayj's full-sized avatar
:octocat:

Jian Yu akayj

:octocat:
  • Shanghai, China
  • 15:04 (UTC +08:00)
View GitHub Profile
@akayj
akayj / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@akayj
akayj / ReadNumber.c
Created March 10, 2014 05:33
Read number from command line, ignore char.
#include <stdio.h>
int main(int argc, char *argv[])
{
int input_var = 0;
int count;
do {
printf("Enter a number (-1 = quit): ");
count = scanf("%d", &input_var);
@akayj
akayj / my_strcpy.c
Last active August 29, 2015 13:56
strcpy from scratch
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *my_strcpy(char *strDest, const char *strSrc)
{
if (strSrc == NULL || strDest == NULL)
return NULL;
char *dest = strDest;
@akayj
akayj / Lgz.js
Last active September 28, 2015 11:08
Logging for JavaScript
var Lgz = function(lgStr) {
var fn, msg, console = window.console || null;
var splitPos = lgStr.indexOf(':'), len = lgStr.length;
var fnMap = {
'i' : 'info',
'e' : 'error',
'w' : 'warn',
'l' : 'log'