Skip to content

Instantly share code, notes, and snippets.

View ogirginc's full-sized avatar

Oğulcan Girginç ogirginc

View GitHub Profile

Flat rule: any AiTask create = 1 journal credit + 1.5 from credit_balance, unless marked free_of_charge. No per-tool rate card — amounts do not vary by tool name.

Tool / action Creates AiTask? Journal credits credit_balance
Phorest
get_clinics No (no AiTask) 0 0
get_services_for_clinic No (AuditLog only) 0 0
get_providers_for_clinic No (AuditLog only) 0 0
get_available_appointment_slots No (AuditLog only) 0 0
create_client No 0 0
@ogirginc
ogirginc / phind.md
Created May 11, 2023 15:38
Can you explain how HyperLogLog algorithm works with examples in Ruby? (Answered by GTP on phind.com )

The HyperLogLog (HLL) algorithm is a probabilistic data structure used for approximating the number of distinct elements in a multiset while using significantly less memory compared to exact methods Source 3. It is an extension of the earlier LogLog algorithm and derives from the 1984 Flajolet–Martin algorithm Source 3.

The main idea behind the HLL algorithm is to estimate the cardinality of a set by observing the maximum number of leading zeros in the binary representation of each number in the set Source 0. To achieve this, the following steps are taken:

  1. Apply a hash function to each element in the original multiset to obtain a multiset of uniformly distributed random numbers with the same cardinality as the original multiset Source 3.

  2. Split the multiset into multiple subsets (bu

@ogirginc
ogirginc / controllers.application\.js
Created April 13, 2022 09:05
undefined is empty?
import Controller from '@ember/controller';
import { isEmpty } from '@ember/utils';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
xxx = isEmpty(undefined) ? 1 : 2;
}
@ogirginc
ogirginc / tripmode.zsh
Created October 12, 2021 10:26
Display TripMode on Bartender 4, when network name matches.
network_SSID="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | sed -e "s/^ *SSID: //p" -e d)"
phone_name="Ogulcan's Phone"
if [ $network_SSID = phone_name ]; then
echo true
else
echo false
fi
@ogirginc
ogirginc / ember-projections.json
Created May 6, 2021 17:47 — forked from AndrewRadev/ember-projections.json
A `.projections.json` file that can be used with vim-projectionist for navigating ember.js projects
{
"app/initializers/*.js": {
"type": "initializer"
},
"app/models/*.js": {
"type": "model",
"alternate": "app/adapters/{}.js",
},
"app/adapters/*.js": {
"type": "adapter",
@ogirginc
ogirginc / html-editors.md
Created March 4, 2021 10:58 — forked from manigandham/rich-text-html-editors.md
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

  • ProseMirror - http://prosemirror.net - supports collaborative editing, offers similar options to Mobiledoc for data structure
module GivenWhenThen
module ClassMethods
def def_Given(name, *args, &block)
_gwt_define(:Given, name, *args, &block)
end
def def_When(name, *args, &block)
_gwt_define(:When, name, *args, &block)
end
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
@ogirginc
ogirginc / rspec-uncommitted.sh
Created April 25, 2019 10:33 — forked from rwjblue/rspec-uncommitted.sh
Run rspec only on uncommited files. No more accidentally pushing a :focus tag to master!
rspec `git ls-files --modified --others spec`