Skip to content

Instantly share code, notes, and snippets.

View maman's full-sized avatar
🔥

Achmad Mahardi maman

🔥
View GitHub Profile
@maman
maman / index.ts
Created September 19, 2024 02:47
Distributive Omit & Pick
export type DistributiveOmit<T, K extends PropertyKey> = T extends any
? Omit<T, K>
: never;
export type DistributivePick<T, K extends keyof T> = T extends any
? Pick<T, K>
: never;
@maman
maman / sommelier-override.conf
Created February 5, 2024 10:22
ChromeOS fractional scaling
# ~/.config/systemd/user/sommelier\@0.service.d/override.conf
[Service]
Environment="SOMMELIER_SCALE=1.2"
Environment="GDK_SCALE=2"
--- Include/objimpl.h
+++ Include/objimpl.h
@@ -250,7 +250,7 @@
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
- double dummy; /* force worst-case alignment */
+ long double dummy; /* force worst-case alignment */
} PyGC_Head;
@import (css)
url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,500;0,600;0,700;1,500;1,600;1,700&display=swap&css");
@maman
maman / repl-server.ts
Last active May 18, 2020 01:15
Deno repl server
import { serve } from "https://deno.land/[email protected]/http/server.ts";
const s = serve({ port: 8000 });
console.log('Server online at http://localhost:8000');
for await (const req of s) {
switch(req.url) {
case '/run': {
const {headers, method} = req;
const contentType = headers.get('Content-Type');
if (method === 'POST' && contentType == 'application/javascript') {
const textDecoder = new TextDecoder();
@maman
maman / test.js
Created March 1, 2018 15:10
Trying react new simpleCacheProvider module
const test = async () => {
const { createCache, createResource } = require('./cacheProvider');
function loadUpperCase(text) {
console.log('CALLED!');
return Promise.resolve(text.toUpperCase());
}
function loadUpperCase2(text) {
console.log('CALLED 2!');

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@maman
maman / TTLCacheMap.js
Last active October 5, 2017 03:14
Map implementation with per-record TTL support
class TTLMap {
constructor(TTL) {
this.ttl = TTL;
this.timeoutData = {};
this.data = new Map();
}
_clearTimeout(key) {
clearTimeout(this.timeoutData[key]);
delete this.timeoutData[key];
@maman
maman / better-cnn-lite.user.js
Last active September 16, 2017 03:34
Better experience for CNN Lite website
// ==UserScript==
// @name Better CNN Lite
// @namespace https://github.com/maman
// @version 1.0.0
// @downloadURL https://gist.githubusercontent.com/maman/21288c00d8b53e855604b3acde74e902/raw/better-cnn-lite.user.js
// @match *://lite.cnn.io/*
// ==/UserScript==
/*eslint-disable*/
/* axios v0.16.2 | (c) 2017 by Matt Zabriskie */