Skip to content

Instantly share code, notes, and snippets.

@jiaozhu
jiaozhu / placeholder
Last active August 29, 2015 14:21 — forked from oec2003/placeholder
/*! http://mths.be/placeholder v2.0.6 by @mathias */;
(function (g, i, d) {
var a = 'placeholder' in i.createElement('input'),
e = 'placeholder' in i.createElement('textarea'),
j = d.fn,
c = d.valHooks,
l, k;
if (a && e) {
k = j.placeholder = function () {
return this
@jiaozhu
jiaozhu / OSValidator.java
Created June 8, 2015 16:19
How to detect OS in Java
public class OSValidator {
private static String OS = System.getProperty("os.name").toLowerCase();
public static void main(String[] args) {
System.out.println(OS);
if (isWindows()) {
System.out.println("This is Windows");
@jiaozhu
jiaozhu / Str2MD5.java
Created June 17, 2015 11:47
Java 编程下字符串的 16 位、32位 MD5 加密
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Str2MD5 {
public static void main(String[] args) {
MD5("sunzn");
}
private static String MD5(String sourceStr) {
@jiaozhu
jiaozhu / QNUploader.swift
Created December 4, 2015 05:41
Upload images to Qiniu via multipart-form with Alamofire
//
// QNUploader.swift
//
// Created by Lex on 12/1/15.
//
import Foundation
import Alamofire
private let kCDNDomain = "__YOUR_QINIU_CDN_DOMAIN__"
import requests
def send_request():
# My API
# POST https://passport.hupu.com/pc/login/member.action
try:
response = requests.post(
url="https://passport.hupu.com/pc/login/member.action",
@jiaozhu
jiaozhu / oracleJDBCSetup
Created September 29, 2016 15:03 — forked from MonicaG/oracleJDBCSetup
Using Oracle with Spring Boot
If you do not have an oracle driver do steps 1 and 2 first. Otherwise skip to step 3.
1) Download the jdbc driver from oracle.
2) Install the driver into your local maven .m2 repository. Example:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.4 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true
In the above example the ojdbc6.jar version 11.2.0.4 is used. Replace the -DartifactId=ojdbc6 -Dversion=11.2.0.4 and -Dfile=ojdbc6.jar with the driver name/version you downloaded.
@jiaozhu
jiaozhu / AutowiringSpringBeanJobFactory.java
Created September 29, 2016 18:04 — forked from jelies/AutowiringSpringBeanJobFactory.java
Quartz (2.1.6) java config with spring (3.2.1). Using a SpringBeanJobFactory to automatically autowire quartz classes.
package com.jelies.spring3tomcat7.config.quartz;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
/**
* This JobFactory autowires automatically the created quartz bean with spring @Autowired dependencies.
@jiaozhu
jiaozhu / iterm2_badges.md
Created June 23, 2018 05:52 — forked from criaturaExperimental/iterm2_badges.md
Customizing badges for iTerm2

Customizing iTerm badges

There are two variables available to use in the badge field with

\(user.gitBranch) \n \(user.humpDay)
  • gitBranch shows the current branch the folder opened in the terminal is
  • humpDay shows an icon according to the date

This code goes into ~/.bash_profile

@jiaozhu
jiaozhu / lightdm-gtk-greeter.conf
Created December 22, 2018 14:51
lightdm-gtk-greeter.conf
[greeter]
background = /usr/share/pixmaps/wall.png
theme-name = Arc-Gruvbox
icon-theme-name = Adwaita
font-name = Source Code Pro 9
indicators = ~~Wythe's Arch Linux Box;~spacer;~clock;~spacer;~session;~power
clock-format = %Y %b %d (%a) %I:%M %p
@jiaozhu
jiaozhu / .Xresources
Last active December 24, 2018 02:28
Xresources 配置文件,依赖于 rxvt-unicode 及 urxvt-perls
!! The default colors are "Gruvbox":
*.color0: #1d2021
*.color1: #cc241d
*.color2: #98971a
*.color3: #d79921
*.color4: #458588
*.color5: #b16286
*.color6: #689d6a
*.color7: #a89984
*.color8: #928374