Skip to content

Instantly share code, notes, and snippets.

@sakadigital
sakadigital / postmanTest
Last active August 18, 2016 10:52
postman test for basic api response according to http://bit.ly/2b8CihE
var error = responseCode.code === 500;
var empty = responseCode.code === 204;
if(error) // block below is for 500 error scenario
{
tests["Response Error"] = error !== true;
}
else if(empty) // block below is for empty scenario
{
tests["Response Empty"] = empty === true;
@sakadigital
sakadigital / PreloadService.java
Created July 1, 2016 13:25
A simple boilerplate for a preloading service
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;
/**
* Created by aqid on 6/30/16.
<code_scheme name="flipbox">
<option name="FIELD_NAME_PREFIX" value="m" />
<option name="STATIC_FIELD_NAME_PREFIX" value="s" />
<option name="LOCAL_VARIABLE_NAME_PREFIX" value="l" />
<option name="PREFER_LONGER_NAMES" value="false" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value />
</option>
@sakadigital
sakadigital / gist:390b0181d4a4735c39f7
Last active December 14, 2015 15:07
DB Service for ionic
angular.module('projectname.factories')
.factory('DB', function($cordovaSQLite, $q, $ionicPlatform, $window) {
'use strict';
var self = this;
self.db = null;
self.initDB = function(){
var q = $q.defer();
@sakadigital
sakadigital / gist:d3dbc44f694d7adeaa84
Created November 12, 2015 09:25
Return API helpers for laravel
<?php
namespace App\Models;
use Carbon\Carbon;
use App\User;
class Helpers {
/**
* Status codes translation table.