This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2013 readyState Software Ltd | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable). | |
* In the ghost bitmap, the RGB values take on the values from the 'color' argument, while | |
* the alpha values are derived from the source's grayscaled RGB values. The effect is that | |
* you can see through darker parts of the source bitmap, while lighter parts show up as | |
* the given color. The 'invert' argument inverts the computation of alpha values, and looks | |
* best when the given color is a dark. | |
*/ | |
private Bitmap createGhostIcon(Drawable src, int color, boolean invert) { | |
int width = src.getIntrinsicWidth(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
just highlight .selector-matches~ | |
screenshot: http://i.imgur.com/Do3BDTQ.png | |
ref: http://www.lostsaloon.com/technology/using-a-custom-stylesheet-in-a-web-browser/ | |
css file located on: | |
Mac: ~/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css | |
PC: C:\Users\[USER NAME]\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets\Custom.css | |
Ubuntu (Chromium): ~/.config/chromium/Default/User StyleSheets/Custom.css | |
(Google Chrome): ~/.config/google-chrome/Default/User StyleSheets/Custom.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.v4.app.Fragment; | |
public class FragmentUtils { | |
/** | |
* @param fragment | |
* The Fragment whose parent is to be found | |
* @param parentClass | |
* The interface that the parent should implement | |
* @return The parent of fragment that implements parentClass, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Country | CountryCode | Currency | Code | |
---|---|---|---|---|
New Zealand | NZ | New Zealand Dollars | NZD | |
Cook Islands | CK | New Zealand Dollars | NZD | |
Niue | NU | New Zealand Dollars | NZD | |
Pitcairn | PN | New Zealand Dollars | NZD | |
Tokelau | TK | New Zealand Dollars | NZD | |
Australian | AU | Australian Dollars | AUD | |
Christmas Island | CX | Australian Dollars | AUD | |
Cocos (Keeling) Islands | CC | Australian Dollars | AUD | |
Heard and Mc Donald Islands | HM | Australian Dollars | AUD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2013 Alex Curran | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.actionbarsherlock.app; | |
import android.app.Activity; | |
import android.support.v4.app.Watson.OnCreateOptionsMenuListener; | |
import android.support.v4.app.Watson.OnOptionsItemSelectedListener; | |
import android.support.v4.app.Watson.OnPrepareOptionsMenuListener; | |
import com.actionbarsherlock.app.SherlockFragmentActivity; | |
import com.actionbarsherlock.internal.view.menu.MenuItemWrapper; | |
import com.actionbarsherlock.internal.view.menu.MenuWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
from flaskext.wtf import Form, TextField, PasswordField, RecaptchaField, \ | |
AnyOf, NoneOf, Regexp, Email, Required, EqualTo, Recaptcha | |
from wtforms.validators import StopValidation | |
from flask import request, session | |
import model | |
# 身份證字號格式驗證 | |
def check_ID(form, field): | |
locations = dict(zip([c for c in 'ABCDEFGHJKLMNPQRSTUVXYWZIO'], range(10,36))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
""" | |
WTForms HTML5 Widgets | |
~~~~~~~~~~~~~~~~~~~~~ | |
This modul adds HTML5 widgets to WTForms_. | |
It supports the new INPUT types for fields and also sets some of the | |
new INPUT attributes automatically (based on widget type and what kind of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def customized(default=None, template=None): | |
def decorator(method): | |
@functools.wraps(method) | |
def wrapper(self, *args, **kargs): | |
self.template = default | |
if self.current_user: | |
self.template = template | |
return method(self, *args, **kargs) | |
return wrapper | |
return decorator |