Skip to content

Instantly share code, notes, and snippets.

View jacek213's full-sized avatar

Jacek Grzybowski jacek213

View GitHub Profile
module Alfalek
class MegaSearch < Grape::API
INDEX_SOURCE = [
{klass: Doctor, cols: %w{title fname lname short_description}},
{klass: DiagnosticCategory, cols: %w{name description}},
{klass: LaboratoryCategory, cols: %w{name description}},
{klass: MicrobiologyCategory, cols: %w{name description}},
{klass: RehabilitationCategory, cols: %w{name description}},
{klass: TreatmentCategory, cols: %w{name description}}
# @cjsx React.DOM
@PaginatorSection = React.createClass
displayName: 'PaginatorSection'
_handleOnClick: (pageNumber) ->
@props.onPaginate(pageNumber)
_handleNextClick: (e) ->
e.preventDefault();
# @cjsx React.DOM
@ArticlesSection = React.createClass
displayName: 'ArticlesSection'
getInitialState: ->
didFetchData: false
articles: []
meta:
total_pages: 0
@jacek213
jacek213 / materialize_fab_downwards.js
Last active May 8, 2017 10:50
materialize fab downwards
// Patches https://github.com/Dogfalo/materialize/blob/b03030ed5c5ea2018424e2b6a73084f65e8ec63d/js/buttons.js
// minor changes here, search for `downwards`
(function ($) {
angular.element(document).ready(function() {
// jQuery reverse
$.fn.reverse = [].reverse;
// unbind existing handlers
angular.element(document).off('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle)');
@jacek213
jacek213 / webpack-conf-prod.js
Created April 13, 2017 12:06
webpack config prod
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
module.exports = {
context: __dirname,
entry: './src/index.js',
output: {
@jacek213
jacek213 / puma.rb
Created March 23, 2017 16:34
puma conf
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
def self.from_omniauth(auth, opts = {})
where('(provider = :provider AND uid = :uid) OR email = :email',
provider: auth.provider,
uid: auth.uid,
email: auth.info.email).first_or_initialize.tap do |user|
user.provider = auth.provider
user.uid = auth.uid
user.oauth_token = auth.credentials.token
// Examples:
// no-margin-bottom, no-padding-left, margin-top-5, padding-left-20, etc
$directions: ('top' 'bottom' 'left' 'right');
$properties: ('margin' 'padding');
@each $direction in $directions {
@each $property in $properties {
.no-#{$property}-#{$direction} {
@jacek213
jacek213 / clockwork.cap
Created August 6, 2016 15:29 — forked from vjfrancois/clockwork.cap
Clockwork and delayed_job tasks file for capistrano 3
namespace :workers do
namespace :clockwork do
desc "Stop clockwork"
task :stop do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :clockworkd, "-c lib/clockwork.rb --pid-dir=#{cw_pid_dir} --log-dir=#{cw_log_dir} stop"
end
end
@jacek213
jacek213 / 0_reuse_code.js
Created June 28, 2016 14:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console