Skip to content

Instantly share code, notes, and snippets.

Arnav Gupta championswimmer

Block or report user

Report or block championswimmer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@championswimmer
championswimmer / runtime-annotation-kotlin.md
Last active Aug 18, 2019
Runtime @annotation Processing using Reflection in Kotlin
View runtime-annotation-kotlin.md

Runtime @Annotation Processing using Reflection in Kotlin

Let us take a look at Annotations in Kotlin, and start with a simple example of processing annotations at runtime using JVM's reflection framework.

NOTE: This is shown in Kotlin, but is specific to how Kotlin/JVM works, and is not applicable to Kotlin/JS or Kotlin/Native.

Creating an Annotation

First of all, we create annotations in Kotlin using the keywords annotation class.

@championswimmer
championswimmer / MainActivity.kt
Created Aug 4, 2019
Android Async Handler Difference
View MainActivity.kt
package com.codingblocks.handlerasync
import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
@championswimmer
championswimmer / MainActivity.kt
Created Aug 4, 2019
Android Async Handler Difference
View MainActivity.kt
package com.codingblocks.handlerasync
import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
View server.js
const express = require('express')
const app = express()
let todos = []
app.use(express.json())
app.use(express.urlencoded({extended: true}))
app.get('/todos', (req, res) => {
@championswimmer
championswimmer / index.html
Created Oct 3, 2018
IEEE NSIT Game Dev Workshop 2018
View index.html
<html>
<!-- Mozilla Developer Network (mdn) -->
<!-- Upload to app.netlify.com/drop -->
<!-- Submit to ieeensitdu@gmail.com -->
<!-- Subject: IEEE Game Dev Assignment -->
<head>
<style>
#game {
height: 400px;
@championswimmer
championswimmer / idea.sh
Created Aug 22, 2018
IntelliJ IDEA Launch Script (MacOS)
View idea.sh
#!/bin/sh
ARG=$@
if [ "$ARG" == "." ]
then
ARG=$(pwd)
fi
echo "Opening IntelliJ IDEA with args = ${ARG}"
open -a "IntelliJ IDEA" --args $ARG
View logcat.txt
--------- beginning of system
01-06 17:57:36.324 779 779 E LockSettingsStorage: Cannot read file java.io.FileNotFoundException: /data/system/password.key: open failed: ENOENT (No such file or directory)
01-06 17:57:36.325 779 779 E LockSettingsStorage: Cannot read file java.io.FileNotFoundException: /data/system/gatekeeper.pattern.key: open failed: ENOENT (No such file or directory)
01-06 17:57:36.327 779 779 E LockSettingsStorage: Cannot read file java.io.FileNotFoundException: /data/system/gatekeeper.gesture.key: open failed: ENOENT (No such file or directory)
01-06 17:57:36.327 779 779 E LockSettingsStorage: Cannot read file java.io.FileNotFoundException: /data/system/gesture.key: open failed: ENOENT (No such file or directory)
01-06 17:57:36.331 779 779 D SystemServerTiming: MakeLockSettingsServiceReady took to complete: 104ms
01-06 17:57:36.331 779 779 I SystemServer: StartBootPhaseLockSettingsReady
01-06 17:57:36.331 779 779 I SystemServiceManager: Starting phase 480
01-06 17
View C++ Templates vs Java Generics.md

Templates in C++ vs Generics in Java

Templates and generics allow us to achieve very similar results using very similar code syntax in C++ and Java respectively. But despite that, the implementation of these two features and their semantics are vastly different under the hood.

Syntax and Usage

Templates

Let us consider first the case of a template called Pair in C++.

@championswimmer
championswimmer / Writing Vuex modules in neat Typescript classes.md
Created Jul 14, 2018
Writing Vuex modules in neat Typescript classes
View Writing Vuex modules in neat Typescript classes.md

Writing Vuex modules in neat Typescript classes

Typescript/ES7 Decorators to make Vuex modules a breeze

Installation

npm install -D vuex-module-decorators
@championswimmer
championswimmer / verified.sql
Created Jun 8, 2018
all users with one verified and multiple unverified accounts
View verified.sql
SELECT
count("email") AS "count",
count("verifiedemail") as "Verified",
max("createdAt") as "Last Attempt",
min("createdAt") as "First Attempt",
"public"."users"."email" AS "email"
FROM "public"."users"
GROUP BY "public"."users"."email"
HAVING
count("email") > 1 AND
You can’t perform that action at this time.