Skip to content

Instantly share code, notes, and snippets.

Expression Utility Objects
Besides these basic objects, Thymeleaf will offer us a set of utility objects that will help us perform common tasks in our expressions.
#dates: utility methods for java.util.Date objects: formatting, component extraction, etc.
#calendars: analogous to #dates, but for java.util.Calendar objects.
#numbers: utility methods for formatting numeric objects.
#strings: utility methods for String objects: contains, startsWith, prepending/appending, etc.
#objects: utility methods for objects in general.
#bools: utility methods for boolean evaluation.
#arrays: utility methods for arrays.
@jfengq
jfengq / block.m
Last active April 21, 2016 14:22
//block声明
返回值类型 block名称 参数1及类型 参数2及类型
void (^blockName)(type argument1, type argument2)
//block定义
void ^(type argument1, type argument2){
//do something
}
//注意block中的循环引用,在block中如果出现对block持有者的强引用,会导致内存泄露。此时应使用__weak修饰变量。
//copy公钥到指定主机,以使得可以通过ssh命令登录该主机
ssh-copy-id -i ~/.ssh/id_rsa.pub user@server
//ssh登录某主机
ssh root@server
Open a command prompt as administrator and paste the following to install chocolatey:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
Install vcredist2010 using the following command (again, as administrator):
choco install -y vcredist2010
server {
server_name domainname.com www.domainname.com;
root /var/www/;
listen 80;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
ALTER TABLE ADM_TYPE_TARGET MODIFY TARGET_NAME VARCHAR(20) CHARACTER SET utf8;
@jfengq
jfengq / vagrant_mysql_config.txt
Created June 18, 2016 07:38
connect mysql outside vagrant box
1.修改vagrant配置文件
Vagrant.configure(2) do |config|
...
config.vm.network "forwarded_port", guest: 3306, host: 3306
...
end
2.修改vagrant box中mysql配置文件
sudo sed -i 's/bind-address.*/bind-address = 0.0.0.0/' /etc/mysql/my.cnf sudo service mysql restart
@jfengq
jfengq / gitcheats.txt
Created June 24, 2016 09:10 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# get list of followers from github username
curl -s https://api.github.com/users/username/followers | grep '\"login\"' | sed -e's/[,|"|:]//g' | awk '{print $(NF)}' | sort
# git commit random alias
git config --global alias.commit-random '!git commit -m "$(curl -s http://whatthecommit.com/index.txt)"'
usage: git commit-random
(function() {
'use strict';
function removeAds () {
document.getElementById('ad') && document.getElementById('ad').remove();
document.getElementById('advertisement') && document.getElementById('advertisement').remove();
}
removeAds();