Skip to content

Instantly share code, notes, and snippets.

module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
"prettier",
"prettier/@typescript-eslint",
],
env: {
node: true
},
@pocesar
pocesar / react-base-table.d.ts
Created October 4, 2019 13:46
react base table typescript typings
declare module 'react-base-table' {
import React from 'react'
export interface ColumnProps<T> {
key: string
className?: string | ((obj: CallbackObject<T>) => string)
/** Class name for the column header, could be a callback to return the class name The callback is of the shape of ({ columns, column, columnIndex, headerIndex }) => string */
headerClassName?: string | ((obj: CallbackObject<T>) => string)
/** Custom style for the column cell, including the header cells */
style?: React.CSSProperties
@pocesar
pocesar / apify.d.ts
Last active February 4, 2022 07:36
apify typescript typings (non-official, but should help you get going)
declare module 'apify' {
import { IncomingMessage } from 'http'
import { EventEmitter } from 'events'
import {
Page,
Response as PuppeteerResponse,
ResourceType,
LaunchOptions,
HttpMethod,
Request as PuppeteerRequest,
@pocesar
pocesar / Debouncer.kt
Last active July 29, 2019 04:00
A debouncer helper in Kotlin with coroutines
import kotlinx.coroutines.*
class Debouncer<T>(private val millis: Long, val block: (T) -> Unit) {
private var job: Job? = null
fun run(param: T) {
job?.cancel()
job = GlobalScope.launch(Dispatchers.Main) {
delay(millis)
@pocesar
pocesar / facebook-activity-logger-deleter.js
Last active August 11, 2018 12:16
Javascript: delete all facebook posts from activity log
// go to https://www.facebook.com/your_page_or_profile_name/allactivity?privacy_source=activity_log&log_filter=all
// load the maximum number of items you can before
// then open up the console and execute this code
// will take care of errors, successes and timeouts. it looks like a really proficient human clicking stuff
// it's messy and might break at any time, made for English version, but it's working as of august 2018
(async function f() {
'use strict'
@pocesar
pocesar / nuke.js
Last active October 22, 2021 11:19
Facebook Javascript delete all photos
(async function walk() {
const waiter = (time) => (new Promise((resolve, reject) => {
setTimeout(resolve, time)
}))
const photo = document.querySelector('._3-8h._50zy._50-0._50z_._5upp._42ft')
const okBtn = '.uiOverlayFooter ._4jy0._4jy3._4jy1._51sy.selected._42ft'
if (photo) {
photo.click()
@pocesar
pocesar / output.md
Created July 1, 2016 17:09
electron-edge custom build
c:\nodejs\node_modules\electron-edge>tools\build release 5.12.0
Building edge.node release for node.js x86 v5.12.0
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | ia32
gyp info spawn C:\Python\python.exe
gyp info spawn args [ 'C:\\nodejs\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
@pocesar
pocesar / get domain without subdomain.php
Created April 11, 2013 20:27
PHP code to get the domain name without subdomains (includes the tld, and the special types from IANA). Don't have support for unicode domain names.
<?php
/**
* @param string $domain Pass $_SERVER['SERVER_NAME'] here
* @param bool $debug
*
* @debug bool $debug
* @return string
*/
function get_domain($domain, $debug = false)
{