Skip to content

Instantly share code, notes, and snippets.

View vighnesh153's full-sized avatar
Pika-Pi

Vighnesh Raut vighnesh153

Pika-Pi
View GitHub Profile
class LinkedInQueensGame {
val initialGrid = listOf(
mutableListOf(0, 0, 0, 0, 0, 0, 0, 0, 1),
mutableListOf(0, 0, 2, 2, 0, 0, 1, 1, 1),
mutableListOf(0, 3, 3, 2, 0, 4, 4, 4, 0),
mutableListOf(0, 0, 3, 2, 0, 0, 0, 4, 0),
mutableListOf(0, 0, 3, 0, 0, 0, 0, 0, 0),
mutableListOf(0, 0, 0, 0, 0, 6, 0, 0, 5),
mutableListOf(0, 7, 7, 7, 0, 6, 5, 5, 5),
mutableListOf(8, 7, 0, 0, 0, 6, 6, 0, 0),
data class MovieImage(val url: String, val aspect: String)
data class Movie(val name: String, val images: List<MovieImage>, val root: String)
data class MovieCollection(val label: String, val items: List<Movie>)
val Movie.description: String
get() = "When the menace known as the Joker wreaks havoc and chaos on the people of Gotham..."
val movieCollections = listOf(
MovieCollection(
label = "Popular movies and shows", items = listOf(
package vighnesh153.androidx.exo_player_prototype
import androidx.compose.runtime.Composable
import com.google.android.exoplayer2.ExoPlayer
interface Subtitle {
val languageString: String;
// val languageCode: String;
}
@vighnesh153
vighnesh153 / ExoVideoPlayerInJetpackCompose.kt
Last active August 31, 2024 15:38
Exoplayer in Jetpack Compose
package vighnesh153.androidx.exo_player_prototype
import android.net.Uri
import android.os.Build
import android.util.Log
import android.view.ViewGroup
import android.view.accessibility.CaptioningManager.CaptionStyle
import android.widget.FrameLayout
import androidx.annotation.RequiresApi
import androidx.compose.animation.AnimatedVisibility
@vighnesh153
vighnesh153 / mathjax-in-react.md
Created March 13, 2021 11:51 — forked from GiacoCorsiglia/mathjax-in-react.md
Using MathJax v3 in React

Using MathJax v3 in React

Any improvements or alternative approaches are welcome!

One alternative approach can be found in the CharlieMcVicker/mathjax-react library.

Loading MathJax

It may be possible to bundle MathJax with the rest of your JavaScript, which might have the nice consequence of allowing you to import it instead of using the global MathJax object. But I found it simpler to include the following at the bottom of my html file; this is the common way to load MathJax.

@vighnesh153
vighnesh153 / PromiseClone.js
Last active January 5, 2021 15:39
A clone of the Promise API in Javascript.
class PromiseClone {
static #HANDLER_TYPES = {
THEN: 'THEN',
CATCH: 'CATCH',
FINALLY: 'FINALLY',
};
handlers = [];
constructor(executor) {
const winston = require("winston");
const logger = winston.createLogger({
transports: new winston.transports.File({
filename: "./hello.log",
format: winston.format.combine(
winston.format.timestamp({
format: "YYYY-MM-DD HH:mm:ss",
}),
winston.format.json()
@vighnesh153
vighnesh153 / 1-securing-express.md
Created December 13, 2020 04:34 — forked from cerebrl/1-securing-express.md
Securing ExpressJS

tl;dr

  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers: https://github.com/evilpacket/helmet
  4. Enable csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrf
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.
@vighnesh153
vighnesh153 / __vighnesh153.com.txt
Last active October 12, 2020 02:29
A public CMS for my website
42