Skip to content

Instantly share code, notes, and snippets.


Mario Zugaj mariozugaj

View GitHub Profile
dbridges / _comment.html.slim
Last active Aug 25, 2022
Stimulus.js and Rails remote forms with error handling
View _comment.html.slim
- # app/views/comments/_comment.html.slim
li data-controller="comment" data-action="click->comment#hello"
= "#{comment.message} by #{}"
mrmartineau /
Last active Sep 22, 2022
Stimulus cheatsheet
sheharyarn / api_controller.rb
Last active Jan 18, 2021
API Authentication with Devise in Rails
View api_controller.rb
class API::BaseController < ApplicationController
def index
render json: { active: true }
def authenticate
if user = User.authenticate(request.headers['X-AUTH-TOKEN'])
sign_in(user, store: false)
View request.js
* Axios Request Wrapper
* ---------------------
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
import axios from 'axios'
broofa / pre-commit
Last active May 2, 2022
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
View pre-commit
cd "$(git rev-parse --show-toplevel)"
if [[ ! -x "$ESLINT" ]]; then
printf "\t\033[41mPlease install ESlint\033[0m (npm install eslint)\n"
exit 1
convexset / commit-msg
Last active Jul 27, 2018
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)
View commit-msg
# 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:
View .gitconfig
alias.a add .
alias.aliases config --get-regexp alias bisect commit -m checkout
alias.colast checkout -
alias.db branch -D
alias.laf fsck --lost-found
alias.last log -1 HEAD
alias.nb checkout -b
Nakilon /
Last active May 28, 2021
new macOS configuration checklist
  • настроить все в System Preferences, например

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

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

PurpleBooth /
Last active Oct 4, 2022
A template to make good

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


ryansobol / gist:5252653
Last active Sep 2, 2022
15 Questions to Ask During a Ruby Interview
View gist:5252653

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.