Skip to content

Instantly share code, notes, and snippets.

View mguinada's full-sized avatar

Miguel Guinada mguinada

  • BeBanjo
  • Lisbon, Portugal
View GitHub Profile
@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
(ns css.core
(:require [garden.core :refer [css]]
[garden.stylesheet :refer [at-keyframes at-media]]))
(def styles (atom {})) ;; styles cache
;; ignore this code, it generates unique short class names
(def cls->id (atom {}))
(def vc* (atom {:id 0
@athos
athos / deps.edn
Last active June 2, 2024 08:57
Try on your terminal `clojure -Sdeps '{:deps {hello-clojure/hello-clojure {:git/url "https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202" :git/sha "099bdf7d565b2c35c1df601abf58514cc5276237"}}}' -M -m hello-clojure`
{:paths ["."]
:deps {clansi/clansi {:mvn/version "1.0.0"}}}

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

@shiroyasha
shiroyasha / dog.rb
Created February 16, 2016 22:20
Method tracer for Ruby classes
class Dog
attr_writer :name
def initialize(name)
@name = name
end
def bark
puts "patrick"
end
@loganlinn
loganlinn / core.cljs
Last active August 29, 2015 14:04
2048 with om, om-tools
(ns om-2048.core
(:require-macros
[cljs.core.async.macros :refer [go go-loop]])
(:require
[clojure.string :as str]
[cljs.core.async :as async :refer [<!]]
[dommy.core :as dommy]
[om.core :as om]
[om-tools.core :refer-macros [defcomponentk]]
[om-tools.dom :as dom :include-macros true]))
@john2x
john2x / 00_destructuring.md
Last active July 9, 2024 01:38
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

$ rails console
Loading development environment (Rails 3.0.6)
ruby-1.8.7-p334 :001 > r = Rails.application.routes
Gives you a handle of all the routes (config/routes.rb)
#Inspect a named route:
ruby-1.8.7-p334 :005 > r.recognize_path(app.destroy_user_session_path)
=> {:action=>"destroy", :controller=>"sessions"}
@nickleefly
nickleefly / vagrant-docker-ssh.md
Last active April 11, 2020 05:27
vagrant docker ssh

Vagrant Docker

If you are build a saas, using VMs and management tools. You will find vagrant is useful for additional features.

But Virtual machines take too much time to load. Now there is a new trending called using docker. Docker is written in go, if you haven't heard of, you should probably go to check it out. In this article I am going to run a docker container in vagrant virtual machine

What is vagrant

Vagrant is a tool for building complete development environments. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the "works on my machine" excuse a relic of the past.

@metaskills
metaskills / sprockets.rb
Created February 16, 2014 02:14
Do Not Cache Rails/Sprockets Assets In Development
# In config/initializers/sprockets.rb
require 'sprockets'
require 'sprockets/server'
Sprockets::Server.class_eval do
private
def headers_with_rails_env_check(*args)