Skip to content

Instantly share code, notes, and snippets.

View lain0's full-sized avatar

Sergei Rogulev lain0

View GitHub Profile
@searls
searls / whereable.rb
Created September 4, 2021 16:06
The initial implementation of a Whereable query filter for KameSame.
class Whereable
def initialize(where:, model: Item, ranking_conditions: [], valid: true, data_source: nil)
@model = model
@where = where
@data_source = data_source
@ranking_conditions = ranking_conditions
@valid = valid
end
def valid?
@danielwetan
danielwetan / nodejs-cicd-github-actions.md
Last active November 15, 2024 17:37
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@cjavdev
cjavdev / define_method.rb
Created January 20, 2021 22:49
code for an video about define_method: https://youtu.be/I0itVuoprAY
class ModelBase
def self.enum(**kwargs)
kwargs.each do |key, values|
define_method("#{key}=") do |v|
if values.include?(v)
instance_variable_set("@#{key}", v)
else
raise "Not a valid status: #{v}"
end
end
@gullyn
gullyn / flappy.html
Last active May 4, 2024 15:35
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@Jack-Works
Jack-Works / 2018.js
Last active March 1, 2024 02:23
cRAzY eSnEXt (*all* proposals mixed in)
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator
|> do { // https://github.com/tc39/proposal-do-expressions
case(?) { // https://github.com/tc39/proposal-pattern-matching
when {val}: class {
interface UseApiResult<
T,
TExecuteFactory extends (...args: any) => Promise<T | undefined>,
TError = any
> {
result: Ref<T | null>;
isLoading: Ref<boolean>;
error: Ref<TError | null>;
execute: TExecuteFactory;
}
@vtrifonov-esfiddle
vtrifonov-esfiddle / cloud-init.yaml
Last active January 5, 2024 17:42
cloud-init config for ubuntu host with docker & docker-compose
#cloud-config
groups:
- docker
users:
- default
# the docker service account
- name: docker-service
groups: docker
package_upgrade: true
packages:
@palkan
palkan / .rubocop_strict.yml
Created March 18, 2020 20:29
rubocop-strict config
# Inherit from TODO here to make sure we enforce the rules below
# (and TODO is ignored)
inherit_from:
- .rubocop_todo.yml
Lint/Debugger: # don't leave binding.pry
Enabled: true
Exclude: []
RSpec/Focus: # run ALL tests on CI
@nicks9188
nicks9188 / LC_CTYPE.md
Created May 6, 2019 13:51
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
  1. vi /etc/environment

add these lines...

LANG=en_US.utf-8
LC_ALL=en_US.utf-8

Alternatively,

@mattmc3
mattmc3 / modern_sql_style_guide.md
Last active November 14, 2024 20:21
Modern SQL Style Guide
layout author title revision version description
default
mattmc3
Modern SQL Style Guide
2019-01-17
1.0.1
A guide to writing clean, clear, and consistent SQL.

Modern SQL Style Guide