Skip to content

Instantly share code, notes, and snippets.

View jacekd's full-sized avatar

Jacek Dominiak jacekd

View GitHub Profile
@jacekd
jacekd / date range
Created July 31, 2013 10:43
date range w/o creating dates table
select dates.selected_date, coalesce(counts.count, 0) from
(select * from (select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date from (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0, (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1, (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2, (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3, (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6
union select 7 union select 8 union select 9) t4) v where selected_date between '2013-04-01' and '2013-04-15') dates
left outer join
@jacekd
jacekd / date range
Created July 31, 2013 10:43
date range w/o creating dates table
select dates.selected_date, coalesce(counts.count, 0) from
(select * from (select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date from (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0, (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1, (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2, (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3, (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6
union select 7 union select 8 union select 9) t4) v where selected_date between '2013-04-01' and '2013-04-15') dates
left outer join
@jacekd
jacekd / Default.sublime-keymap
Created May 13, 2013 07:59
custom split on #ST2
[{
"keys": ["alt+shift+4"],
"command": "set_layout",
"caption" : "Custom: 3 Pane ",
"mnemonic": "C",
"args": {
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 0.5, 1.0],
"cells": [[0, 0, 1, 2],[1, 0, 2, 1],[1, 1, 2, 2]]
}
@jacekd
jacekd / gist:5334241
Created April 8, 2013 04:29
quick convert to date Test
$(".created_at").each(function() { t = new Date($(this).text()); t.setTime(t.getTime() + (120*60000));t = t.toLocaleString(); $(this).text(t); });

#My Sublime Text 2 plugin list

Those are the plugins I use the most with my "production" workstation. Most of them do have some customization on them [I tend not to keep things standard].

  1. Abacus
  2. BracketHighliter
  3. DocBlockr
  4. Emmet
  5. Git
  6. Hayaku
#!/bin/bash
# Via https://raw.github.com/mathiasbynens/dotfiles/master/.osx
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
@jacekd
jacekd / gist:4562959
Created January 18, 2013 07:40
Multilingual URLs in Laravel 4
<?php
/*
* Multilingual URLs in Laravel 4
*/
//config/app.php
return array(
...
@jacekd
jacekd / prerelease-mselect.js
Created December 4, 2012 22:03
mselect jquery plugin
(function($){
function collect(a, b) {
return (a == b ? 0 : (a < b ? -1 : 1));
}
function moveSelected(from, to) {
to.append(from.children('option:selected').remove());
}
@jacekd
jacekd / index.html
Created December 2, 2012 19:32
A CodePen by Jacek Dominiak.
<select multiple='multiple' id="select">
<option>one</option>
<option>two</option>
<option>three</option>
<option>four</option>
</select>
<div class="button" id="up"></div>
<div class="button" id="down"></div>
@jacekd
jacekd / index.html
Created December 2, 2012 19:31
A CodePen by Jacek Dominiak.
<select multiple='multiple' id="select">
<option>one</option>
<option>two</option>
<option>three</option>
<option>four</option>
</select>
<div id="up"></div>
<div id="down"></div>