Skip to content

Instantly share code, notes, and snippets.

View midhunkrishna's full-sized avatar

Midhun Krishna midhunkrishna

View GitHub Profile

graphql ruby dynamically refresh schema, well a portion of it. ;)

class Types::DrugType
  
  # hook method that is called to check whether fields changed or not. 
  def self.dynamic_field_hook
    # this is example code, basically if the dynamic fields 
    # defined for a `SomeType` changes, the checksum changes as well
    DynamicField.for(DrugType).checksum
;; Override Emacs Internals
(defun smarter-move-beginning-of-line (arg)
"In Emacs there are two essential commands when you have to
go the beginning of a line - move-beginning-of-line(bound to C-a)
and back-to-indentation(bound to M-m). The first takes you to the first
column of a line and the latter takes you the first non-whitespace
character on a line.
@midhunkrishna
midhunkrishna / pre-commit.sh
Last active September 11, 2019 22:38
Precommit Hook
#!/bin/bash -l
echo "precommit running"
if (($(git diff --name-only --cached | grep ".rb" | wc -l) > 0)); then
echo "RuboCop autofix running..."
cd ~/vineti-platform/platform && bundle exec rubocop --fail-level A -a
exit $?
fi
@midhunkrishna
midhunkrishna / prepare-commit-msg.sh
Last active September 11, 2019 20:37
prepare commit hook
#!/bin/bash
if ! grep -q ci-run "$1" ; then
sed -i.bak -e "1s/^/[ci-skip] /" $1
fi
@midhunkrishna
midhunkrishna / .spacemacs.el
Last active February 16, 2020 09:26
Spacemacs Configuration
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
Multiple Tasks
- Organizational policy management.
- Assigns to multiple users -> Organization users can be assigned to multiple users.
- Notify users to email / and system wise notifications.
- User policy / configureable policy with policy management.
- Overall organizational health
- User management / and roles
@midhunkrishna
midhunkrishna / logger.rb
Created November 6, 2018 07:31
simple ruby threadsafe logger
# Usage:
# DebugTools::Logger.log(String)
require 'fileutils'
module DebugTools
class Logger
def self.log(message)
FileUtils.touch(path) unless File.exist?(path)
QUERY PLAN
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------------------------------------
Limit (cost=8558.43..8558.48 rows=20 width=20)
-> Sort (cost=8558.43..8563.87 rows=2175 width=20)
Sort Key: (CASE WHEN ((importance = '0'::double precision) OR (importan
ce IS NULL)) THEN ('0.75001'::double precision - ((search_rank)::double precisio
n / '40'::double precision)) ELSE importance END) DESC
  • Api::TenderingRequestsController processes accept response - spec.controllers.api.tendering_requests_controller_spec spec/controllers/api/tendering_requests_controller_spec.rb
  • DeliveriesController should handle reject action - spec.controllers.deliveries_controller_spec spec/controllers/deliveries_controller_spec.rb
  • Delivery features Accept delivery - spec.features.delivery_spec spec/features/delivery_spec.rb
  • TenderingRequest shows correct activity item when you cancel early, retender, and let timeout occur - spec.models.tendering_request_spec spec/models/tendering_request_spec.rb
  • Edit Route features behaves like Feature::EditRouteFeatures Consolidation with creating new deliveries 2 - spec.features.edit_route_features_spec spec/features/edit_route_features_spec.rb
Debug output for Geocode::lookup
Geocode: 'Query' => 'New York'
'Structured query' => False
'Name keys' => 'short_name:en-US', 'name:en-US', 'short_name:en', 'name:en', 'short_name', 'name', 'brand', 'official_name:en-US', 'official_name:en', 'official_name', 'ref', 'type'
'Include address' => False
'Excluded place IDs' =>
'Try reversed query' => True
'Limit (for searches)' => 20
'Limit (for results)' => 10
'Country codes' =>