Skip to content

Instantly share code, notes, and snippets.

View gaetanm's full-sized avatar

Gaëtan Masson gaetanm

View GitHub Profile
require 'open3'
class LazySpec
GIT_CMD = "git diff --name-only --exit-code"
RSPEC_CMD = "bundle exec rspec "
def self.launch
new.launch
end
class JobOffer::Localized
def initialize(job_offer, language)
@job_offer = job_offer
if language == JobOfferContent.languages[:fr]
@localized_content_to_use = job_offer
else
@localized_content_to_use = job_offer.job_offer_contents.find_by_language language
end
@gaetanm
gaetanm / the-worst-query-atm
Created August 8, 2014 12:33
The worst query atm
SELECT item.item0 FROM
(SELECT item0 FROM situationalItems WHERE type = 1
AND build IN (SELECT id FROM build WHERE champion = ? AND mode = ? AND role = ? AND position = ?) UNION ALL
SELECT item1 FROM situationalItems WHERE type = 1
AND build IN (SELECT id FROM build WHERE champion = ? AND mode = ? AND role = ? AND position = ?) UNION ALL
SELECT item2 FROM situationalItems WHERE type = 1
AND build IN (SELECT id FROM build WHERE champion = ? AND mode = ? AND role = ? AND position = ?))
AS item GROUP BY item.item0 ORDER BY COUNT(*) DESC LIMIT 3
<?php
if ($as->paidVacationDay != null)
$as->paidVacationDay = implode(' ', array_merge(explode(' ',$as->paidVacationDay), (array)$value['paidVacationDay']));
else
$as->paidVacationDay = implode(' ', (array)$value['paidVacationDay']);
<?php
public function approve()
{
$id = $this->request->getData('post', 'id');
$ar = AR::select('WHERE id = ?', $id);
$this->updateMemberAbsences($ar);
// doesn't work
$("input").each(function()
{
if ($(this).val() == '' && $(this).attr('name') != "comment")
{
empty = true;
}
}
$(this).closest('.accordion-group').find('.accordion-toggle').attr('href', '#mission'+newVal);