CPU: E3-1230 V3 散片 ¥1349
显卡: 技嘉 GV-N760OC-2GD ¥1699
主板: 技嘉 GA-B85M-DS3H ¥379
内存: 金士顿骇客神条 8G DDR3 ¥445
<?php | |
function print_vars() { | |
$vars = func_get_args(); | |
echo '<pre>'; | |
foreach ($vars as $var) { | |
ob_start(); | |
var_dump($var); | |
echo htmlspecialchars(ob_get_clean()); | |
} | |
echo '</pre>'; |
import time | |
from math import ceil | |
def time2duration(stamp): | |
# 对当前时间向上取整,防止出现负数~ | |
stamp = int(ceil(stamp)) | |
cur_time = int(ceil(time.time())) | |
during = cur_time - stamp | |
if during < 30: |
def upper2lower(string): | |
string1 = '' | |
start = 0 | |
for m in re.finditer('[A-Z]', string): | |
if m.start() != 0: | |
string1 += string[start+1:m.start()] + '_' + m.group(0).lower() | |
else: | |
string1 += string[start:m.end()].lower() | |
start = m.start() | |
string1 += string[start+1:] |
def is_ajax(request): | |
try: | |
if request.META['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest': | |
return True | |
else: | |
return False | |
except KeyError: | |
return False |
import bcrypt | |
def generate_password(str): | |
return bcrypt.hashpw(str, bcrypt.gensalt()) | |
def check_password(str, stored_hash): | |
hash_check = bcrypt.hashpw(str, stored_hash) | |
return hash_check == stored_hash |
jQuery.fn.filterByText = function(textbox, selectSingleMatch) { | |
return this.each(function() { | |
var select = this; | |
var options = []; | |
$(select).find('option').each(function() { | |
options.push({value: $(this).val(), text: $(this).text(), disabled:$(this).is(':disabled')}); | |
}); | |
$(select).data('options', options); | |
$(textbox).bind('change keyup', function() { | |
var options = $(select).empty().scrollTop(0).data('options'); |
from __future__ import with_statement | |
import signal, time | |
from contextlib import contextmanager | |
def long_function_call(): | |
while True: | |
if time.time() % 1 == 0: | |
print '*' | |
class TimeoutException(Exception): pass |
#!/bin/bash | |
# install depends | |
apt-get update && apt-get install -y aria2 libxml2 libxml2-dev libssl-dev pkg-config curl libcurl4-nss-dev enchant libenchant-dev libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libvpx1 libvpx-dev libfreetype6 libfreetype6-dev libt1-5 libt1-dev libgmp10 libgmp-dev libicu-dev mcrypt libmcrypt4 libmcrypt-dev libpspell-dev libedit2 libedit-dev libsnmp-dev libxslt1.1 libxslt1-dev autoconf make g++ python-software-properties git redis-server | |
# download php & install | |
aria2c http://jp1.php.net/distributions/php-5.5.13.tar.gz | |
aria2c http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.2/phpMyAdmin-4.2.2-all-languages.tar.gz | |
tar -xf phpMyAdmin-4.2.2-all-languages.tar.gz | |
mkdir /var/htdocs | |
mv phpMyAdmin-4.2.2-all-languages /var/htdocs/pma |
<?php | |
/** | |
* An helper file for Laravel 4, to provide autocomplete information to your IDE | |
* Generated for Laravel 4.2.8 on 2014-08-26. | |
* | |
* @author Barry vd. Heuvel <[email protected]> | |
* @see https://github.com/barryvdh/laravel-ide-helper | |
*/ | |
namespace { |