Skip to content

Instantly share code, notes, and snippets.

View waiting-for-dev's full-sized avatar
🏠
Working from home

Marc Busqué waiting-for-dev

🏠
Working from home
View GitHub Profile
function rails() {
if [ "$1" = "start" ]; then
if [ "$2" = "" ]; then
RENV="development"
else
RENV="$2"
fi
rails server -d -e "$RENV"
return 0
elif [ "$1" = "stop" ]; then
@waiting-for-dev
waiting-for-dev / Default
Last active April 14, 2021 03:06
Force screen resolution for my monitor
# Put in /etc/gdm3/Init/Default or ~/.xprofile
cvt 1280 720 60
xrandr --newmode "1280x720_60.00" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync
xrandr --addmode VGA-0 1280x720_60.00
@waiting-for-dev
waiting-for-dev / index.xml.builder
Created February 6, 2014 15:12
sitemap builder for refinerycms with blog support
xml.instruct!
xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
@locales.each do |locale|
::I18n.locale = locale
::Refinery::Page.live.in_menu.includes(:parts).each do |page|
# exclude sites that are external to our own domain.
page_url = if page.url.is_a?(Hash)
# This is how most pages work without being overriden by link_url
@waiting-for-dev
waiting-for-dev / AdminCustomersController.php
Created November 16, 2013 10:54
AdminCustomersController for Newsletter Plus Prestashop module. It delete subscriber when a customer with the same email is created in the backend.
<?php
class AdminCustomersController extends AdminCustomersControllerCore
{
public function afterAdd($customer)
{
require_once _PS_MODULE_DIR_.'newsletterplus/newsletterplus.php';
$newsletterplus = new Newsletterplus();
$newsletterplus->hookActionCustomerAccountAdd(array(
'_POST' => $_POST,
@waiting-for-dev
waiting-for-dev / refinery_external_image.js.coffee
Created August 20, 2013 09:14
Replace RefineryCMS behaviour to add external images in the WYSIWYG editor. Remember to add it in 'initializers/refinery/core.rb' through the 'config/register_javascript' option
$(document).ready ->
$('.wym_tools_image a').click (e)->
e.stopImmediatePropagation()
e.preventDefault()
id = $('.wym_iframe').find('iframe:visible').attr('id').slice(-1)
url = prompt('Insert external image link')
img = new Image()
img.src = url
alt = prompt('Insert alternative text for the image')
wym = jQuery.wymeditors(id)