Skip to content

Instantly share code, notes, and snippets.

View juanchristensen's full-sized avatar

Juan Carlos Christensen juanchristensen

View GitHub Profile
@akhansari
akhansari / EsBankAccount.ts
Last active April 8, 2024 12:40
TypeScript prototype of the Decider pattern. (F# version: https://github.com/akhansari/EsBankAccount)
import * as assert from "assert";
/** Decider Pattern **/
type Transaction = {
amount: number
date: Date
}
type Deposited = Transaction & {
@ibireme
ibireme / kpc_demo.c
Last active June 7, 2025 06:47
A demo shows how to read Intel or Apple M1 CPU performance counter in macOS.
// =============================================================================
// XNU kperf/kpc demo
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges
//
//
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// M1 (Pro/Max/Ultra): /usr/share/kpep/a14.plist
// M2 (Pro/Max): /usr/share/kpep/a15.plist
// M3: /usr/share/kpep/as1.plist
@eramdam
eramdam / .skhdrc
Created November 17, 2020 15:38
yabai/skhd config
#!/usr/bin/env sh
:: default : yabai -m config active_window_opacity 1; yabai -m config normal_window_opacity 1;
# Focus
shift + alt - home : yabai -m window --focus north
shift + alt - j : yabai -m window --focus north
shift + alt - end : yabai -m window --focus south
shift + alt - k : yabai -m window --focus south
shift + alt - delete : yabai -m window --focus west
@sleepdefic1t
sleepdefic1t / MACOS_CLANG_TIDY.md
Last active September 30, 2024 11:09
brew clang-tidy on macOS
brew install llvm
ln -s "/usr/local/opt/llvm/bin/clang-format" "/usr/local/bin/clang-format"
ln -s "/usr/local/opt/llvm/bin/clang-tidy" "/usr/local/bin/clang-tidy"

use cmake file

  find_program(CLANG_TIDY_BIN clang-tidy)
 find_program(RUN_CLANG_TIDY_BIN /usr/local/Cellar/llvm/10.0.0_3/share/clang/run-clang-tidy.py)
@diegozr1
diegozr1 / fintech_api_list.md
Last active July 31, 2024 20:59
Curated list of Mexican Fintech APIs
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 20, 2025 21:15
The best FRP iOS resources.

Videos

@phill-tornroth
phill-tornroth / elasticsearch_backend.py
Last active November 11, 2015 23:05
A Django-Haystack backend for ElasticSearch 1.x that incorporates the best things I found in the recent master and pull requests, and fixes issues with each
"""
This is the basis for an elasticsearch 1.x backend I've cobbled together and am continuing
to refine and test for use. It's based on haystack master's version as of:
- https://github.com/toastdriven/django-haystack/blob/cbb72b3253404ba21e20860f620774f7b7b691d0/haystack/backends/elasticsearch_backend.py
But with @HonzaKral and @davedash's work to make the backend behave more like an ES user would expect with regard to doc types:
- https://github.com/toastdriven/django-haystack/pull/921
I also made a number of changes:
- I fixed bugs that I found in #921 (mostly related to mapping synchronization issues),
all of which I wrote up as comments on #921
@andrusha
andrusha / iso_to_usb.sh
Last active October 9, 2016 22:34
Create bootable USB from ISO image on Mac
hdiutil convert -format UDRW -o destination_file.img source_file.iso
# Or re-partition it with Disk Utility with 1 Free Space Partition
diskutil partitionDisk /dev/disk2 1 "Free Space" "unused" "100%"
# Or copy the image through Disk Utility in Restore menu
dd if=destination_file.img.dmg of=/dev/disk2 bs=1m
# Or eject manually
diskutil eject /dev/disk2
@randomsequence
randomsequence / StickyHeadersCollectionViewFlowLayout.m
Last active October 26, 2016 14:57
A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers.
// StickyHeadersCollectionViewFlowLayout
//
// A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers.
//
// This code is based on Evadne Wu's code^1, with the following changes:
//
// * Fixes a crash for sections with zero items
// * Adds support for UIScrollView's contentInset
// * Adds support for UICollectionViewFlowLayout's sectionInset
//
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active May 27, 2024 12:11
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>