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
protected function _convert_date_to_sql_date($date) | |
{ | |
$date = substr($date,0,10); | |
if(preg_match('/\d{4}-\d{2}-\d{2}/',$date)) | |
{ | |
//If it's already a sql-date don't convert it! | |
return $date; | |
}elseif(empty($date)) | |
{ | |
return ''; |
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
#!/bin/sh | |
#CÒPIA DE SEGURETAT BASE DE DADES MEDIAWIKI | |
# First clean files older than 20 days: http://acacha.org/mediawiki/index.php/Tmpwatch | |
tmpreaper --verbose 20d /linux2/backups/mysql | |
inici=`date` | |
dia=`date "+%Y%m%d"` | |
mysql_backups_folder="/linux2/backups/mysql" | |
echo "##################################################################################" | |
echo "Executant còpia de base de dades (mysqldump) de mediawiki. Inici: $inici" | |
echo "##################################################################################" |
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
private static boolean isConnected(Context context) { | |
ConnectivityManager connectivityManager = (ConnectivityManager) | |
context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo networkInfo = null; | |
if (connectivityManager != null) { | |
networkInfo = | |
connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); | |
} | |
return networkInfo == null ? false : networkInfo.isConnected(); | |
} |
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
public String computeMD5Hash(String password){ | |
StringBuffer MD5Hash = new StringBuffer(); | |
try { | |
// Create MD5 Hash | |
MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); | |
digest.update(password.getBytes()); | |
byte messageDigest[] = digest.digest(); |
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
private static OkHttpClient getUnsafeOkHttpClient() { | |
try { | |
// Create a trust manager that does not validate certificate chains | |
final TrustManager[] trustAllCerts = new TrustManager[] { | |
new X509TrustManager() { | |
@Override | |
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { | |
} | |
@Override |
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
/* Sergi Tur Badenas | |
* http://acacha.org/sergitur | |
* See http://acacha.org/mediawiki/index.php/Android_AccountManager | |
* for more info | |
*/ | |
import android.accounts.Account; | |
import android.accounts.AccountManager; | |
import android.content.Context; |
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
private void debugIntent(Intent intent, String tag) { | |
Log.v(tag, "action: " + intent.getAction()); | |
Log.v(tag, "component: " + intent.getComponent()); | |
Bundle extras = intent.getExtras(); | |
if (extras != null) { | |
for (String key: extras.keySet()) { | |
Log.v(tag, "key [" + key + "]: " + | |
extras.get(key)); | |
} | |
} |
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
_composer() | |
{ | |
local cur=${COMP_WORDS[COMP_CWORD]} | |
local cmd=${COMP_WORDS[0]} | |
if ($cmd > /dev/null 2>&1) | |
then | |
COMPREPLY=( $(compgen -W "$($cmd list --raw | cut -f 1 -d " " | tr "\n" " ")" -- $cur) ) | |
fi | |
} | |
complete -F _composer composer |
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
public function getPermissionNameSuffix(Model $model) { | |
return strtolower((new ReflectionClass($model))->getShortName()); | |
} |
OlderNewer