Skip to content

Instantly share code, notes, and snippets.

View tboulogne's full-sized avatar

Thierry BOULOGNE tboulogne

View GitHub Profile
@tboulogne
tboulogne / dbclock.rb
Created December 24, 2015 16:08 — forked from ianneub/dbclock.rb
First attempt at a database backed clockwork scheduler. This was made against Rails 4 with a Job model that can be created like so: rails g model Job period:string name:string code:text See: https://github.com/tomykaira/clockwork/issues/25
# version 1
require 'clockwork'
require './config/boot'
require './config/environment'
module DBBackedClockwork
extend Clockwork
# add a periodic job to update @@events
@tboulogne
tboulogne / addtocart.phtml
Created January 26, 2016 12:13 — forked from lrkwz/addtocart.phtml
Magento quantity dropdown
<?php if ( Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getEnableQtyIncrements() ){ ?>
<select class="input-text qty" name="qty" id="qty">
<?php $i = (Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMinSaleQty()?Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMinSaleQty():1); ?>
<?php do { ?>
<option value="<?php echo $i?>">
<?php echo $i?>
<?php $i+= Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQtyIncrements() ?>
</option>
<?php } while ($i <= (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMaxSaleQty()) ?>
</select>
@tboulogne
tboulogne / Form Helpers.md
Created February 29, 2016 19:23 — forked from stevenyap/Form Helpers.md
Rails Form Helpers/Builders Cheatsheet
  • Note the do after the form_tag
<%= form_tag("/search", method: "get") do %>
  <%= label_tag(:q, "Search for:") %>
  <%= text_field_tag(:q, required: true) %>
  <%= submit_tag("Search") %>
<% end %>

= select_tag :title, options_for_select(["Dr", "Mr", "Mrs", "Ms", "Mdm"]), required: true
@tboulogne
tboulogne / Selenium Cheat Sheet.md
Created March 5, 2016 08:41 — forked from kenrett/Selenium Cheat Sheet.md
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@tboulogne
tboulogne / _INSTALL.md
Created April 12, 2016 21:04 — forked from robinsmidsrod/_INSTALL.md
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@tboulogne
tboulogne / netflix-rpi.md
Created April 17, 2016 01:14 — forked from jesstelford/netflix-rpi.md
Netflix on Raspberry Pi (incomplete)

Note: as @clibois mentioned below, due to the DRM Netflix uses, all decoding has to be done in CPU, making it somewhat choppy.

Note 2: Even the RPi 3 suffers from these CPU limitations. There is the potentially risky option of overclocking your RPi 3, but I haven't tried this.

If you manage to get smooth playback, please contact me, or post your solution here

UPDATE: I can no longer get this method to work. I have tried using Chromium v47, and v48, and both result in Netflix error "Oops, something went wrong" / C7053-1807, for which I can find no description online. If you manage to get things up and running, please contact me!

OSMC

@tboulogne
tboulogne / install-ispconfig3-ubuntu.sh
Created May 11, 2016 08:07
Install ISPConfig3 Ubuntu 14.04 64Bits
#!/bin/bash
## Install ISPConfig3 on Ubuntu 14.04 64Bits
## Author: Nilton OS www.linuxpro.com.br
## https://www.howtoforge.com/perfect-server-ubuntu-14.04-apache2-php-mysql-pureftpd-bind-dovecot-ispconfig-3
## Version 0.5
## Set lang en_US UTF8
## echo 'LC_ALL="en_US.utf8"' >>/etc/environment
@tboulogne
tboulogne / gist:ee0dd61d63ab6aa96d0e583a2562e37e
Created July 23, 2016 19:30 — forked from nogweii/gist:8278021
PageKite configuration for running your own front-end (broken, sorta)
# /etc/pagekite/20_frontend.rc on kites.evaryont.me
# Front-end selection
#
# Front-ends accept incoming requests on your behalf and forward them to
# your PageKite, which in turn forwards them to the actual server.
# Running my own front-end!
isfrontend
@tboulogne
tboulogne / taxonomy.html.twig
Last active March 22, 2024 23:26
Grav template for automagic list of taxonomies
{% embed 'partials/base.html.twig' %}
{% block content %}
{% set taxname = uri.query|split('=')[0] %}
{% set taxval = uri.query|split('=')[1]|replace({'+':" "}) %}
{% if taxname %}
{% set c = breadcrumbs.get() %}
/* Woocommerce Styles */
/*
A couple things to note...
1. This code was written very specifically for my base child theme so it might not work out of the box with every theme.
I have it here mostly to share with anyone who might be looking to do the same thing I was.
2. I generally add my WooCommerce CSS overrides to a custom-woo.css file then use wp_enqueue_style() to call it
so that it enqueues after the default WooCommerce Stylesheets