Skip to content

Instantly share code, notes, and snippets.

View mapreal19's full-sized avatar
🎯
Focusing

Mario Pérez Alarcón mapreal19

🎯
Focusing
View GitHub Profile
@db0sch
db0sch / regenerate_credentials.md
Last active July 30, 2024 12:59
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
@mbrochh
mbrochh / some_test.js
Last active February 8, 2024 13:02
Controlling a Stripe payent popup with Cypress.io
// for this to work you need to set `"chromeWebSecurity": false` in cypress.json
describe('Make Stripe Payment', function() {
before(function() {
cy.visit('http://localhost:3000/en/stripe/checkout/')
Cypress.Cookies.preserveOnce('sessionid')
})
it('should enter credit card details and finalise payment', function() {
cy.get('[data-test="button-FormStripeCart-PayWithCreditCard"]').click()
@alex35mil
alex35mil / 1-styles.css
Created April 18, 2017 06:41
CSS Modules + PostCSS + Webpack
:root {
--my-width: 400px;
}
:export {
myWidth: var(--my-width);
}
.myClass {
width: var(--my-width);
@jfmengels
jfmengels / lodash-fp-documentation.md
Last active January 15, 2025 00:34
Generated docs for Lodash/fp. Help make them better at https://github.com/jfmengels/lodash-fp-docs
@jonnyreeves
jonnyreeves / cookie_read_test.go
Created February 4, 2016 09:50
Testing Cookie Writes in Golang
@adsteel
adsteel / run_circle_ci_locally.md
Last active March 28, 2019 21:43
Run CircleCI Locally

SSH into the tests, run them locally in a browser

Get dependencies

$ brew install caskroom/cask/brew-cask
$ brew cask install chicken

Run tests in SSH on CircleCI

  • Rebuild your tests from the rebuild drop menu, selecting "Rebuild with SSH"
# http://blog.honeybadger.io/benchmarking-exceptions-in-ruby-yep-theyre-slow
# $ ruby -v
# ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin13]
#
# $ ruby benchmark.rb
# Calculating -------------------------------------
# method exception 41.808k i/100ms
# begin exception 40.051k i/100ms
# break 99.442k i/100ms
@justin808
justin808 / pgk.zsh
Last active April 10, 2017 23:04
Script to kill errant rails development processes
export PROCESSES_TO_QUIT='bpos puma rake sidekiq spring rails$ ruby-debug phantomjs zeus passenger guard resque "node server.js" ruby$ node foreman fsevent_wat'
pgr() {
echo "Finding processes in list: $PROCESSES_TO_QUIT"
echo $PROCESSES_TO_QUIT | xargs -n 1 pgrep -l
}
pgk() {
echo "Killing processes in list: $PROCESSES_TO_QUIT"
echo $PROCESSES_TO_QUIT | xargs -n 1 pkill -l
@Couto
Couto / webpack.js
Last active November 7, 2024 13:10
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@tmichel
tmichel / email_test.go
Created October 12, 2014 11:58
Sending and testing email in Go -- appendix
package email
import (
"net/smtp"
"testing"
)
type EmailConfig struct {
Username string
Password string