Skip to content

Instantly share code, notes, and snippets.

View tagliala's full-sized avatar
🏠
Working from home

Geremia Taglialatela tagliala

🏠
Working from home
View GitHub Profile
@yahonda
yahonda / ruby31onrails.md
Last active April 9, 2024 20:46
Ruby 3.1 on Rails

Ruby 3.1 on Rails

Actions required to use Ruby 3.1.0 with Rails

Rails 7.0.Z

  • Rails 7.0.1 is compatible with Ruby 3.1.0.
  • Rails 7.0.1 addes net-smtp, net-imap and net-pop gems as Action Mailbox and Action Mailer dependency, you do not need to add them explicitly in your application Gemfile anymore.
  • thor 1.2.1 has been released. You will not see DidYouMean::SPELL_CHECKERS.merge deprecate warnings anymore.

Rails 6.1.Z

  • Use Rails 6.1.5 to support database.yml with aliases and secrets.yml with aliases.
@rilian
rilian / config-environments-test.rb
Last active October 5, 2019 07:49 — forked from keithtom/no_animations.rb
Rack Middleware to disable Disable CSS3/jQuery Animations for Capybara
Rails.application.configure do
# ...
require_relative '../../spec/support/no_animations'
config.middleware.use Rack::NoAnimations
end
@pixeltrix
pixeltrix / time_vs_datatime.md
Last active February 18, 2024 19:20
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
@krisbulman
krisbulman / countCSSRules.js
Last active August 25, 2022 19:53 — forked from psebborn/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE. — This snippet has been modified to count more than just the first level of CSSStyleRule objects within CSSMediaRule.
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@FrostyX
FrostyX / FacebookDebugger.php
Last active February 9, 2022 11:15
Facebook API - Force facebook to reload cache from your website
<?php
class FacebookDebugger
{
/*
* https://developers.facebook.com/docs/opengraph/using-objects
*
* Updating Objects
*
* When an action is published, or a Like button pointing to the object clicked,
* Facebook will 'scrape' the HTML page of the object and read the meta tags.
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@wilkerlucio
wilkerlucio / example.scss
Last active May 20, 2019 15:12 — forked from darren131/gist:3410875
Compass sprite resize mixin
$my-icons-spacing: 10px; // give some space to avoid little pixel size issues on resize
@import "my-icons/*.png";
$my-icons-sprite-dimensions: true;
@include all-my-icons-sprites;
// the fun part
@chrisvanpatten
chrisvanpatten / cpt-show.php
Created May 3, 2013 17:57
Simple bit of code to register a custom post type. Use as an mu-plugin.
<?php
/*
Plugin Name: show Custom Post Type
Plugin URI: http://www.offbroadway.com/
Description: Custom post type for OffBroadway.com
Author: Van Patten Media
Version: 1.0
Author URI: http://www.vanpattenmedia.com/
*/
@igniteflow
igniteflow / corsdevserver.py
Created April 22, 2013 15:34
A simple CORS compliant web server in Python, useful for development (with @alex-moon)
import BaseHTTPServer
import cgi
from pprint import pformat
PORT = 6969
FILE_TO_SERVE = 'path/to/your/response/content.json'
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""
@pdesterlich
pdesterlich / nomi_italiani.txt
Last active January 6, 2024 11:15
lista nomi italiani
-- DISCLAIMER --
il presente elenco consiste in una raccolta di nomi presenti sul territorio italiano (non necessariamente "italiani")
viene generato prendendo processando automaticamente uno o più archivi anagrafici e non è controllato in alcun modo
è pertanto altamente possibile che ci siano errori o refusi
non è nè pretende di essere un elenco omnicomprensivo di tutti i nomi esistenti
----------------
abaco
abbondanza
abbondanzia