Skip to content

Instantly share code, notes, and snippets.

View iraycd's full-sized avatar
🎯
Focusing

Ray Ch iraycd

🎯
Focusing
View GitHub Profile
@SeniorZhai
SeniorZhai / CommonUtils.java
Created September 2, 2014 03:18
通用工具类
public class CommonUtils {
private static NetworkInfo getNetworkInfo(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetWorkInfo();
}
// 是否存在网络
public static boolean isNetworkAvailable(Context context) {
NetworkInfo info = getNetworkInfo(context);
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@epicserve
epicserve / ubuntu-server-django-guide.rst
Last active June 9, 2023 00:38
Ubuntu Server Setup Guide for Django Websites