Skip to content

Instantly share code, notes, and snippets.

View biow0lf's full-sized avatar

Igor Zubkov biow0lf

  • 06:48 (UTC +01:00)
View GitHub Profile
@mrmartineau
mrmartineau / stimulus.md
Last active October 5, 2025 14:09
Stimulus cheatsheet
import re
class Grep:
def __init__(self, pattern):
self.pattern = re.compile(pattern)
def __ror__(self, iterable):
for x in iterable:
if self.pattern.match(x):
yield x
class Wc:
@manjula-dube
manjula-dube / .eslintrc.js
Created February 6, 2018 15:55
.eslintrc.js
// use this format since .eslintrc is deprecated.
// You can logically derive this format.
module.exports = {
parser: 'babel-eslint',
extends: [
'plugin:flowtype/recommended',
'plugin:jest/recommended',
'plugin:react/recommended',
'eslint-config-airbnb',
@DenTelezhkin
DenTelezhkin / MeasureAppStartupTime.swift
Last active September 18, 2025 08:14
Measure iOS app startup time, in seconds, from the time user tapped an icon on the home screen (using time, when app process was created). Swift 4.
// Returns number of seconds passed between time when process was created and function was called
func measureAppStartUpTime() -> Double {
var kinfo = kinfo_proc()
var size = MemoryLayout<kinfo_proc>.stride
var mib : [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()]
sysctl(&mib, u_int(mib.count), &kinfo, &size, nil, 0)
let start_time = kinfo.kp_proc.p_starttime
var time : timeval = timeval(tv_sec: 0, tv_usec: 0)
gettimeofday(&time, nil)
let currentTimeMilliseconds = Double(Int64(time.tv_sec) * 1000) + Double(time.tv_usec) / 1000.0
@denisoster
denisoster / nginx.conf
Last active April 13, 2024 12:17
Nginx+RoR(Puma)+SSL+redirect
upstream site {
server unix:/home/site/web/site.com.ua/site/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name site.com.ua www.site.com.ua;
rewrite ^(.+)$ https://site.com.ua$uri permanent;
}
@anvk
anvk / psql_useful_stat_queries.sql
Last active June 1, 2025 16:17
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@javan
javan / direct-uploads.md
Last active January 9, 2025 01:00
Active Storage direct uploads

direct-uploads

rails/activestorage#81

// direct_uploads.js

addEventListener("direct-upload:initialize", event => {
  const { target, detail } = event
  const { id, file } = detail
@MikeRalphson
MikeRalphson / authentiq2.yaml
Created May 23, 2017 05:52
Authentiq.Io Swagger 2.0 API definition
swagger: '2.0'
info:
title: Authentiq Connect API
version: '1.0'
description: >
Authentiq Connect OAuth 2.0 and OpenID Connect API reference.
Learn about [Authentiq ID](https://www.authentiq.com/) or check out the
[Authentiq Connect](https://developers.authentiq.com) developer
documentation.
@MikeRalphson
MikeRalphson / authentiq3.yaml
Last active April 20, 2019 20:30
Example of converted Swagger 2.0 API definition
openapi: 3.0.0-RC1
servers:
- url: 'https://connect.authentiq.io/'
info:
title: Authentiq Connect API
version: '1.0'
description: >
Authentiq Connect OAuth 2.0 and OpenID Connect API reference.
Learn about [Authentiq ID](https://www.authentiq.com/) or check out the
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <[email protected]>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!