Skip to content

Instantly share code, notes, and snippets.

<activity android:name="MainActivity">
<!-- This activity is the main entry, should appear in app launcher -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="ShareActivity">
<!-- This activity handles "SEND" actions with text data -->
<?php
App::uses('AppException', 'Lib');
App::uses('ErrorHandler', 'Error');
class AppErrorHandler extends ErrorHandler {
public static function handleException(Exception $exception) {
if ($exception instanceof AppException) {
$element = 'default';
$message = $exception->getMessage();
<?php
App::uses('AppException', 'Lib/Exception');
App::uses('ErrorHandler', 'Error');
class AppErrorHandler extends ErrorHandler {
public static function handleException(Exception $exception) {
if ($exception instanceof AppException) {
$element = 'default';
$message = $exception->getMessage();
@simkimsia
simkimsia / ubuntu14.04-rails4.sh
Last active August 29, 2015 14:01
preparing a fresh 14.04 ubuntu for rails 4
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
#
# Ubuntu 14.04 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 14.04 server:
#
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/simkimsia/0fe0a5eb9c7504ead53c/raw/58438c9a7c132be94fe5d6687b6f9623968b927f/ubuntu14.04-rails4.sh)" <mysqlPassword>
@simkimsia
simkimsia / Quiz3Q4.r
Last active August 29, 2015 14:02
working for two grouped means t-test
##Q4
## Refer to the setting of the previous question.
## To further test the system,
## administrators selected 20 nights and
## randomly assigned the new triage system to be used on
## 10 nights and the standard system on the remaining 10 nights.
## They calculated the nightly median waiting time (MWT) to see
## a physician. The average MWT for the new system was
## 3 hours with a variance of 0.60 while
## the average MWT for the
@simkimsia
simkimsia / stringformat.js
Created July 1, 2014 09:17
javascript function that helps convert javascript number into a nice format with the function niceFormat for thousand separator, negative uses () etc
if (!Number.prototype.niceFormat) {
Number.prototype.niceFormat = function(options) {
var defaultOptions = {
thousandSeparator: ',',
leftPad: 0,
decimalPlaces: 2,
negative: '()'
};
var env = defaultOptions;
if (typeof options != 'undefined') {
@simkimsia
simkimsia / explanation.txt
Last active August 29, 2015 14:06
what is properly namespaced JSON response?
1. I thought namespaced means you need to have the name of the record as the key.
2. If I misunderstood, please feel free to correct me.
3. When you say namespace, do you mean that the namespace is the "data" key?
@simkimsia
simkimsia / install-cake3-ubuntu-14-04.sh
Last active August 29, 2015 14:07
preparing fresh 14.04 ubuntu install for cake 3
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
#
# Ubuntu 14.04 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 14.04 server:
#
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/simkimsia/4a3808cd109dbd1a3913/raw/d0a9799cdbf0857043b7b59a489361388c09fc4a/install-cake3-ubuntu-14-04.sh)" <mysqlPassword>
@simkimsia
simkimsia / OAuth2SecurityConfiguration.java
Created October 26, 2014 15:49
code sample for OAuth2SecurityConfiguration
@Configuration
public class OAuth2SecurityConfiguration {
// This first section of the configuration just makes sure that Spring Security picks
// up the UserDetailsService that we create below.
@Configuration
@EnableWebSecurity
protected static class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
@simkimsia
simkimsia / gotchas.md
Last active August 29, 2015 14:08
Gotchas and alerts for those migrating from CakePHP 2 to CakePHP 3

AuthComponent

Cake2

$this->Auth->allow('add', 'index');

Note the lack of array.

Cake3