Skip to content

Instantly share code, notes, and snippets.

View piclez's full-sized avatar

Peter WD piclez

View GitHub Profile
@romeuhcf
romeuhcf / csv_with_bom.rb
Last active November 14, 2021 00:30
Ruby 2.5 support for opening csv with bom|utf-8
class CSV
def self.open(file, options={}, &block)
encoding = options.delete(:encoding)
File.open(file, "r:#{encoding}") do |fd|
yield CSV.new(fd, options)
end
end
end
@kauffmanes
kauffmanes / install_anaconda.md
Last active June 24, 2025 03:41
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li
@mrluizandre
mrluizandre / pt-BR.yml
Last active July 9, 2025 16:55
Rails locale file for brazilian portuguese language pt-BR.yml
---
pt-BR:
activerecord:
errors:
messages:
record_invalid: 'A validação falhou: %{errors}'
restrict_dependent_destroy:
has_one: Não é possível excluir o registro pois existe um %{record} dependente
has_many: Não é possível excluir o registro pois existem %{record} dependentes
date:
@julianrubisch
julianrubisch / Gemfile
Last active September 13, 2019 16:39
Hooking up Dropzone.js with ActiveStorage DirectUpload via Stimulus.js
source 'https://rails-assets.org' do
gem 'rails-assets-dropzone'
end
@abhilashak
abhilashak / nested_content_snippet.rb
Last active October 28, 2023 21:06 — forked from bunnymatic/nested_content_snippet.rb
Nested content tags in rails 5 view helpers
# because i can never remember exactly how and when to use concat
# when building content in helpers
def nested_content
content_tag 'div' do
concat(content_tag 'span', 'span block')
concat(tag 'br')
concat(link_to 'root link', root_path)
concat(tag 'br')
concat(link_to('#') do
concat(content_tag 'h2', 'Head \'em off')
@maxivak
maxivak / date_time_picker_rails.md
Last active March 7, 2022 19:36
Datetime picker in Rails app

Date time picker in Rails app

There are several options to make Date input in Rails application:

  • Default inputs from simple_form
  • HTML 5 date input
  • Text input with jQuery UI Date time picker
  • Other plugins for date input with Bootstrap 4
@agutoli
agutoli / provision.sh
Last active January 29, 2019 03:44
Install phpbrew php5.3.29 at Ubuntu 14.04
#!/bin/bash
# ========================================================================
# Distributor ID: Ubuntu
# Description: Ubuntu 14.04.5 LTS
# Release: 14.04
# Codename: trusty
# ========================================================================
# PHP 5.3.29-Ubuntu/14.04-SergeyD/14.4 (cli) (built: Sep 6 2017 15:48:58)
# Copyright (c) 1997-2014 The PHP Group
# Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies
@Chocksy
Chocksy / kill_sidekiq_job.rb
Last active May 3, 2025 08:40
Kill sidekiq jobs by process id for busy jobs and by jid for other sets.
# FOR BUSY JOBS
# take the process_id from the /busy page in sidekiq and kill the longest running one.
workers = Sidekiq::Workers.new
long_process_id = 'integration.3:4:71111aaa111' # Eg: 'integration.3:4:71d1d7f4ef5a'
workers.each do |process_id, thread_id, work|
process = Sidekiq::Process.new('identity' => process_id)
process.stop! if process_id == long_process_id
end
# FOR SCHEDULED JOBS
@eddroid
eddroid / rapid.md
Last active October 1, 2023 01:57
Rapid Prototyping with Rails

Rapid Prototyping with Rails

At Wyncode we turn people into full-stack web developers in 10 weeks. So we've learned a few tricks to get from 0 to webapp quickly.

Install Ruby and Rails

Generate the app skeleton

@ChrisLTD
ChrisLTD / docker-compose.yml
Last active November 14, 2020 00:37
Docker Compose for WordPress with Data Persistence
# Docker Compose for WordPress with Data Persistence
#
# Resources
# https://medium.com/@tatemz/local-wordpress-development-with-docker-3-easy-steps-a7c375366b9
# https://hub.docker.com/_/wordpress/
# https://hub.docker.com/r/_/mariadb/
# https://stackoverflow.com/a/39208187/648844
# https://github.com/nezhar/wordpress-docker-compose
#
version: "2"