Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<meta charset="utf-8">
<title>Redirecting to https://example.com/</title>
<meta http-equiv="refresh" content="0; URL=https://example.com/">
<link rel="canonical" href="https://example.com/">
@ljones140
ljones140 / gist:c5bbace1c1410cb68ad770c99f318ad6
Last active January 4, 2021 13:53
Ruby Ractor multiple worker example
#!/usr/bin/env ruby
class Upcaser
def process(string)
string.upcase
end
end
class Downcaser
@ljones140
ljones140 / rails_controller.rb
Created November 17, 2016 14:41
Rails controller view path and lookup context prefixes
# While having issues with to_partial_path on a view model giving inconsistent results under differing name spaces of controllers
# I use the below to see that the look up path and view paths were on an controller and modify.
# I've never put the below into production. This is merely something I found while experimenting.
# To sort my issue I used the prefixes avaialable and changed name spacing to give correct behaviour
class SomeController < ApplicationController
# Prepending (or appending) the view path allows you to add the location of view files
before_filter :prepend_view_paths
@ljones140
ljones140 / test.rb
Created October 19, 2016 15:23
test_for_pano_blog
module MyModuleA
puts "MyModuleA defines B? #{MyModuleA.const_defined?(:B)}"
module MyModuleB
puts "MyModuleA::MyModuleB nesting: #{Module.nesting}"
B = 1
puts B

Lewis Jones

A determined and ambitious junior Software Developer with a strong desire to learn.

I strive for quality and craftsmanship in everything I do and am looking for an opportunity to further my knowledge whilst contributing to real-world projects and problem solving.

After working in Retail Logistics for five years, I decided to move into Technology. I taught myself what was needed to get a job in Application Support at Gorkana, and was quickly promoted to Senior Engineer and then Team Lead within two years. During this time I was learning to program Ruby and PHP at home, and wrote some PHP and Perl at work. I realised programming was what I wanted to do, so applied to Makers Academy to accelerate my learning. I am now looking to join a company who will foster my first steps as a junior developer and give me the opportunity and support to develop my craft.

Skills

@ljones140
ljones140 / gist:aeb743fca4bb7934feb2
Last active November 25, 2023 13:59
Google Sheets Calender Export

The script below can be used to export your calender dates from google calender to google sheets.

Turns out google sheets allows you to write scripts as .gs files which is basically javascript with some specific features for querying and editing google docs files. Just like the developer mode in Excel but in a nicer language.

Original script I based this on was found here: http://blog.cloudbakers.com/blog/export-google-calendar-entries-to-a-google-spreadsheet. I edited it for my needs.

To use open a new file in google sheets, click on tools > script editor. Paste the code in and put your email address and the date range you want.

Select export_gcal_to_gsheet and click play.

@ljones140
ljones140 / gist:7c36e2f349450a2700bb
Created October 9, 2015 11:06
Ubuntu Postgres set up for rails
WIll not work first of all as the ubuntu user needs to be given the permission to create databases.
in postgres \du will tell you what users you have and what their roles are
ALTER USER ubuntu WITH SUPERUSER;
When up and running there may a furtehr change required to change the encoding:
https://gist.github.com/amolkhanorkar-webonise/8706915
@ljones140
ljones140 / gist:5680d652ab5e244e6838
Last active October 11, 2015 14:06
Rails Turbolinks affecting JS and Foundation
On my instagram clone I used foundation for the styling and created a topbar element with a links to the index page, logon, and sign up.
There was a strange issue that If I clicked on any of the links on the page the page would reload with the top
part of the page being under the topbar. Also I would get rails JS errors if my like link (which uses JS) was clicked.
The strange thing however was that I refresh the page or go to the url directly I would not have an issue.
After googling around I discovered the issue was caused by Turbo links.
From what I understand Turbo links tries to make your website act like a single page app however this messes around
with JQuery as it loads the page in a differen way froma normal refresh so JQuery $(document).ready does not get called.
This stopped my JS from working and Foundation also has it's own JS/Jquery for making things look nice etc.