Skip to content

Instantly share code, notes, and snippets.

View pralhadstha's full-sized avatar

Pralhad Kumar Shrestha pralhadstha

View GitHub Profile
@pralhadstha
pralhadstha / eloquent.md
Created February 11, 2016 10:47 — forked from msurguy/eloquent.md
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@pralhadstha
pralhadstha / extract_realm_database_android.sh
Created February 6, 2016 17:11 — forked from medyo/extract_realm_database_android.sh
Shell script that exports Realm database from a connected device
#!/bin/sh
ADB_PATH="/Users/medyo/Library/Android/sdk/platform-tools"
PACKAGE_NAME="com.mobiacube.elbotola.debug"
DB_NAME="default.realm"
DESTINATION_PATH="/Users/Medyo/Desktop/"
NOT_PRESENT="List of devices attached"
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
echo "Make sure a device is connected"
else

Override Devise RegistrationsController

Overview

Here I'll show you

  • How to override devise registrations_controller(related to create/update user account)
  • How to change redirect path after updating user

Override RegistrationsController

@pralhadstha
pralhadstha / gitignore-android-studio-list
Created December 19, 2015 11:13 — forked from vtanathip/gitignore-android-studio-list
Git Ignore files list that should use in Android Studio Projects
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
@pralhadstha
pralhadstha / Readium SDK Launcher Log
Created November 2, 2015 18:01
The log from readium sdk launcher android using the test files.
11-02 12:59:48.767 1824-2096/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.readium.sdk.android.launcher/.MainActivity} from pid 1964
11-02 12:59:48.817 1824-1876/? E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
11-02 12:59:48.817 1824-1876/? W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-02 12:59:48.817 1824-1876/? E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
11-02 12:59:48.817 1824-1876/? W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-02 12:59:48.817 1824-1876/? E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
11-02 12:59:48.827 1824-1876/? W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-02 12:59:48.827 1824-1876/? E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
11-02 12:59:48.827 1824-1876/? W/AudioService﹕
@pralhadstha
pralhadstha / readium-sdk-android-log
Created November 2, 2015 02:54
Log of android sdklauncher that doesn't show contents of epub
11-01 21:49:10.029 1620-1620/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-01 21:49:10.029 1620-1620/? D/AndroidRuntime﹕ CheckJNI is ON
11-01 21:49:10.079 1620-1620/? D/dalvikvm﹕ Trying to load lib libjavacore.so 0x0
11-01 21:49:10.099 1620-1620/? D/dalvikvm﹕ Added shared lib libjavacore.so 0x0
11-01 21:49:10.139 1620-1620/? D/dalvikvm﹕ Trying to load lib libnativehelper.so 0x0
11-01 21:49:10.139 1620-1620/? D/dalvikvm﹕ Added shared lib libnativehelper.so 0x0
11-01 21:49:10.219 1620-1620/? E/cutils-trace﹕ Error opening trace file: No such file or directory (2)
11-01 21:49:10.819 1620-1620/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am
11-01 21:49:10.828 1620-1620/? D/dalvikvm﹕ Note: class Landroid/app/ActivityManagerNative; has 163 unimplemented (abstract) methods
11-01 21:49:10.859 911-1095/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org
@pralhadstha
pralhadstha / Laravel\app\commands\ViewsCommand.php
Created October 2, 2015 15:12 — forked from cjonstrup/Laravel\app\commands\ViewsCommand.php
Clear Laravel 4.* app/storage/views artisan views:clear
<?php
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class ViewsCommand extends Command {
/**
* The console command name.
*
* @var string
@pralhadstha
pralhadstha / gist:c60d0523c0e0ad5d26f5
Created September 25, 2015 06:34 — forked from justinhernandez/gist:630770
pretty array export for var_export
function pretty_var($myArray){
print str_replace(array("\n"," "),array("<br>","&nbsp;"), var_export($myArray,true))."<br>";
}

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: