Skip to content

Instantly share code, notes, and snippets.

@OneWeb
OneWeb / gist:11189418
Created April 22, 2014 18:25
CSS Wobble Animation (hatching egg)
.wobble {
-webkit-transform-origin: 55% 70%;
-moz-transform-origin: 50% 60%;
-ms-transform-origin: 50% 60%;
-o-transform-origin: 50% 60%;
transform-origin: 50% 60%;
}
@-webkit-keyframes wiggle {
0% {-webkit-transform:rotate(4deg);}
@OneWeb
OneWeb / getSonataMediaUrlInController.php
Created August 14, 2014 14:20
Get Sonata Media Url in Controller
<?php
$webdir = $this->get('kernel')->getRootDir() . '/../web' . $this->getRequest()->getBasePath();
$fullimgpath = $webdir . $this->container->get('sonata.media.twig.extension')->path($report->getImage(), 'reference');
?>
@OneWeb
OneWeb / subsonic-backup-data-ubuntu
Last active February 23, 2016 12:04
Subsonic Backup Data on Ubuntu
#!/bin/bash
SUBSONIC_DATA=/var/subsonic/db
SUBSONIC_NEW_DATA=/media/bigbird/Backups/subsonic/
service subsonic stop
sleep 45
rsync -a $SUBSONIC_DATA $SUBSONIC_NEW_DATA
service subsonic start
@OneWeb
OneWeb / sonata_media_path.sql
Created April 22, 2016 07:55 — forked from mhouchin/sonata_media_path.sql
PostgreSQL function to generate sonata media path
-- Function: public.sonata_media_path(bigint, text, text, text)
-- DROP FUNCTION public.sonata_media_path(bigint, text, text, text);
CREATE OR REPLACE FUNCTION public.sonata_media_path(
id bigint,
context text,
size text,
reference text)
RETURNS text AS
@OneWeb
OneWeb / base.html
Last active August 8, 2018 13:08
Footer Always At Bottom CSS trick
<div class="wrapper">
<!-- Put your main page content here -->
</div>
<footer>
<!-- Put your footer content here -->
</footer>
@OneWeb
OneWeb / entry_check.php
Last active January 11, 2019 08:36
entry_check.php
<?php
//only one entry per household per brand
$totalEntries = $em
->createQuery("SELECT COUNT(e) FROM VcgEntryBundle:Entry e
INNER JOIN e.receipt r
WHERE LOWER(e.address1) = LOWER(:address1)
AND LOWER(e.town) = LOWER(:town)
AND r.status = 'approved'
AND e.product = :product")
{# requires twig tweak module to be installed #}
{% set media = content.field_logo_media %}
{% if media[0] is defined and media[0]['#item'] is defined %}
<img src="{{ media[0]['#item'].entity|file_uri|image_style('stockists_carousel_logo') }}" alt="{{ media[0]['#item'].alt }}">
{% endif %}
@OneWeb
OneWeb / routingExamples.md
Last active June 8, 2023 08:35
Symfony routing examples

Paths and routing in Symfony

The Problem

if($event->getRequest()->getPathInfo()=='/fr/_uploader/receipt2/upload'){
    // ...
}
@OneWeb
OneWeb / gc_promo_report.yaml
Created November 16, 2023 09:25
GC promo report config example
gc_promo_report:
reports:
entries:
name: 'Entries report'
description: 'This report shows all promotion entries.'
sql: "SELECT * FROM gc_promo_entry ORDER BY id ASC;"
bank-transfer-payment-report:
name: 'Bank transfer payment report'
description: 'This report shows all approved cash prize claims.'
sql: |
@OneWeb
OneWeb / points_balance.sql
Created June 11, 2024 15:40
Collector Points Balance SQL
SELECT
(SELECT COALESCE(SUM(r.points_value), 0) FROM gc_promo_receipt r
WHERE r.user_id = 1
AND r.status = 'Approved')
-
(SELECT COALESCE(SUM(l.reward_type_points_cost), 0) FROM gc_promo_user_reward_claim_ledger l
INNER JOIN gc_promo_user_reward_claim c ON c.id = l.user_reward_claim_id
WHERE c.redeemed_by_user_id = 1)
AS points_balance;