This file contains hidden or 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
| var couchapp = require('couchapp') | |
| , path = require('path') | |
| ; | |
| ddoc = | |
| { _id:'_design/app' | |
| , rewrites : | |
| [ {from:"/", to:'index.html'} | |
| , {from:"/api", to:'../../'} | |
| , {from:"/api/*", to:'../../*'} |
This file contains hidden or 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
| function preventBehavior(e) { | |
| e.preventDefault(); | |
| }; | |
| document.addEventListener("touchmove", preventBehavior, false); |
This file contains hidden or 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
| require 'RMagick' | |
| require 'yaml' | |
| class ImageDiff | |
| #max = 20 | |
| MATRIX = 15 | |
| def generate_array(image_path) | |
| result = [] |
This file contains hidden or 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 | |
| class ImageDiff { | |
| // not bigger 20 | |
| private $matrix = 15; | |
| public function getImageInfo($image_path){ | |
| list($width, $height, $type, $attr) = getimagesize($image_path); | |
| $image_type = ''; |
This file contains hidden or 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
| EXPLAIN ANALYZE SELECT smlar(images.image_array, '{1010259,1011253,1012249,1013251,1014249,1015249,1016247,1017252,1018252,1019251,1020251,1021253,1022258,1023257,1024257,1110258,1111258,1112252,1113251,1114251,1115250,1116247,1117252,1118252,1119252,1120252,1121253,1122257,1123257,1124257,1210258,1211258,1212258,1213253,1214251,1215251,1216248,1217253,1218253,1219253,1220253,1221253,1222253,1223253,1224252,1310258,1311258,1312258,1313258,1314258,1315252,1316248,1317253,1318257,1319257,1320253,1321253,1322257,1323253,1324253,1410258,1411258,1412258,1413258,1414258,1415257,1416250,1417253,1418257,1419257,1420257,1421253,1422257,1423257,1424253,1510258,1511258,1512258,1513258,1514258,1515257,1516251,1517253,1518257,1519253,1520252,1521252,1522252,1523251,1524250,1610258,1611258,1612258,1613258,1614258,1615257,1616252,1617252,1618251,1619250,1620247,1621251,1622251,1623250,1624250,1710258,1711258,1712258,1713258,1714258,1715257,1716252,1717257,1718257,1719257,1720252,1721253,1722252,1723253,1724253,1810258,18112 |
This file contains hidden or 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
| require 'open-uri' | |
| require 'net/https' | |
| module Net | |
| class HTTP | |
| alias_method :original_use_ssl=, :use_ssl= | |
| def use_ssl=(flag) | |
| self.ca_file = Rails.root.join('lib/ca-bundle.crt').to_s | |
| self.verify_mode = OpenSSL::SSL::VERIFY_PEER |
This file contains hidden or 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
| app_root = '<%= node['app']['web_dir'] %>' | |
| rails_root = "#{app_root}/current" | |
| rails_env = '<%= node['app']['env'] %>' | |
| pid_file = "#{app_root}/shared/tmp/pids/unicorn.pid" | |
| socket_file= "#{app_root}/shared/tmp/sockets/unicorn.sock" | |
| log_file = "#{rails_root}/log/unicorn.log" | |
| username = '<%= node['user']['name'] %>' | |
| group = '<%= node['user']['name'] %>' | |
| old_pid = "#{pid_file}.oldbin" |
This file contains hidden or 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
| # ROUTER | |
| GWS.Router.map (match) -> | |
| #match("/").to("home") # home.handlebars gets rendered automatically and mapped to / | |
| # according to guide the previous logic shouldn't be needed. but it won't work without it | |
| # you can either use model: () -> or | |
| # setupController: (controller, model) -> | |
| # controller.set 'content', model |
This file contains hidden or 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
| require 'net/https' | |
| require 'uri' | |
| class SimpleSslCheckPlugin < Scout::Plugin | |
| OPTIONS=<<-EOS | |
| url: | |
| default: https://localhost | |
| EOS | |
| def build_report |
This file contains hidden or 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
| WITH constants AS ( | |
| SELECT current_setting('block_size')::numeric AS bs, 23 AS hdr, 4 AS ma | |
| ), bloat_info AS ( | |
| SELECT | |
| ma,bs,schemaname,tablename, | |
| (datawidth+(hdr+ma-(case when hdr%ma=0 THEN ma ELSE hdr%ma END)))::numeric AS datahdr, | |
| (maxfracsum*(nullhdr+ma-(case when nullhdr%ma=0 THEN ma ELSE nullhdr%ma END))) AS nullhdr2 | |
| FROM ( | |
| SELECT | |
| schemaname, tablename, hdr, ma, bs, |