Skip to content

Instantly share code, notes, and snippets.

View xkraty's full-sized avatar
🤌
Mama mia!

xkraty xkraty

🤌
Mama mia!
View GitHub Profile
@xkraty
xkraty / postgres-cheatsheet.md
Created April 5, 2016 15:02 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

class Frontend::MetaTagsCell < Cell::ViewModel
include MetaTags::ViewHelper
def set
translate = ['seo', controller.controller_name, controller.action_name]
set_meta_tags %i(title description).map { |m| [m, (I18n.translate!(m, scope: translate) rescue nil)] }.to_h
alternate = []
params = request.path_parameters
params[:locale] = I18n.default_locale
@xkraty
xkraty / Preference.sublime-settings
Created February 17, 2014 14:51
Sublime text 3 Preferences
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
+ +
`.....`
`:#+;:,.,:;'##;.
'#:``.```````````:#'
'+,...````````````````'+
@:..````````````````````.#,
.#,`````````````````````````@;
`#.````` ` ````````@@,
@.````` ```````+'@,
,,########################################,,
.*##############################################*
,*####*:::*########***::::::::**######:::*###########,
.*####: *#####*. :*###,.#######*,####*.
*####: *#####* .###########* ,####*
.*####: ,#######, ##########* :####*
*####. :#########*, ,,,,,,,,. ,####:
####* ,##############****************:,, .####*
:####*#####################################**, *####.
*############################################*, :####:
@xkraty
xkraty / gist:4257822
Created December 11, 2012 11:08 — forked from doginthehat/gist:1890659
compare block helper for handlebars
// (from http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates/)
// Usage: {{#xIf a 'operator' b}} true {{else}} false {{/xIf}}
Handlebars.registerHelper('xIf', function(lvalue, operator, rvalue, options) {
if (arguments.length < 3)
throw new Error("Handlerbars Helper 'compare' needs 3 parameters");
var operators = {
'==': function(l,r) { return l == r; },
'===': function(l,r) { return l === r; },
'!=': function(l,r) { return l != r; },
@xkraty
xkraty / handlebars.object_helpers.js
Created December 7, 2012 13:23 — forked from strathmeyer/handlebars.object_helpers.js
Handlebars.js helpers to iterate over objects
// HELPER: #key_value
//
// Usage: {{#key_value obj}} Key: {{key}} // Value: {{value}} {{/key_value}}
//
// Iterate over an object, setting 'key' and 'value' for each property in
// the object.
Handlebars.registerHelper("key_value", function(obj, options) {
var buffer = "",
key;