View gist:881f9d4945daa8fa3ac9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def counter(name) | |
name = name.to_s | |
@counters ||= {} | |
return unless name.present? | |
return @counters[name] if counters.key?(name) | |
return unless block_given? | |
relaion = yield | |
@counters[name.to_s] ||= relation.count if relation.respond_to? :count | |
end |
View rails.template.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file 'Procfile.dev', <<-CODE | |
web: bin/puma -b unix://./tmp/sockets/puma.socket -e development | |
CODE | |
file 'bin/dev', <<-CODE | |
#!/bin/sh | |
bin/bundle exec foreman start --procfile=./Procfile.dev | |
CODE | |
run 'rm .gitignore' |
View gist:694f3d855563f416482e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdlib.h" | |
#include "stdio.h" | |
#include "math.h" | |
#include "locale.h" | |
#include <string.h> | |
typedef struct Date { | |
int d; | |
int m; | |
int y; |
View el_geo_request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"fields" : ["id", "osm_type", "name", "admin_level"], | |
"sort": ["admin_level"], | |
"query":{ | |
"bool": { | |
"must": { | |
"match_all": {} | |
}, | |
"filter": { | |
"geo_shape": { |
View 111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$item_id = JRequest::getInt('Itemid', 0, 'get'); | |
$view_name = JRequest::getString('view', '', 'get'); | |
$task = JRequest::getString('task', '', 'get'); | |
$div_class_name = 'div1'; | |
if($item_id == 174 && $view_name == 'itemlist') | |
{ | |
$div_class_name = ( $task == 'some_task' ) ? 'div2' : 'div3'; | |
} ?> |
NewerOlder