Skip to content

Instantly share code, notes, and snippets.

View lakshyabatman's full-sized avatar
:shipit:
Learning step by step

Lakshya Khera lakshyabatman

:shipit:
Learning step by step
View GitHub Profile
@lakshyabatman
lakshyabatman / items.json
Created March 10, 2021 12:33
My Config for My touchbar :D
[
{ "type": "dock", "align": "left", "width": 150 },
{
"type": "appleScriptTitledButton",
"source": {
"inline": "if application \"Spotify\" is running then\rtell application \"Spotify\"\rif player state is playing then\rreturn (get artist of current track) & \" – \" & (get name of current track)\relse\rreturn \"\"\rend if\rend tell\rend if\rreturn \"\"\r"
},
"action": "appleScript",
"actionAppleScript": {
@lakshyabatman
lakshyabatman / bitcoin.sh
Created January 9, 2021 14:29
Small script to show bitcoin price on terminal!
#!/bin/bash
#A Shell script to fetch bitcoin price and display !
#Author: Lakshya Khera
#Dependencies
# - jq https://stedolan.github.io/jq/
# - lolcat https://github.com/busyloop/lolcat/
#
bitcoin_price=$(curl -s https://api.coindesk.com/v1/bpi/currentprice.json | jq '.bpi.USD.rate ')
@lakshyabatman
lakshyabatman / error.md
Created November 15, 2020 12:23
Eslint Plugin error
AssertionError [ERR_ASSERTION]: A fatal parsing error occurred: Parsing error: Unexpected token >
    at runRuleForItem (/Users/lakshya/Desktop/projects/my-eslint-plugin/node_modules/eslint/lib/rule-tester/rule-tester.js:559:13)
    at testValidTemplate (/Users/lakshya/Desktop/projects/my-eslint-plugin/node_modules/eslint/lib/rule-tester/rule-tester.js:605:28)
    at Function.<anonymous> (/Users/lakshya/Desktop/projects/my-eslint-plugin/node_modules/eslint/lib/rule-tester/rule-tester.js:885:25)
    at Function.itDefaultHandler (/Users/lakshya/Desktop/projects/my-eslint-plugin/node_modules/eslint/lib/rule-tester/rule-tester.js:294:23)
    at /Users/lakshya/Desktop/projects/my-eslint-plugin/node_modules/eslint/lib/rule-tester/rule-tester.js:884:32
    at Array.forEach (<anonymous>)
    at Function.<anonymous> (/Users/lakshya/Desktop/projects/my-eslint-plugin/node_modules/eslint/lib/rule-tester/rule-tester.js:883:28)
    at Function.describeDefaultHandler (/Users/lakshya/Desktop/projects/my-eslint-plugin/nod
@lakshyabatman
lakshyabatman / user-service.ts
Created October 17, 2020 21:22
User Service
class UserService {
constructor(private readonly userRepository : UserRepository) {
// Here the userRepository is abstracted!
}
getUser(id : String) : UserEntity {
return this.userRepository.getAll()
}
}
@lakshyabatman
lakshyabatman / user-repository.ts
Created October 17, 2020 21:21
User repository class
class UserRepository {
constructor() {
this.userModel = userModel;
}
getOne(id: String) {
// ..db calls!!
}
getAll() : UserEntity {
@lakshyabatman
lakshyabatman / user-entity.ts
Created October 17, 2020 20:55
User entity
interface UserEntity {
name: String;
age: Number;
}
@lakshyabatman
lakshyabatman / index.js
Created May 23, 2020 07:39
Recursive method to deep clone and reset object
let state = {
activity:{
activeView:"Activity"
},
loader: {
isloading:false
},
user: {
isLogged:true,
userDetails: {
@lakshyabatman
lakshyabatman / app.component.vue
Created May 6, 2020 11:42
Class Based component using store module
<template>
<div>
{{getCount}}
<br/>
<button @click="increase">-</button>
<button @click="decrease">+</button>
</div>
</template>
<script lang="ts">
@lakshyabatman
lakshyabatman / counter.module.ts
Last active May 6, 2020 11:57
A Simple class based vuex module
import { VuexModule, Module, getModule, MutationAction } from 'vuex-module-decorators';
import store from '../index';
@Module({
namespaced: true,
name: 'counter',
store: store,
dynamic: true,
})
class CounterModule extends VuexModule {
@lakshyabatman
lakshyabatman / index.ts
Created May 6, 2020 11:12
Store file with modules
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
export default new Vuex.Store({
state: {},
actions: {},
mutations: {},
});