Skip to content

Instantly share code, notes, and snippets.

@beglov
beglov / rubocop_pre_commit_hook
Created May 22, 2020 09:29 — forked from palkan/rubocop_pre_commit_hook
Rubocop pre-commit hook
#!/usr/bin/env ruby
ADDED_OR_MODIFIED = /^\s*(A|AM|M)/.freeze
changed_files = `git status --porcelain`.split(/\n/)
unstaged_files = `git ls-files -m`.split(/\n/)
changed_files = changed_files.select { |f| f =~ ADDED_OR_MODIFIED }
changed_files = changed_files.map { |f| f.split(" ")[1] }
@beglov
beglov / hello_world.py
Created March 19, 2020 12:40
Hello World Examples
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()
@beglov
beglov / SQL
Last active February 20, 2020 20:28
1. С помощью SQL (DDL):
Создайте базу данных test_guru
CREATE DATABASE test_guru;
Таблицу categories с атрибутом title
CREATE TABLE categories (
id serial PRIMARY KEY,
title varchar(30) NOT null
);
@beglov
beglov / HTTP.txt
Last active February 18, 2020 17:28
GET /anything HTTP/1.1
Host: httpbin.org
HTTP/1.1 200 OK
Date: Tue, 18 Feb 2020 17:21:04 GMT
Content-Type: application/json
Content-Length: 285
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *