Skip to content

Instantly share code, notes, and snippets.

Avatar

Mario Zugaj mariozugaj

View GitHub Profile
@dbridges
dbridges / _comment.html.slim
Last active Oct 12, 2021
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 #{comment.user.email}"
@mrmartineau
mrmartineau / stimulus.md
Last active Jan 18, 2022
Stimulus cheatsheet
View stimulus.md
@sheharyarn
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 }
end
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
broofa / pre-commit
Last active Oct 8, 2021
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
#!/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
@convexset
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
#!/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
View .gitconfig
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
new macOS configuration checklist
View checklist.md
  • настроить все в System Preferences, например

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

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

@PurpleBooth
PurpleBooth / README-Template.md
Last active Jan 23, 2022
A template to make good README.md
View README-Template.md

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.

Prerequisites

@ryansobol
ryansobol / gist:5252653
Last active Jan 18, 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.