Skip to content

Instantly share code, notes, and snippets.

View pralhadstha's full-sized avatar

Pralhad Kumar Shrestha pralhadstha

View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@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>";
}
@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 / 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

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 / 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
@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 / 4chan.py
Created February 11, 2016 10:48
4chan images downloader
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, Alexis Nootens <me@axn.io>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
@pralhadstha
pralhadstha / php-cs-fixer
Created August 12, 2016 10:17 — forked from mpalourdio/php-cs-fixer
@fabpot php-cs-fixer config for PhpStorm
parameters
--level=psr2 --verbose fix $FileDir$/$FileName$
working directory
$ProjectFileDir$