Skip to content

Instantly share code, notes, and snippets.

View shan-shaji's full-sized avatar
🎯
Focusing

Shan Shaji shan-shaji

🎯
Focusing
View GitHub Profile

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step).

@shan-shaji
shan-shaji / 1-cat-pdp7.s
Created July 16, 2025 20:06 — forked from sinclairtarget/1-cat-pdp7.s
cat through the ages
" cat
lac 017777 i " Load accumulator (AC) with argument count
sad d4 " Skip next if we have more than 4 words of args
jmp nofiles " Otherwise, jump to nofiles
lac 017777 " Load AC with address of args
tad d1 " Increment AC by 1, past argument count
tad d4 " Increment AC by 4, now AC points to first real arg
dac name " Save arg pointer from AC into 'name'
@shan-shaji
shan-shaji / ANSI.md
Created June 22, 2025 08:19 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@shan-shaji
shan-shaji / main.dart
Last active July 31, 2023 19:19
Dart-Liskov-substitution
// Liskov substitution principle
void main() {
PayPalProcessor payPalProcessor = PayPalProcessor();
VisaPaymentProcessor visaProcessor = VisaPaymentProcessor();
// Here the checkout function don't now which service it is using to process the payment.
// THe underlying implementation is hidden from the checkout function.
//
// I can add more function to the payment processor and can extend it's functionality.
checkout(payPalProcessor, 230);
@shan-shaji
shan-shaji / srp.dart
Last active July 30, 2023 16:30
Dart-SRP
# Dart-SRP
void main() {
ApiController apiRedisService = ApiController(cacheService: RedisService());
ApiController apiNodeCacheService = ApiController(cacheService: NodeCacheService());
apiRedisService.saveToCache('Hello');
apiNodeCacheService.saveToCache('Main');
}
@shan-shaji
shan-shaji / locate-platform-folder.dart
Created January 10, 2023 18:45
Dart snippet for getting commonly used locations for storage on Windows, Mac, and Linux, such as the app data directories.
import 'dart:io' show Directory, FileSystemEntity, Platform;
import 'package:path/path.dart' as path_lib;
/// Static helper class for determining platform's app data path.
///
/// Does not require [AppData] to work, can be standalone.
/// Paths for MacOS and Linux were choosen based on popular
/// StackOverflow answers. Submit a PR if you believe these are
/// wrong.
class Locator {
@shan-shaji
shan-shaji / work-with-multiple-github-accounts.md
Created October 12, 2022 16:12 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@shan-shaji
shan-shaji / money.model.js
Created September 20, 2021 18:21 — forked from robert52/money.model.js
Approaches to create and combine models in mongoose. Document referencing, model composition and many more.
'use strict';
const DEF_CURRENCY = 'USD';
const DEF_SCALE_FACTOR = 100;
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ObjectId = Schema.ObjectId;
const MoneySchema = new Schema({
import 'dart:convert';
void main() {
String object = '{"name": "hello"}';
print(User.createInstance(jsonDecode(object)).name);
String name = null;
print(name);
}