Skip to content

Instantly share code, notes, and snippets.

View mariozugaj's full-sized avatar

Mario Zugaj mariozugaj

View GitHub Profile
@convexset
convexset / commit-msg
Last active July 27, 2018 09:48
git hook for commit-msg to use ESLint as a soft guard of code quality (lets things pass if the committer is committed to committing)
#!/bin/bash
# Uses ESLint as a soft guard of code quality for your repo
# allows commits to go through if re-attempted within a pre-set interval
# copy to .git/hooks/commit-msg to have things work
# Based on: https://gist.github.com/wesbos/8aec9d2ff7f7cf9dd65ca2c20d5dfc23
PRESET_TIME_INTERVAL=60
@sheharyarn
sheharyarn / api_controller.rb
Last active January 18, 2021 15:13
API Authentication with Devise in Rails
class API::BaseController < ApplicationController
def index
render json: { active: true }
end
def authenticate
if user = User.authenticate(request.headers['X-AUTH-TOKEN'])
sign_in(user, store: false)
@nickytonline
nickytonline / .gitconfig
Last active February 17, 2021 03:34
Git Aliases
alias.a add .
alias.aliases config --get-regexp alias
alias.bi bisect
alias.ci commit -m
alias.co checkout
alias.colast checkout -
alias.db branch -D
alias.laf fsck --lost-found
alias.last log -1 HEAD
alias.nb checkout -b
@Nakilon
Nakilon / checklist.md
Last active May 28, 2021 12:49
new macOS configuration checklist
  • настроить все в System Preferences, например

    • выключить Correct spelling automatically
    • инвертировать кнопку Fn
    • поставить раскладки "США" (на новых макбуках тильды будет слева внизу) и "Русская - ПК"
  • выключить ускорение указателя трекпада и перелогиниться

    defaults write .GlobalPreferences com.apple.trackpad.scaling -1
  • настроить Finder (войти в настройки любой программы в Mac OS можно комбинацией ⌘,)

@dbridges
dbridges / _comment.html.slim
Last active August 25, 2022 18:51
Stimulus.js and Rails remote forms with error handling
- # app/views/comments/_comment.html.slim
li data-controller="comment" data-action="click->comment#hello"
= "#{comment.message} by #{comment.user.email}"
@sheharyarn
sheharyarn / request.js
Last active August 24, 2023 14:55
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@broofa
broofa / pre-commit
Last active February 23, 2024 08:55
Git pre-commit hook that runs `eslint` with the `--fix` option to fix up issues where possible, and adds "fix"ed files into the commit
#!/bin/bash
cd "$(git rev-parse --show-toplevel)"
ESLINT="node_modules/.bin/eslint"
pwd
if [[ ! -x "$ESLINT" ]]; then
printf "\t\033[41mPlease install ESlint\033[0m (npm install eslint)\n"
exit 1
fi
@robzolkos
robzolkos / Dockerfile
Last active March 2, 2024 20:59
Kamal / SQLite3 issue
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.2
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# Rails app lives here
WORKDIR /rails
# Set production environment