Skip to content

Instantly share code, notes, and snippets.

View robinmitra's full-sized avatar
👋
h3110 w0r1d

Robin Mitra robinmitra

👋
h3110 w0r1d
View GitHub Profile
@robinmitra
robinmitra / laravel-generators.sh
Created April 13, 2014 10:33
Cheatsheet for Jeffrey Way's Laravel Generators
## Migration
# Create a migration to create a table named 'posts'
php artisan generate:migration create_posts_table
# Create a migration to add a field named 'user_id' to the 'posts' table
php artisan generate:migration add_user_id_to_posts_table
# Create a migration to remove the 'user_id' field we just created
php artisan generate:reomve_user_id_from_posts_table
@robinmitra
robinmitra / main.dart
Created July 8, 2019 08:12
Learning Dart
class Deck {
List<Card> cards = [];
Deck() {
var ranks = ['Ace', 'Two', 'Three', 'Four'];
var suits = ['Diamonds', 'Hearts', 'Clubs', 'Spades'];
for (var suit in suits) {
for (var rank in ranks) {
var card = Card(rank: rank, suit: suit);
this.cards.add(card);
# initialization file (not found)
@robinmitra
robinmitra / post-comment-on-pull-requests.sh
Last active May 9, 2019 16:22
Post comment on multiple Pull Requests
#!/usr/bin/env bash
GITHUB_USERNAME=<username>
GITHUB_ACCESS_TOKEN=<access-token>
REPO_URL=https://api.github.com/repos/<repo-owner>/<repo>
PR_BASE_URL=${REPO_URL}/pulls
COMMENT_BASE_URL=${REPO_URL}/issues
@robinmitra
robinmitra / date-and-time.sh
Last active April 19, 2018 12:42
Linux (specifically Ubuntu) commands and techniques
# Display current date and time (including timezone)
date
# Change timezone
sudo dpkg-reconfig tzdata
# or
sudo dpkg-reconfigure tzdata
# restart cron as otherwise the time will keep running on UTC
/etc/init.d/cron stop
### Keybase proof
I hereby claim:
* I am robinmitra on github.
* I am robinmitra (https://keybase.io/robinmitra) on keybase.
* I have a public key ASCodCcll-pjzpklJKdlVMWRqYuG2yHNA7yLtZmAP-ETVwo
To claim this, I am signing this object:
@robinmitra
robinmitra / MacOS Applications for Development.sh
Created March 31, 2018 15:40
Homebrew packages and casks for setting up a development machine running MacOS
############
# Packages #
############
brew install tree
brew install nvm
brew install fzf
brew install highlight
#########
@robinmitra
robinmitra / Show History.sh
Created March 31, 2018 15:10
Show a range of items from history
# Syntax
history <start> <end>
# Show all items in history
history 1
@robinmitra
robinmitra / History Statistics.sh
Last active March 31, 2018 14:26
Show ten most used commands from history
# Show ten most used commands from history
history-stat
@robinmitra
robinmitra / basic-implementation.php
Last active August 29, 2015 14:21
Singleton Pattern
<?php
class Singleton
{
/**
* @var self Single instance
*/
private static $instance = null;
/**