Skip to content

Instantly share code, notes, and snippets.

View nicbet's full-sized avatar

Nicolas Bettenburg nicbet

View GitHub Profile
@nicbet
nicbet / Dockerfile
Created June 27, 2019 03:00
Elixir 1.9 Releases Alpine Linux Docker Multi-Stage Build
# ---- Build Stage ----
FROM erlang:22-alpine AS app_builder
# Set environment variables for building the application
ENV MIX_ENV=prod \
TEST=1 \
LANG=C.UTF-8
# Fetch the latest version of Elixir (once the 1.9 docker image is available you won't have to do this)
RUN set -xe \
@wicky-andrian
wicky-andrian / bulma-example-toggle-menu-js.markdown
Last active June 3, 2023 14:31
rails bulma-example-menu-toggle-menu-js
// The following code is based off a toggle menu by @Bradcomp
// source: https://gist.github.com/Bradcomp/a9ef2ef322a8e8017443b626208999c1
(function() {
    var burger = document.querySelector('.burger');
    var menu = document.querySelector('#'+burger.dataset.target);
    burger.addEventListener('click', function() {
        burger.classList.toggle('is-active');
        menu.classList.toggle('is-active');
    });
@andyyou
andyyou / rails_webpacker_bootstrap_expose_jquery.md
Last active August 9, 2022 07:38
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collects all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
@samdenty
samdenty / README.MD
Last active November 11, 2021 04:57
VS Code CSS addition to increase readability on file tree.

How to install

Custom CSS plugin

Install the custom CSS plugin, then make a file on your computer that will hold your custom CSS, I like to make one in my home directory called ~/.vscodestyles.css and then add the CSS into it.

Once done, open your command palette and select enable custom CSS and JS

@geekcui
geekcui / macOS High Sierra 10.13.3 install TensorFlow 1.5.0 with GPU support.md
Last active February 8, 2024 23:24
macOS High Sierra 10.13.3 install TensorFlow 1.5.0 with GPU support
@bwindels
bwindels / contentinputevent.html
Created October 8, 2015 13:50
Prototype of a restrictive contenteditable editor in JS/HTML
<!DOCTYPE html>
<html>
<body>
<p>The dog <span id="edit" contenteditable="true">sleeps on</span> the sofa</p>
<script type="text/javascript">
var handler = {
onBackspace: function() {
console.log("backspace");
},
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# gem 'pry-byebug' # Integrates pry with byebug
# gem 'pry-doc' # Provide MRI Core documentation
# gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB
# gem 'pry-rescue' # Start a pry session whenever something goes wrong.
# gem 'pry-theme' # An easy way to customize Pry colors via theme files
# end
@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active March 7, 2024 03:56
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one