Skip to content

Instantly share code, notes, and snippets.

View scazzy's full-sized avatar
🤩

Elton Jain scazzy

🤩
View GitHub Profile
@scazzy
scazzy / force-ctrl-c-v.md
Created July 15, 2023 20:21 — forked from Gustavo-Kuze/force-ctrl-c-v.md
Enable copy and paste in a webpage from the browser console
javascript:(function(){
  allowCopyAndPaste = function(e){
  e.stopImmediatePropagation();
  return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})(); 
@scazzy
scazzy / logger-boilerplate.js
Last active November 15, 2018 09:44
Logger system basic boilerplate
// api - req/res, duration, failures+count+reqId
// action - user actions or general report
// perf - durations
// error - all errors, or custom (similar to capturing in sentry)
class Logger {
static type = {
api: {
name: '',
rules: {},
@scazzy
scazzy / deletePosts.js
Created November 14, 2018 09:31
Javascript code to delete all pending posts from Facebook group lazily/infinitely
/*
* Function to infinitely delete pending posts from a facebook group
* Execute this code in console on the facebook group page > pending posts
*/
function deletePosts () {
var deleteButtons = document.querySelectorAll('a[role=button][ajaxify*=delete]')
deleteButtons.forEach( b => {
b.click()
})
@scazzy
scazzy / Root.js
Last active July 30, 2017 08:20
SSR using React-transmit
/**
* src/containers/Root.js
* App's root container
*/
import React, { Component } from 'react';
import { BrowserRouter, StaticRouter } from 'react-router-dom';
import Redux from 'redux';
import { Provider } from 'react-redux';
import AppRoutes from '../routes/AppRoutes';
@scazzy
scazzy / flattn.js
Last active January 28, 2017 09:17
Nested array flatten method
let flattenedArray = [];
const flattn = (arr) => {
for(let i in arr) {
if(typeof arr[i] === 'object' && arr[i].length) {
flattn(arr[i]);
} else {
flattenedArray.push(arr[i]);
}
}