Skip to content

Instantly share code, notes, and snippets.

View olleolleolle's full-sized avatar
🙌
In sunny Malmö in Sweden 🌞

Olle Jonsson olleolleolle

🙌
In sunny Malmö in Sweden 🌞
View GitHub Profile
@olleolleolle
olleolleolle / install_chromedriver.sh
Created February 22, 2024 10:43
Ready-to-use script, save it as script/circleci/install_chromedriver.sh
#!/bin/bash
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
# determine_chrome_version
if uname -a | grep Darwin >/dev/null 2>&1; then
echo "System detected as MacOS"
if [ -f "/usr/local/bin/google-chrome-stable" ]; then
CHROME_VERSION="$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version)"
else
CHROME_VERSION="$(/Applications/Google\ Chrome\ Beta.app/Contents/MacOS/Google\ Chrome\ Beta --version)"
begin
require "nokogiri"
rescue LoadError
abort "Nokogiri not found. Oh, you may need to 'gem install nokogiri'. Quitting."
end
url = ARGV[0]
body =
if File.exists?("/tmp/body")
@olleolleolle
olleolleolle / image_assist_fix.php
Created June 5, 2012 14:51
PHP script to convert Image Assist Tag into HTML tags
<?php
/**
* PHP script to convert Image Assist Tag into HTML tags.
*
* Drupal 6-to-7 conversion
*
* This script must be run on D7 database (after the update from D6 to D7).
* http://drupal.org/node/841568
*/
@olleolleolle
olleolleolle / warnings-from-today-2020-04-02.txt
Last active April 3, 2020 10:33
Some Ruby warnings, perhaps to hunt!
# webmock - Warnings TODO - haha this led me to https://github.com/taf2/curb/pull/408
/Users/olle/.gem/ruby/2.6.4/gems/webmock-3.8.3/lib/webmock/http_lib_adapters/curb_adapter.rb:93: warning: instance variable @put_data not initialized
# Can VCR ask for Content-Type here?
/Users/olle/.rubies/ruby-2.6.4/lib/ruby/2.6.0/net/http/generic_request.rb:186: warning: net/http: Content-Type did not set; using application/x-www-form-urlencoded
# httpclient Warnings - led me to make https://github.com/nahi/httpclient/pull/421 and https://github.com/nahi/httpclient/pull/422
/Users/olle/.gem/ruby/2.6.4/gems/httpclient-2.8.3/lib/httpclient/ssl_config.rb:370: warning: assigned but unused variable - pathlen
/Users/olle/.gem/ruby/2.6.4/gems/httpclient-2.8.3/lib/httpclient/ssl_config.rb:51: warning: method redefined; discarding old initialize
/Users/olle/.gem/ruby/2.6.4/gems/httpclient-2.8.3/lib/httpclient/ssl_config.rb:58: warning: method redefined; discarding old add_cert
@olleolleolle
olleolleolle / gist:5933425
Created July 5, 2013 09:49
zsh: noglob option, in action. Rake tasks can take arguments in hard brackets. These brackets have special meaning in zsh. So, either turn off the special expansion stuff (noglob) or escape the brackets.
zsh: Too helpful. Turn off the extra features, so that you can run commands:
$ noglob foreman run -f Procfile.dev rake coupons:seed[1,"One year"]
$ rund rake coupons:seed\[1,"One year"\]
Oh, 'rund' is an alias:
$ alias |grep rund
rund='foreman run -f Procfile.dev'
runt='rund -e .env_test'
@olleolleolle
olleolleolle / gh-fixing.md
Last active July 15, 2019 06:35
Automating mass fixes, pt I

Finding and fixing RubyGems

Lots of gems have outdated gemspec files.

Known Deprecations

  • [autorequire]
  • [default_executable]
  • [rubyforge_project]
  • [specification_version]
@olleolleolle
olleolleolle / hm.md
Last active March 22, 2019 22:47
An interaction
it "bails" do
begin
cli.parse_options(["--config=#{file}"])
rescue => e
pp e
pp e.cause
pp e.backtrace
end
end
@olleolleolle
olleolleolle / rubocop.md
Created March 19, 2019 07:43
RuboCop 0.66.0 has trouble with this piece of code

In This PR, I disabled a rule inline.

module Gemstash
  # Storage for application-wide variables and configuration.
  class Env
    module Helper
    # RuboCop 0.66.0 can not decide where to put that "private"

 private # rubocop:disable Layout/IndentationWidth
{
"name": "blockUI",
"title": "BlockUI",
"description": "Simulate synchronous ajax by blocking - not locking - the UI. This plugin lets you block user interaction with the page or with a specific element on the page. Also great at displaying modal dialogs.",
"keywords": [
"block",
"overlay",
"dialog",
"modal"
],
@olleolleolle
olleolleolle / jslint_with_juicer.py
Created March 11, 2010 16:08
jslint.py: Here is my take on bash scripting: using Python's subprocess module.
#!/usr/bin/env python
import subprocess
import fnmatch
import os
import os.path
from string import Template
from optparse import OptionParser
import webbrowser
import string
import datetime