Skip to content

Instantly share code, notes, and snippets.

View Nicksxs's full-sized avatar
🤔
boring

Nicksxs Nicksxs

🤔
boring
View GitHub Profile
//当月初始时间
$beginThisMonth = date("Y-m-d H:i:s", mktime(0, 0, 0, date('m'), 1, date('Y')));
//当月结束时间
$endThisMonth = date("Y-m-d H:i:s", mktime(23, 59, 59, date('m'), date('t'), date('Y')));
@Nicksxs
Nicksxs / fileupload.html
Last active September 2, 2015 01:20
ajax simulate form contain file to submit
<script type="text/javascript">
$(document).ready(function () {
$('#form1').submit(function () {
var formdata = new FormData();
var fileObj = document.getElementById("fileToUpload2").files;
for (var i = 0; i < fileObj.length; i++)
formdata.append("file" + i, fileObj[i]);
$.ajax({
type: 'POST',
url: '/Home/Upload2',
<?php
function crypto_rand_secure($min, $max)
{
$range = $max - $min;
if ($range < 0) return $min; // not so random...
$log = log($range, 2);
$bytes = (int)($log / 8) + 1; // length in bytes
$bits = (int)$log + 1; // length in bits
$filter = (int)(1 << $bits) - 1; // set all lower bits to 1
do {
@Nicksxs
Nicksxs / 0_reuse_code.js
Last active August 29, 2015 14:21
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