Skip to content

Instantly share code, notes, and snippets.

anithri / nameMaker.js
Last active September 29, 2019 20:33
nameMaker.js utililty
View nameMaker.js
// nameMaker.js
const cc = require('change-case')
const inflection = require('inflection')
const suffixer = {
get: function(target, prop, _receiver) {
if (target.hasOwnProperty(prop)) return target[prop]
if (prop[0] === prop[0].toLowerCase()) {
return `${}${cc.pascal(prop)}`
View .gitignore
# 2018-01-16 by Scott P
# Created by,ruby,rails,jekyll,rubymine,serverless
### Jekyll ###
### Node ###
# Logs
anithri / joy.rb
Last active August 29, 2015 14:15
are there any gotcha's for this refinement scheme?
View joy.rb
# Small module intended for enhancing a string object.
module Joy
def joy
self + ' Joy!'
anithri /
Last active August 29, 2015 14:14
git status for i3blocks or other text based status tools.


This is a pair of scripts to facilitate display a repo status in my i3bar. Also included is a fragment of my .i3blocks.conf file where I use the scripts.


To help me correct bad git habits, I want to bring the git status for the repo I'm wqorking on currently front and center in my i3bar.


Because I like ruby, I used ruby. it's probably faster in all sorts of other implementations and I urge you to develop them if you want. I my eventually attempt a python translation as an excuse to learn something about python. I don't understand shell string manipulation well enough to summarize things with it, again I'm sure it's possible I just don't know how to do it and it isn't important enough to me to learn right now.


anithri / rspec failure error
Created March 12, 2013 21:43
Having an issue with rspec should_recieve().with.ordered
View rspec failure error
1) Ruzo::Crm#get_records should get more than 1 slice for counts over @max_records
Failure/Error: crm.should_receive(:get_record_slice).with("Contacts",{from:1, to: 4}).ordered
#<Ruzo::Crm:0x00000002e2f980> received :get_record_slice with unexpected arguments
expected: ("Contacts", {:from=>1, :to=>4})
got: ("Contacts", {:from=>1, :to=>8}), ("Contacts", {:from=>5, :to=>12})
# ./spec/crm_spec.rb:88:in `block (4 levels) in <top (required)>'
anithri /
Last active December 12, 2015 02:58
trying to figure out normdist

expected result in from excel function where =(NORMDIST(test,0,1,FALSE)) * 2.506628274631

actual result from (Normdist.normdist(test, 0 , 1, false) * 2.50663).round(4)

test value expected Actual
0 1.0 1.0
0.05 0.9988 0.9753
0.1 0.995 0.9512
0.15 0.9888 0.9277
anithri / model.rb
Created February 1, 2013 22:53
active_record model generator template Inserted comments to help keep models organized
View model.rb
<% module_namespacing do -%>
class <%= class_name %> < <%= parent_class_name.classify %>
<% if !accessible_attributes.empty? -%>
attr_accessible <%= {|a| ":#{}" }.sort.join(', ') %>
<% else -%>
anithri / controller_spec.rb
Last active December 12, 2015 01:58
rspec scaffold/controller_spec template based o n Everyday Rails Testing with Rspec
View controller_spec.rb
require 'spec_helper'
describe <%= controller_class_name %>Controller do
# This should return the minimal set of attributes required to create a valid
# <%= class_name %>. As you add validations to <%= class_name %>, be sure to
# update the return value of this method accordingly.
def valid_attributes
attributes_for(:<%= file_name %>)
anithri / gist:3881265
Created October 12, 2012 20:15
Match only projects that have all of the given project_types
View gist:3881265
class Project < ActiveRecord::Base
has_and_belongs_to_many :project_types
scope :has_any_project_types, ->(*project_types) do
where(" IN (?)", project_types)
scope :has_all_project_types, ->(*project_types) do
anithri / addendum_grid.yml
Created April 25, 2012 21:03
Configuration piece for jqgrid_rails
View addendum_grid.yml
:dom_id: "addendums_grid"
:caption: "Addendums"
:edit: true
:search: false
:add: true