Skip to content

Instantly share code, notes, and snippets.

View Wojcirej's full-sized avatar

Wojciech Bal Wojcirej

  • Rzeszów, Poland
View GitHub Profile
sudo mount /dev/sda2 /mnt #Replace sda2 with your linux partition number
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
sudo chroot /mnt
update-grub
grub-install /dev/sda
update-grub
exit
sudo reboot
@Wojcirej
Wojcirej / .eslintrc.js
Created October 24, 2019 18:13 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
,@@@@@@@@@@,,@@@@@@@% .#&@@@&&.,@@@@@@@@@@, %@@@@@@%* ,@@@% .#&@@@&&. *&@@@@&( ,@@@@@@@% %@@@@@, ,@@,
,@@, ,@@, ,@@/ ./. ,@@, %@% ,&@# .&@&@@( .@@/ ./. #@&. .,/ ,@@, %@% *&@&. ,@@,
,@@, ,@@&%%%%. .&@@/, ,@@, %@% ,&@# %@& /@@, .&@@/, (@@&%(*. ,@@&%%%%. %@% &@# ,@@,
,@@, ,@@/,,,, ./#&@@@( ,@@, %@@@@@@%* /@@, #@&. ./#&@@@( *(%&@@&. ,@@/,,,, %@% &@# .&&.
,@@, ,@@, ./, .&@# ,@@, %@% ,@@@@@@@@@% ./. .&@# /*. /@@. ,@@, %@% *&@&. ,,
,@@, ,@@@@@@@% .#&@@@@&/ ,@@, %@% .&@# ,@@/.#&@@@@&/ /%&@@@@. ,@@@@@@@% %@@@@@. ,@@,
,*************,,*/(((((//,,*(#%%%%%%%%%%%%%%%#(*,,,****************************************************,*/(((((((((/((((////****/((##%%%%%%
,*************,,//((((((//,,*(%%%%%%%%%%%%%%%%%##/
@Wojcirej
Wojcirej / capybara cheat sheet
Created November 6, 2018 20:26 — forked from zhengjia/capybara cheat sheet
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')
@Wojcirej
Wojcirej / gist:8c198dd7901bbefe0a1c95d21b27305d
Created June 4, 2018 14:26 — forked from jiggneshhgohel/gist:52bcd562e937ec4dad7b
Devise Security Extension Schema Migrations

Assuming you already have a Devise model named User and you want to add following Devise Security Extension to it

  • Password Expirable
  • Password Archivable
  • Session Limitable

then your User model should look like following:

User model

@Wojcirej
Wojcirej / ultimate-ut-cheat-sheet.md
Created April 18, 2018 14:22 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@Wojcirej
Wojcirej / cssSelectorPriority.md
Created February 27, 2018 14:34 — forked from mjj2000/cssSelectorPriority.md
css selector priority

css selector priority

priority selector example
1 inline style in html tag <div style="color:red">
2 tag#id div#myID { color:red; }
3 #id .myID { color:red; }
4 tag.class div.myClass { color:red; }
5 .class .myClass { color:red; }
6 tag div { color:red; }

Transactions

As your business logic gets complex you may need to implement transactions. The classic example is a bank funds transfer from account A to account B. If the withdrawal from account A fails then the deposit to account B should either never take place or be rolled back.

Basics

All the complexity is handled by ActiveRecord::Transactions. Any model class or instance has a method named .transaction. When called and passed a block, that block will be executed inside a database transaction. If there's an exception raised, the transaction will automatically be rolled back.

Example

@Wojcirej
Wojcirej / Capybara.md
Created November 23, 2017 15:24 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@Wojcirej
Wojcirej / saveimages.rb
Created October 19, 2017 19:22 — forked from kfox/saveimages.rb
A quick Ruby script to download PNG, GIF, or JPEG images from a given URL
#!/usr/bin/env ruby
# usage: saveimages.rb <url>
# locally save all images from a web site
require 'nokogiri'
require 'open-uri'
exit if ARGV[0].nil?