Skip to content

Instantly share code, notes, and snippets.

@ifiokjr
ifiokjr / git.sh
Created October 31, 2018 18:08
Useful git commands
# List all changes to a particular file in git reflog. Useful for when commits have been squashed and lost.
git reflog --pretty=medium -- config/jest.config.js
type EraValuesTuple = [string, string];
type QuarterValuesTuple = [string, string, string, string];
type MonthValuesTuple = [
string,
string,
string,
string,
string,
string,
string,
@ifiokjr
ifiokjr / commands.md
Last active June 17, 2019 07:02
A list of commands I've recently used

Here are some commands I've recently found useful

Copied a group of files in sub directories and renamed them in the same directory. The time spent researching this was significantly less than the time it would have taken to manually copy over the 22 files.

find {@remirror,packages,examples} -iname "tsconfig.prod.json" -execdir cp '{}' tsconfig.lint.json \;
@ifiokjr
ifiokjr / background.js
Created June 20, 2019 01:29 — forked from muralikg/background.js
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {

Keybase proof

I hereby claim:

  • I am ifiokjr on github.
  • I am ifiokjr (https://keybase.io/ifiokjr) on keybase.
  • I have a public key ASAawHvvoc53ODkSb6bfKnc0j85NWjh1vYlqQF_XeWrMjQo

To claim this, I am signing this object:

@ifiokjr
ifiokjr / puppeteer-gif.js
Created July 30, 2019 15:15 — forked from bambooom/puppeteer-gif.js
use puppeteer to generate gif
const fs = require('fs');
const puppeteer = require('puppeteer');
const GIFEncoder = require('gifencoder');
const PNG = require('png-js');
function decode(png) {
return new Promise(r => {png.decode(pixels => r(pixels))});
}
@ifiokjr
ifiokjr / avoid-dts-gen-errors.md
Last active January 1, 2023 12:34
Create dts-gen types for a browser module.

Why

dts-gen works by running the code of the module you're targeting and this causes problems for modules that rely on the browser to run (since it runs from a node environment).

The following errors are common in these cases.

  • ReferenceError: window is not defined
  • SecurityError: localStorage is not available for opaque origins

The following instructions will help to fix these.

@ifiokjr
ifiokjr / index.html
Created October 23, 2019 10:06 — forked from r8n5n/index.html
Twinkling star field using canvas/js
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Starfield</title>
</head>
@ifiokjr
ifiokjr / Instructions.md
Created March 18, 2020 04:17
ADB Installation
@ifiokjr
ifiokjr / ADB Instructions.md
Last active April 9, 2025 05:16
Android Platform Tools