Skip to content

Instantly share code, notes, and snippets.

View piktur's full-sized avatar

daniel piktur

  • Sydney, Australia
View GitHub Profile
@piktur
piktur / capacitor.diff
Last active April 23, 2024 22:39
Preserve livereload configuration on `npx cap run [platform]`
diff --git a/dist/index.js b/dist/index.js
index 0a12395be65169891d26ca057d26220996b838d6..cc09a49c78718e8239da5de325294dbe6d63644d 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -127,8 +127,9 @@ function runProgram(config) {
.option('-l, --live-reload', 'Enable Live Reload')
.option('--host <host>', 'Host used for live reload')
.option('--port <port>', 'Port used for live reload')
+ .option('--https', 'Enable HTTPS. Used for live reload')
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
@piktur
piktur / MaterialDesignIcon.vue
Created March 10, 2019 12:21
Dynamic Material Design Icon import
import Vue from 'vue'
export default Vue.component('IconMd', {
functional: true,
props: {
id: {
required: true,
type: String,
},
size: {
WITH
q AS (
SELECT
to_tsquery('english', unaccent('Louise:*A')) AS tsquery,
dmetaphone_to_tsquery(string_to_dmetaphone(unaccent('Louise:*'))) AS dmetaphone
)
SELECT
content,
data ->> 'name' AS name,
similarity(trigram, 'Louise'),
/* pg_proc columns
* proname
* pronamespace
* proowner
* prolang
* procost
* prorows
* provariadic
* protransform
* proisagg
@piktur
piktur / twitter-turbolinks.js.coffee
Created January 6, 2019 15:16
Twitter Turbolinks
@piktur
piktur / bechmark-object.rb
Created January 4, 2019 21:32
[BENCHMARK] Object | Object#tap vs local variable assignment
# Warming up --------------------------------------
# Object#tap 83.980k i/100ms
# local variable 89.304k i/100ms
# Calculating -------------------------------------
# Object#tap 1.062M (± 8.1%) i/s - 5.291M in 5.022308s
# local variable 1.144M (± 5.8%) i/s - 5.715M in 5.010945s
#
# Comparison:
# local variable: 1144240.4 i/s
# Object#tap: 1062059.7 i/s - same-ish: difference falls within error
@piktur
piktur / bechmark-array-combine.rb
Created January 4, 2019 21:29
[BENCHMARK] Array | Combine
# Warming up --------------------------------------
# Array#+ 156.643k i/100ms
# Array#flatten 66.463k i/100ms
# * 141.357k i/100ms
# Array#flatten! 59.953k i/100ms
# Array#concat 159.073k i/100ms
# Array#push 162.571k i/100ms
# Array#+= 162.281k i/100ms
# Calculating -------------------------------------
# Array#+ 2.518M (± 4.3%) i/s - 12.688M in 5.048128s
@piktur
piktur / monadic_operations.rb
Created October 30, 2018 04:53
Monadic Operations
# frozen_string_literal: true
require 'spec_helper'
require 'dry/monads'
require 'dry/transaction'
require 'dry/container'
RSpec.describe 'what are we doing' do
let(:container) do
Class.new { include Dry::Container::Mixin }
@piktur
piktur / logger.rb
Last active September 6, 2018 02:18
Piktur | SQL Migrations
def Piktur.logger
@logger ||= ::ActiveSupport::TaggedLogging.new(
::ActiveSupport::Logger.new(
if log_to_stdout?
$stdout
else
f = ::File.open(path, 'a')
f.binmode
# To improve performance in production disable auto flush, writing only when buffer full.
f.sync = !::Piktur.env.production?
@piktur
piktur / results.md
Last active August 22, 2018 20:30
ROM vs ActiveRecord
  => benchmark: Loading ONE user object

  Warming up --------------------------------------
                    AR   237.000  i/100ms
                   ROM   247.000  i/100ms
  Calculating -------------------------------------
                    AR     2.442k (± 1.9%) i/s -     12.324k in   5.048282s
                   ROM     2.487k (± 3.3%) i/s -     12.597k in   5.071429s