Skip to content

Instantly share code, notes, and snippets.

View Paxa's full-sized avatar

Pavel Evstigneev Paxa

View GitHub Profile
invisiblesMap = "~ \t┊"
include = "{$include,.*}"
exclude = "{$exclude,.git,tmp/cache}"
@Paxa
Paxa / 0_usage.rb
Created September 30, 2016 10:32
Faster pagination for kaminari
@payments_base = Payment.extending(FasterPagination)
@payments = @payments_base.page(params[:page]).per(20)
@Paxa
Paxa / compare_1.txt
Created September 29, 2016 17:52
LightRecord benchmarks
% ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
% ruby benchmark/comparing/native_vs_sequel_vs_lr.rb
Testing table already exists
Warming up --------------------------------------
Hash 1.000 i/100ms
Array 1.000 i/100ms
Sequel 1.000 i/100ms
ActiveRecord 1.000 i/100ms
@Paxa
Paxa / pg_load.js
Last active August 29, 2015 14:20
node-postgres and node-pg-native
if (pg_native) {
var async = require('async');
pg = {
connect: function (connectString, callback) {
var client = new pg_native;
client.original_query = client.query;
client.sqlQueue = async.queue(function (sql, callback) {
@Paxa
Paxa / 1.downloaders.md
Last active April 19, 2016 02:17
nwjs (node-webkit) extra libraries

I search all npm packages related to node-webkit, I may had miss something

NWJS Dowloaders and runners

nw

Installer and runner helper for nw.js. Allows run nwjs project by just typing nw in app folder.

nw-download

Just download helper for nwjs

@Paxa
Paxa / 1.rb
Last active August 29, 2015 14:03
This make class-level method "cached" what makes that method cachable
module CachableMethod
def cachable(merhod_name)
#aliased_merhod_name = :"uncached_#{merhod_name}"
#alias_method aliased_merhod_name, merhod_name
method_proc = instance_method(merhod_name)
ivar_name = :"@#{merhod_name}"
define_method(merhod_name) do |*args, &proc|
if instance_variable_defined?(ivar_name)
@Paxa
Paxa / 0.result for ruby
Last active August 29, 2015 13:58
Ruby and nodejs http library benchmark
[em-http-request, HTTParty, Net::HTTP, Net::HTTP (persistent), open-uri, RestClient, Typhoeus, Excon, Excon (persistent), Curb, Patron (persistent)]
+------------------------+----------+
| tach | total |
+------------------------+----------+
| Patron (persistent) | 0.223029 |
+------------------------+----------+
| Curb | 0.235344 |
+------------------------+----------+
| Typhoeus | 0.389802 |
ActiveAdmin::Dashboards.build do
# Add this section in your dashboard...
section "Background Jobs" do
now = Time.now.getgm
ul do
li do
jobs = Delayed::Job.where('failed_at is not null').count(:id)
link_to "#{jobs} failing jobs", admin_jobs_path(q: {failed_at_is_not_null: true}), style: 'color: red'
end
@Paxa
Paxa / bb10_compile
Created February 13, 2014 04:13
ruby for blackberry 10
#! /bin/sh
tmp_pwd=`pwd`
cd /Applications/Momentics.app && source bbndk-* && cd $tmp_pwd
echo $QNX_HOST
QNX_BINS="${QNX_HOST}/usr/bin"
#
@Paxa
Paxa / _wget.md
Last active April 1, 2020 04:25
Cross-compiling wget for blackberry 10 (QNX)

How to compile wget for blackberry 10

Prepare

  1. Download from here http://ftp.gnu.org/gnu/wget/
  2. Extract sources archive, (using extract for example)
  3. Or run tar xf wget-1.15.tar.xz
  4. Copy file bb10_compile from this gist to source folder

Compile