Skip to content

Instantly share code, notes, and snippets.

View gblazex's full-sized avatar

Blaze (Balázs Galambosi) gblazex

View GitHub Profile
@andrewyu0
andrewyu0 / obsidian-copilot.md
Last active February 26, 2024 17:29
obsidian-copilot

obsidian copilot

your notes = your lifelong ai companion + intelligence augmentation

COMMENTS VERY WELCOME! this is a first pass to put these ideas in one place

tldr - combine obsidian + openinterpreter to create a bespoke pkm copilot experience. if you follow the "file over app" philosophy, this combination can be your lifetime AI companion

image
function toBaseN(num, base) {
if (num === 0) {
return '0';
}
var digits = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var len = Math.min(digits.length, base);
var result = '';
while (num > 0) {
result = digits[num % len] + result;
num = parseInt(num / len, 10);
@gblazex
gblazex / promise_preferred.js
Created November 22, 2016 21:37
Promise.preferred
// Promises are started in parallel.
// Resolves with the first resolved value in array order.
// If there's no winner, it rejects with last rejection.
Promise.preferred = function (promisesOrdered) {
return new Promise((resolve, reject) => {
var resolvedValues = new WeakMap();
var resolvables = promisesOrdered.slice(); // copy
function onMemberResolved(value, member) {
resolvedValues.set(member, value);
if (member == resolvables[0])
@MarkHerhold
MarkHerhold / generators-vs-asyncawait.js
Last active September 4, 2017 18:47
Generators VS Async/Await Performance
//
// Simple generator (with co) VS async/await benchmark
// Article: https://medium.com/p/806d8375a01a
//
const co = require('co');
const Benchmark = require('benchmark');
const suite = new Benchmark.Suite;
// add tests
@gblazex
gblazex / promise_any.js
Last active November 22, 2016 21:37
Promise.any
// Promises are started in parallel.
// Resolves with the first resolved value in time.
// If there's no winner, it rejects with last rejection.
Promise.any = function (promises) {
return new Promise((resolve, reject) => {
var rejectedCount = 0;
function onMemberResolved(value) {
resolve(value);
}
function onMemberRejected(reason) {
@gblazex
gblazex / BLZLabelWithInset.h
Created March 4, 2016 10:33
BLZLabelWithInset - simple UILabel subclass with inset
@interface BLZLabelWithInset : UILabel
@property (nonatomic) UIEdgeInsets insets;
@end
@paulirish
paulirish / what-forces-layout.md
Last active April 26, 2024 17:33
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
public struct Error: ErrorType {
let source: String; let reason: String
public init(_ source: String = __FILE__, _ reason: String) {
self.reason = reason; self.source = source
}
}
protocol Contextualizable {}
extension Contextualizable {
func functionContext(function : String = __FUNCTION__) -> String {
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@clementgenzmer
clementgenzmer / FBAnimationPerformanceTracker.h
Last active September 18, 2023 23:02
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN