Skip to content

Instantly share code, notes, and snippets.

View srbdev's full-sized avatar

sb srbdev

View GitHub Profile
defmodule ApiRouter do
use Plug.Router
plug Plug.Logger
plug :match
plug :dispatch
get "/" do
send_resp(conn, 200, "Hello, API!")
end
defmodule Api do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
require Logger
def start(_type, _args) do
# List all child processes to be supervised
def deps do
[
{:plug_cowboy, "~> 2.0"}
]
end
@srbdev
srbdev / beautiful_soup.py
Created March 1, 2020 02:25
Beautiful Soup example for Medium article
import requests
from bs4 import BeautifulSoup
page = requests.get('https://some-url/')
soup = BeautifulSoup(page.text, 'html.parser')
links = soup.find_all('a', class_='links')
for link in links:
id = link.get('id')
@srbdev
srbdev / .vimrc_gitgutter
Created October 15, 2019 13:03
.vimrc setup for gitgutter
" GitGutter styling to use · instead of +/-
let g:gitgutter_sign_added = '∙'
let g:gitgutter_sign_modified = '∙'
let g:gitgutter_sign_removed = '∙'
let g:gitgutter_sign_modified_removed = '∙'
@srbdev
srbdev / .vimrc_lightline
Last active October 15, 2019 13:03
.vimrc lightline setup
" Lightline
set noshowmode
let g:lightline = {
\ 'colorscheme': 'nord',
\ 'active': {
\ 'left': [['mode', 'paste'], ['filename', 'modified']],
\ 'right': [['lineinfo'], ['percent'], ['readonly']]
\ },
\ 'component_expand': {
\ },

Keybase proof

I hereby claim:

  • I am srbdev on github.
  • I am srbdev (https://keybase.io/srbdev) on keybase.
  • I have a public key whose fingerprint is 26FA 6476 C131 D4A2 E6FD A21B B6F3 62BC 368D 3117

To claim this, I am signing this object:

@srbdev
srbdev / mysql_reset.md
Created June 20, 2017 14:43
Reset the root password for mysql on Mac OS X (installed with Homebrew)
$ mysql.server restart --skip-grant-tables
$ mysql
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('password'), password_expired = 'N' WHERE User = 'root' AND Host = 'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit
$ mysql -u root -p
var filterOnInput = function(element, listId, filteredClass) {
var value = $(element).val();
// extending $'s contains to support filtering case insensitive
jQuery.expr[':'].containsi = jQuery.expr.createPseudo(function (arg) {
return function(e) {
return jQuery(e).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
const freeze = obj => JSON.parse(JSON.stringify(obj))