Skip to content

Instantly share code, notes, and snippets.

View christhesoul's full-sized avatar

Chris Waters christhesoul

View GitHub Profile
@christhesoul
christhesoul / circle_artifact_debug.rb
Created November 20, 2018 08:10
Debugging a failing Circle CI container from the artifact XML
require 'nokogiri'
require 'pry'
path_to_xml = "xml/3.xml"
xml = File.open(path_to_xml) { |f| Nokogiri::XML(f) }
seed = xml.xpath('//property').attr('value')
tests = xml.xpath('//testcase').each_with_object([]) do |testcase, tests|
tests << testcase.attr('file')
end
@christhesoul
christhesoul / slow_queries_in_rails.md
Last active November 13, 2018 12:31
Debugging Slow Queries in Rails

🐌 On slow DB queries in Rails

🔍 Show slow process

You can use Rails Console to if queries are hanging.

connection = ActiveRecord::Base.connection
puts connection.execute("SHOW PROCESSLIST").map { |e| e.join(' | ') }
puts connection.execute("SHOW FULL PROCESSLIST").map { |e| e.join(' | ') }
<script id="InnStyle-js" src="http://developer.innstyle.co.uk/calendar.js"></script>
<script>InnStyle('thews', { offset: 78 });</script>
@christhesoul
christhesoul / deploy.rb
Created August 5, 2014 21:23
sample bedrock deploy.rb
set :theme_path, Pathname.new('web/app/themes/my_wp_theme')
set :local_app_path, Pathname.new('/Applications/MAMP/htdocs/my_wp_app')
set :local_theme_path, fetch(:local_app_path).join(fetch(:theme_path))
namespace :deploy do
task :compile_assets do
run_locally do
within fetch(:local_theme_path) do
execute :grunt, :build
end
@christhesoul
christhesoul / video-helper.php
Last active October 5, 2021 23:09
PHP Video class for displaying embedded content from YouTube, Vimeo or BlipTv.
<?php
/*
Example use:
$video = new Video('https://www.youtube.com/watch?v=xfJvrH7iQ3c', 1);
$video->render_embed();
Use responsively: http://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php
*/
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Pavement Palace</title>
</head>
<body>
<script id="InnStyle-js" src="http://developer.innstyle.co.uk/calendar.js"></script>
<script>InnStyle('thepavementpalace', options = {
@christhesoul
christhesoul / imagemagick sketch
Created November 23, 2013 20:48
ImageMagick create black and white "sketch" from photograph
convert photo.jpg -colorspace gray \( +clone -blur 0x10 \) +swap -compose divide -composite -linear-stretch 5%x0% sketch.jpg
@christhesoul
christhesoul / linux-commands
Last active December 20, 2015 07:39
Linux Commands
// Return 15 largest folders by file size
du -sm * | sort -nr | head -15
//More useful way to debug syntax errors in http.conf
apachectl configtest
//Reload http.conf after making changes
service httpd reload
//NOTE: the above may require sudo if http.conf is struggling to open other configuration files