Skip to content

Instantly share code, notes, and snippets.

View markahesketh's full-sized avatar
🚀

Mark Hesketh markahesketh

🚀
View GitHub Profile
@markahesketh
markahesketh / cell_component.rb
Created April 25, 2024 13:43
ViewComponent Table Example
class Admin::DataTable::CellComponent < ApplicationComponent
def initialize(tag: :td, header: false, collapse: false, padding: true, numeric: false, centered: true, **args)
@args = args
@args[:tag] = tag
@args[:class] = class_names(
@args[:class],
"text-end" => numeric,
"w-1" => collapse,
"text-center" => centered,
@markahesketh
markahesketh / composer.json
Created October 12, 2018 07:52
Sylius 1.3 project default composer file
{
"keywords": ["symfony", "symfony2", "sylius", "distribution", "ecommerce", "cart", "shopping"],
"type": "project",
"license": "proprietary",
"homepage": "http://sylius.org",
"authors": [
{
"name": "Paweł Jędrzejewski"
},
{
@markahesketh
markahesketh / ansible-role-test.sh
Created October 12, 2017 19:57 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
# - test_idempotence: whether to test playbook's idempotence (default = true)
# Use rbconfig to determine if we're on a windows host or not.
require 'rbconfig'
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
if is_windows
# Provisioning configuration for shell script.
config.vm.provision "shell" do |sh|
sh.path = "windows.sh"
sh.args = "build.yml"
end
else
<?php
// Clients using Docker DB
CFG::set('ETCD_ENABLED_APPS', [
'Sigma',
'Saltrock',
'GeminiWoman',
'Kennelpak',
'Nest',
'Woodall',
]);
@markahesketh
markahesketh / cuttingthemustard.js
Last active August 30, 2015 21:16
Cutting the mustard
// Feature detection
var supports = !!document.querySelector && !!window.addEventListener;
if ( !supports ) return;
// Enabling / hiding content on document load
document.documentElement.className += ' js-component-name';
// Shallow extend
// If a key has another object as its value, the first object's value will be overridden by the second one during the merge.
var extend = function ( objects ) {
/**
* Custom chart
*/
Chart.types.Doughnut.extend({
name: "PtgDoughnut",
// Check if we need to extend the scale
initialize: function(data){
this.options.onAnimationProgress = function(easeDecimal){
this.drawPercentage((easeDecimal * this.segments[0].value).toFixed(1));
@markahesketh
markahesketh / gist:62d4366b8044796787be
Created January 27, 2015 14:30
Git SVN auth issues in cygwin
Install Cygwin
Install:
- make
- gcc
- libcrypt-devel
$ perl -MCPAN -e shell
cpan[1]> install YAML
cpan[2]> install Term::ReadKey
@markahesketh
markahesketh / gist:7048585
Created October 18, 2013 21:32
chmod 644/755 on OSX
# for files only
find ./ -type f -exec chmod 644 {} +
# for directories only
find ./ -type d -exec chmod 755 {} +
@markahesketh
markahesketh / gist:6090388
Last active June 26, 2022 20:35
LAMP stack on Linode
#!/bin/bash
# ==============================================================================
# Set up LAMP stack on blank Linode
#
# $ nano install.sh
# Copy/paste this script into terminal. Save and exit.
# $ chmod 775 install.sh
# $ ./install.sh
# $ rm install.sh
# ==============================================================================