This file contains hidden or 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
class MyLogger | |
private_class_method :new | |
@@logger = nil | |
def MyLogger.create | |
@@logger = new unless @@logger | |
@@logger | |
end | |
end | |
=begin |
This file contains hidden or 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
//16 进制转 10 进制 | |
#include <stdio.h> | |
int strlen(char[]); | |
int htoi(char[]); | |
int pow(int, int); | |
int main() { | |
char s[] = "1.00"; |
This file contains hidden or 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
//超过 80 个字符自动折行。 | |
//折行位置为最近的一个空格,如果没有空格,则从连续文本中断开,加上连字符。 | |
#define MAXLENGTH 80 | |
void newline(); | |
void printArray(char arr[], int pos); | |
int main(char args[]) { | |
newline(); |
This file contains hidden or 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
//escape 与 unescape,针对 \n 与 \t 做转义或逆操作。 | |
#include <stdio.h> | |
void escape(char[], char[]); | |
void unescape(char[], char[]); | |
int strlen(char[]); | |
int main() { |
This file contains hidden or 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> | |
char s[100]; | |
int i = 0; | |
void itoa(int); | |
void itoa(int d) { | |
int tmp; | |
if(d == 0) { |
This file contains hidden or 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
//部分程序来自于上一章节 | |
//getfloat:将字符串转换成 float | |
#include <stdio.h> | |
#include <ctype.h> | |
#include "calc.h" | |
int getch(void); | |
void ungetch(int); | |
int getfloat(double *); |
This file contains hidden or 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
// http://www.paulirish.com/2009/random-hex-color-code-snippets/#comment-931662323 | |
(Math.random().toString(16) + '000000').slice(2, 8); | |
//=============================== Cursor's position ============================= | |
var editable = document.getElementById('editable'), | |
selection, range; | |
// Populates selection and range variables | |
var captureSelection = function(e) { |
This file contains hidden or 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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; |
This file contains hidden or 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
//http://codeforces.com/problemset/problem/1/B | |
var min = 64; | |
function convertNumToStr(num) { | |
console.log(num) | |
if(num <= 0) throw Error('Number must be greater than 0.'); | |
var result = 27; | |
var remain; |
This file contains hidden or 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 fs = require('fs'), | |
through = require('through2'), | |
uglify = require('uglify-js'); | |
var BASE = './script-ss/', | |
DEST = './script-min/', | |
SPECIAL_TAG = '/*common*/'; | |
var modules = []; |
OlderNewer