Skip to content

Instantly share code, notes, and snippets.

View sergio1990's full-sized avatar
πŸ‡ΊπŸ‡¦

Serhii Herniak sergio1990

πŸ‡ΊπŸ‡¦
View GitHub Profile
@pugson
pugson / .zshrc
Created May 27, 2016 11:23
Adds arrow on new line in zsh prompt
PROMPT="$PROMPT \
%{$terminfo[bold]$fg[red]%}β†’ %{$reset_color%}"
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active January 9, 2025 12:22
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@JEG2
JEG2 / pub_sub.exs
Created February 22, 2016 15:49
An example pub/sub server in Elixir.
defmodule PubSubServer do
def start(subscriber_callback \\ nil) do
spawn(__MODULE__, :run, [[ ], subscriber_callback])
end
def subscribe(server, handler) do
send(server, {:subscribe, self})
listen(handler)
end
@parmentf
parmentf / GitCommitEmoji.md
Last active April 19, 2025 05:11
Git Commit message Emoji

Inspired by dannyfritz/commit-message-emoji

See also gitmoji.

Commit type Emoji
Initial commit πŸŽ‰ :tada:
Version tag πŸ”– :bookmark:
New feature ✨ :sparkles:
Bugfix πŸ› :bug:
@solnic
solnic / am_dry_validation_1.rb
Last active May 21, 2022 13:42
dry-validation vs activemodel
require 'benchmark/ips'
require 'active_model'
require 'virtus'
require 'dry-validation'
require 'dry/validation/schema/form'
class User
include ActiveModel::Validations
include Virtus.model
@patik
patik / how-to-squash-commits-in-git.md
Last active May 30, 2024 07:59
How to squash commits in git

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@alanpeabody
alanpeabody / my_app.ex
Last active February 19, 2025 16:29
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@jsylvanus
jsylvanus / gist:caec49dd76b6299f935b
Last active April 26, 2018 20:19
Squint test w/ BLOKK font
" Throw me in your ~/.gvimrc
let g:squinty = 0
function! Squint()
let windowBounds = system("osascript -e 'tell application \"MacVim\" to get bounds of window 1'")[:-2]
if g:squinty
set guifont=InputMonoCondensed_Thin:h14
let g:squinty = 0
else
set guifont=BLOKK:h6
@danawoodman
danawoodman / 1-react-websockets-reflux.md
Last active August 21, 2024 20:58
Using WebSockets with Reflux and React

WebSockets + Reflux + React

Using WebSockets, React and Reflux together can be a beautiful thing, but the intial setup can be a bit of a pain. The below examples attempt to offer one (arguably enjoyable) way to use these tools together.

Overview

This trifect works well if you think of things like so:

  1. Reflux Store: The store fetches, updates and persists data. A store can be a list of items or a single item. Most of the times you reach for this.state in react should instead live within stores. Stores can listen to other stores as well as to events being fired.
  2. Reflux Actions: Actions are triggered by components when the component wants to change the state of the store. A store listens to actions and can listen to more than one set of actions.
@jcasimir
jcasimir / .gitignore
Last active March 1, 2024 08:01
Running all MiniTest Tests with SimpleCov
test/coverage/