This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ============================================================================= | |
-- Basic Editor Settings | |
-- ============================================================================= | |
vim.g.mapleader = ' ' | |
vim.opt.number = true | |
vim.opt.tabstop = 2 | |
vim.opt.shiftwidth = 2 | |
vim.opt.expandtab = true | |
-- ============================================================================= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query = \ | |
'query CompareBranches($owner: String!, $repo: String!, $baseRef: String!, $headRef: String!, $cursor: String) { | |
repository(owner: $owner, name: $repo) { | |
base: ref(qualifiedName: $baseRef) { | |
compare(headRef: $headRef) { | |
status | |
aheadBy | |
commits(first: 1, after: $cursor) { | |
nodes { | |
oid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:3.0.4-bullseye | |
ENV VOLTA_HOME="/opt/.volta" PATH="/opt/.volta/bin:/usr/local/bin:$PATH" | |
RUN curl https://get.volta.sh | bash && volta install node yarn | |
RUN mkdir /app | |
RUN useradd app --create-home --shell /bin/bash && \ | |
chown -R app:app /app | |
WORKDIR /app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark/ips' | |
def one(a, b) | |
a.quo(b).ceil | |
end | |
def two(a, b) | |
- (a.div(-b)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def initialize | |
@ary = [] | |
end | |
def size | |
@ary.size | |
end | |
def top |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Access < ApplicationRecord | |
module Aggs | |
class << self | |
# SELECT | |
# DISTINCT | |
# "accesses"."user_token", | |
# FIRST_VALUE("accesses"."access_date") OVER (PARTITION BY "accesses"."user_token" ORDER BY "accesses"."access_date") AS first_access | |
# FROM "accesses" | |
# WHERE | |
# "accesses"."access_date" BETWEEN '2000-01-01' AND '2000-02-01' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mail = Mail.new(**) | |
File.open("tmp/mail.html", "w") { |f| f.write(mail.html_part.body.decoded)} | |
File.open("tmp/mail.txt", "w") { |f| f.write(mail.text_part.body.decoded.force_encoding(mail.content_type_parameters["charset"]).encode("UTF-8"))} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem . | Where-Object { $_.BaseName -like "1*" } | measure -Sum Length | |
Get-ChildItem . | Where-Object {($_.Extension -like ".jsx" )} | measure -Sum Length | |
Get-ChildItem . | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-7))} | measure -Sum Length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CallWith | |
def call_with(method) | |
module_eval <<~RUBY | |
def self.#{method}(*args, **kwargs) | |
private_class_method :new | |
new(*args, **kwargs).public_send(:'#{method}') | |
end | |
RUBY | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "uri" | |
require "json" | |
require "net/http" | |
module GoogleChatWebHook | |
class Client | |
attr_reader :response, :thread_name | |
def initialize(url, thread_name: nil) | |
@url = URI.parse(url) | |
@request = Net::HTTP::Post.new(@url) |
NewerOlder