Skip to content

Instantly share code, notes, and snippets.

View agentcooper's full-sized avatar

Artem Tyurin agentcooper

View GitHub Profile
var _ = [];
var letters = "abcdefghijklmnopqrstuvwxyz".split('');
letters.forEach(function(letter) {
function f() {
var out = _.join('');
_.length = 0;
return out;
}
@agentcooper
agentcooper / index.js
Last active November 17, 2015 10:48
sicp.js
// node --harmony index.js
var cons = (a, b) => (f) => f(a, b);
var car = (p) => p((p, q) => p);
var cdr = (p) => p((p, q) => q);
var list = (first, ...rest) =>
!first ?
@agentcooper
agentcooper / uber-eats.js
Created August 5, 2017 23:31
Uber EATS statistics
/*
Uber EATS statistics
1. Go to https://www.ubereats.com, click **Sign in**
2. Enter your credentials, sign in
3. Open JavaScript console (CMD + Option + J)
4. Copy following code and paste it into the console, hit enter
*/
@agentcooper
agentcooper / 0.README.md
Last active March 10, 2018 13:49
Sort YouTube playlist/channel by view count or average rating
@agentcooper
agentcooper / subtyping.js
Last active March 22, 2018 07:44
Record and function subtyping examples for TypeScript and Flow
/*
Try this file with both TypeScript [1] and Flow [2].
1. https://www.typescriptlang.org/play/index.html
2. https://flow.org/try/
TypeScript playground also provides a way to run the code -
check where the code is crashing.
<html>
<head>
<title>Run parallel</title>
</head>
<body>
<script>
(async function() {
async function f1() {
return new Promise(res => {
setTimeout(() => {
@agentcooper
agentcooper / README.md
Last active September 26, 2020 10:39
Create Roam Research dock icon in macOS
  1. Open Automator.app, click "New Document", select "Application" type.
  2. Create the same workflow as on the screenshot, make sure to use the right URL to your Roam graph.
  3. Save it (⌘S) as Roam.app.
  4. Find the newly created Roam.app in your Applications folder, right click, then "Get Info".
  5. Download and drag roam.icns on the icon in the info window.
  6. Drag Roam.app from Applications to your dock.
@agentcooper
agentcooper / save-youtube-subscriptions.md
Last active August 11, 2023 00:56
Save YouTube subscriptions

Open https://www.youtube.com/feed/channels, open JS console.

Save as Markdown list

console.log(
  Array.from(document.querySelectorAll("ytd-channel-renderer"))
    .map((item) => ({
      title: item.querySelector("#text-container").textContent.trim(),
 url: item.querySelector("#main-link").href,
/**
* Writing a Mark-Sweep Garbage Collector in C++.
*
* This is a source code for the Lecture 9 from the
* Essentials of Garbage Collectors course:
*
* http://dmitrysoshnikov.com/courses/essentials-of-garbage-collectors/
*
* See full details in:
*
from PyPDF2.generic import (
DictionaryObject,
NumberObject,
FloatObject,
NameObject,
TextStringObject,
ArrayObject
)
# x1, y1 starts in bottom left corner