Skip to content

Instantly share code, notes, and snippets.

View sineausr931's full-sized avatar
🐆
grrrrr

sineausr931

🐆
grrrrr
View GitHub Profile
@sineausr931
sineausr931 / searchHistory.js
Created July 19, 2021 21:15
Using promises with chrome extension history API
var microsecondsPerWeek = 1000 * 60 * 60 * 24 * 7;
var searchEpoch = microsecondsPerWeek * 52;
var oneYearAgo = (new Date).getTime() - searchEpoch;
// Chrome history API does not yet support promises, only callback
// So, wrap the chrome.history.search in a promise of our own
function chromeHistorySearchAsync() {
console.log("beginning query");
return new Promise(function(resolve, reject) {
console.log("inside promise");
@sineausr931
sineausr931 / index.js
Last active September 2, 2021 20:30
CORS proxy as Cloudflare worker
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
const path = request.url.replace(/^https:\/\/[^\/]*\//, '')
const apiUrl = "https://example.com/" + path
request = new Request(apiUrl, request)
@sineausr931
sineausr931 / digital-rain.css
Last active June 23, 2021 18:24
GistRun + digital rain + pizza + coke, no pepsi!
body {
background-color: black !important;
}
@sineausr931
sineausr931 / BoardLayout.kt
Created June 13, 2021 23:55
Mangled code causes OOM in Android Studio 4.2
// To repeat:
// - Create an empty android activity project for Kotlin
// - Add the following class and *POOF* go look at top
package com.example.android.myapplication
import android.util.Log
import android.view.MotionEvent
import android.view.View
@sineausr931
sineausr931 / ZoomLayout.java
Created May 31, 2021 14:46 — forked from anorth/ZoomLayout.java
Pinch-zoomable Android frame layout
package au.id.alexn;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.widget.FrameLayout;
@sineausr931
sineausr931 / README.md
Last active June 17, 2021 16:53
Emoji tracker + twitterstream