Skip to content

Instantly share code, notes, and snippets.

View lmeerwood's full-sized avatar

Leonard Meerwood lmeerwood

View GitHub Profile
@leewinder
leewinder / password-check.service.ts
Created August 30, 2016 10:33
Typescript object for checking password strength
// Password strengths
export const enum PasswordCheckStrength {
Short,
Common,
Weak,
Ok,
Strong,
};
// Object to check password strengths and various properties
@cmelchior
cmelchior / CustomTypeAdapter.java
Created April 9, 2015 06:35
Realm, GSON and primitive JSON arrays
// Make a custom Gson instance, with a custom TypeAdapter for each wrapper object.
// In this instance we only have RealmList<RealmInt> as a a wrapper for RealmList<Integer>
Type token = new TypeToken<RealmList<RealmInt>>(){}.getType();
Gson gson = new GsonBuilder()
.setExclusionStrategies(new ExclusionStrategy() {
@Override
public boolean shouldSkipField(FieldAttributes f) {
return f.getDeclaringClass().equals(RealmObject.class);
}
@daviddoran
daviddoran / backup-dokuwiki.sh
Created September 24, 2013 10:40
Easily back up the content of a dokuwiki site to a git repository each hour. Only commits when there are changes.
#!/bin/sh
cd /var/www/dokuwiki/data && git add . && git add -u && git commit -a -m "Content update `date +'%H:%M %d/%m/%Y %Z'`" && git push origin master