Skip to content

Instantly share code, notes, and snippets.

View strongant's full-sized avatar

strongant strongant

View GitHub Profile
@strongant
strongant / 0_reuse_code.js
Created May 11, 2016 02:35
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
// logger = require('logger');
// logger.log_to_console(true);
// logger.log_to_folder('log','_app.log');
// logger.set_log_level('DEBUG');
// logger.info('Happy to be here.');
exports.logger = (function() {
var that = {};
that.levels = {
"TRACE": 0,
"DEBUG": 1,
select abs(extract (epoch from (age('2015-01-15 14:00:00','2015-01-15 14:00:00')))) from task where "taskId"='1';
package com.test;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
try {
//String sourcePath="https://gist.githubusercontent.com/CootCraig/6186298/raw/26fb35a849fac60cb3653e9b8b9877af5ce39f66/logger.js";
//readHtmlFile(sourcePath);
FileInputStream fs = new FileInputStream("/home/devbwh/IdeaProjects/test/src/1.txt");
byte[] buffer = new byte[1024];
int content;
while ((content = fs.read()) != -1) {
// convert to char and display it
System.out.print((char) content);
}
@strongant
strongant / setHeadersAjax.js
Created May 23, 2016 08:42
jquery设置请求头并且发送
$.ajax({
accepts: {
"content-type": 'application/json'
},
url: 'http://127.0.0.1:3000/todos',
type: 'post',
data: {
"data": response
},
cache: false,
@strongant
strongant / app.js
Created May 23, 2016 08:45
express4中使用body-parser通过post请求,默认接收10kb,修改默认值
//调整express默认允许的大小
app.use(bodyParser.json({
limit: '1024mb'
}));
app.use(bodyParser.urlencoded({
limit: '1024mb',
extended: true
}));
var app = angular.module('materializeApp', ['ui.materialize'])
.controller('BodyController', ["$scope", function ($scope) {
$scope.select = {
value: "Option1",
choices: ["Option1", "I'm an option", "This is materialize", "No, this is Patrick."]
};
}]);
@strongant
strongant / jetbrick.print.js
Created November 21, 2016 01:52 — forked from subchen/jetbrick.print.js
JavaScript 实现打印功能(只打印网页中的一部分)
(function(window, $) {
/**
* 实现打印功能(只打印网页中的一部分)
*
* Usage:
* <button jw-click-print="#printContext">Print</button>
*/
var print = function($dom) {
$("iframe.js-print").remove();
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.heitian.web</groupId>
<artifactId>web-ssm</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>web-ssm Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>