Skip to content

Instantly share code, notes, and snippets.

View emmanuelsw's full-sized avatar
🦊
Working from home

Emmanuel Deossa emmanuelsw

🦊
Working from home
View GitHub Profile
@kyrylo
kyrylo / colorized_logger.rb
Last active January 8, 2025 07:07
Nice colorized logs for Rails apps! With this initializer, you can instantly colorize your Rails development logs. Just copy and paste the code, and it’ll work. https://x.com/kyrylosilin/status/1852308566201237815
# frozen_string_literal: true
# config/initializers/colorized_logger.rb
# This initializer adds color to the Rails logger output. It's a nice way to
# visually distinguish log levels.
module ColorizedLogger
COLOR_CODES = {
debug: "\e[36m", # Cyan
info: "\e[32m", # Green
warn: "\e[33m", # Yellow
@joeldrapper
joeldrapper / keymap.json
Last active March 27, 2025 23:43
My Zed Config
[
{
"context": "Editor",
"bindings": {
"alt-up": "editor::SelectLargerSyntaxNode",
"alt-down": "editor::SelectSmallerSyntaxNode",
"ctrl-cmd-up": "editor::MoveLineUp",
"ctrl-cmd-down": "editor::MoveLineDown"
}
}
@hopsoft
hopsoft / prefetch.js
Last active March 4, 2025 02:01
Turbolinks Prefetching
const hoverTime = 400
const fetchers = {}
const doc = document.implementation.createHTMLDocument('prefetch')
function fetchPage (url, success) {
const xhr = new XMLHttpRequest()
xhr.open('GET', url)
xhr.setRequestHeader('VND.PREFETCH', 'true')
xhr.setRequestHeader('Accept', 'text/html')
xhr.onreadystatechange = () => {
@sulmanweb
sulmanweb / _document.json.jbuilder
Created May 13, 2018 08:04
Active Storage as Attachment in Rails API with base64 decoding
json.extract! document, :id, :documentable_type, :documentable_id, :created_at
json.url rails_blob_url(document.doc)
@stevebauman
stevebauman / Signature.vue
Last active August 9, 2024 14:30
A VueJS Signature canvas field, using szimek/signature_pad
<template>
<div>
<canvas ref="canvas"></canvas>
<div class="clearfix"></div>
<div class="btn-group">
<button @click="clear" type="button" class="btn btn-default">
<i class="fa fa-times"></i>
Clear Signature
@yalab
yalab / bootstrap-memo.md
Last active July 20, 2022 20:29
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add [email protected] jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
@gugat
gugat / devise.es.yml
Last active June 8, 2023 11:32 — forked from rrussell/devise.es.yml
Devise 4.3.0 Spanish Locale
# Traducciones adicionales en https://github.com/plataformatec/devise/wiki/I18n
es:
devise:
confirmations:
confirmed: "Tu correo electrónico ha sido confirmado exitosamente."
send_instructions: "Recibirás un email con las instrucciones para confirmar tu correo electrónico en unos minutos."
send_paranoid_instructions: "Si tu correo electrónico existe en nuestra base de datos, recibirás un email con las instrucciones para confirmar tu correo electrónico en unos minutos."
failure:
already_authenticated: "Ya iniciaste sesión."
@kkiernan
kkiernan / index.html
Last active August 3, 2024 06:38
A Vue.js filter that formats a phone number.
<input type="text"
name="home_phone"
class="form-control"
v-model="homePhone | phone"
lazy>
@dansimco
dansimco / app.rb
Created May 29, 2012 15:09
Concise Sinatra Amazon S3 Upload Example
require "rubygems"
require 'sinatra'
require "aws/s3"
get '/' do
return %Q{
<form action="upload" method="post" accept-charset="utf-8" enctype="multipart/form-data">
<div>
<input type="file" name="file" value="" id="file">
</div>