Skip to content

Instantly share code, notes, and snippets.

View andreyuhai's full-sized avatar
🏠
Working from home

Burak andreyuhai

🏠
Working from home
View GitHub Profile
@havenwood
havenwood / connection.rb
Created July 7, 2020 01:17
An example HTTP gem connection pool extracted from some of my code for #ruby IRC
@executor = Concurrent::ThreadPoolExecutor.new min_threads: min_threads,
max_threads: max_threads
def connection_pool
@connection_pool ||= ConnectionPool.new size: @pool_size, timeout: @pool_timeout do
HTTP.auth("Bearer #{access_token}")
.persistent(HOST)
.timeout(@http_timeout)
.headers(accept_encoding: ACCEPT_ENCODING)
.use(:auto_inflate)
@wbednarski
wbednarski / rename_phoenix_project.sh
Last active March 22, 2024 07:04 — forked from krystofbe/rename_phoenix_project.sh
rename a phoenix 1.3 project
#!/bin/bash
set -e
CURRENT_NAME="Zauberantrag"
CURRENT_OTP="zauberantrag"
NEW_NAME="Wunderantrag"
NEW_OTP="wunderantrag"
@ServerlessBot
ServerlessBot / IAMCredentials.json
Last active December 20, 2023 16:50
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@isurum
isurum / ProductsController.php
Created July 18, 2017 12:33
Laravel 5.4 Bootstrap row class for every 3 columns - Blade Template
public function showProducts(){
$products = DB::table('products')->paginate(9);
return view('products', ['products' => $products]);
}
@baweaver
baweaver / ruby_books.md
Last active April 24, 2024 19:24
A list of books for learning and expanding on your Ruby knowledge.

Ruby Book List

Learning Ruby

You're taking your first steps into Ruby

A good introduction to programming in general. Easy on newer programmers.

@Tset-Noitamotua
Tset-Noitamotua / .vimrc
Last active March 13, 2024 08:44
Powerline Setup for my VIM
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
" "
" __ _ _ _ __ ___ _ __ ___ "
" \ \ / / | '_ ` _ \| '__/ __| "
" \ V /| | | | | | | | | (__ "
" \_/ |_|_| |_| |_|_| \___| "
" "
" "
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
# lazyload nvm
# all props goes to http://broken-by.me/lazy-load-nvm/
# grabbed from reddit @ https://www.reddit.com/r/node/comments/4tg5jg/lazy_load_nvm_for_faster_shell_start/
lazynvm() {
unset -f nvm node npm npx
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
if [ -f "$NVM_DIR/bash_completion" ]; then
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
@havenwood
havenwood / procs_blocks_and_lambdas.rb
Last active January 12, 2022 22:06
A few examples of Ruby's procs, blocks and lambdas (irc question)
def meth &block
block
end
block = meth { 42 }
prok = proc { 42 }
lamb = lambda { 42 }
block.call
#=> 42
prok.call
@eyecatchup
eyecatchup / colors_material.xml
Last active June 27, 2021 23:18
Android L Material Color Specs
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@mlr
mlr / rspec_rails_cheetsheet.rb
Last active October 26, 2023 14:32 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet with expect syntax (including capybara matchers)
# Model
expect(@user).to have(1).error_on(:username) # checks whether there is an error in username
expect(@user.errors[:username]).to include("can't be blank") # check for the error message
# Rendering
expect(response).to render_template(:index)
# Redirecting