Skip to content

Instantly share code, notes, and snippets.

View neilmarion's full-sized avatar

Neil Marion dela Cruz neilmarion

View GitHub Profile
@neilmarion
neilmarion / .vimrc
Created September 4, 2013 02:07
Show tab numbers in Vim tabs
set tabline=%!MyTabLine() " custom tab pages line
function MyTabLine()
let s = '' " complete tabline goes here
" loop through each tab page
for t in range(tabpagenr('$'))
" set highlight
if t + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
@neilmarion
neilmarion / gist:29c642afdcbc510876ff
Last active July 31, 2021 21:30
'ship-it' github pull-request comment bookmarklet
javascript:(function() { document.getElementById('new_comment_field').value="```
.
.'| .8
. | .8:
. | .8;: .8
. | .8;;: | .8;
. n .8;;;: | .8;;;
. M.8;;;;;: |,8;;;;;
. .,'n8;;;;;;: |8;;;;;;
. .', n;;;;;;;: M;;;;;;;;
@neilmarion
neilmarion / Sodium monthly revenue datapoints
Created July 10, 2018 06:57
Sodium monthly revenue datapoints
[
[0] {
:text => "Less than 54,000",
:data_point_uid => "companymo1",
:uid => "lessthan51"
},
[1] {
:text => "54,001 - 268,000",
:data_point_uid => "companymo1",
:uid => "5400126801"
@neilmarion
neilmarion / sidekiq
Last active July 27, 2017 17:58
sidekiq clear counter
Sidekiq.redis {|c| c.del('stat:processed') }
and to reset failed jobs:
Sidekiq.redis {|c| c.del('stat:failed') }
bundle exec sidekiq -q high,5 default
RAILS_ENV=production bundle exec sidekiq -d -L /home/deployer/apps/collector/shared/sidekiq.log -q high,5 default
@neilmarion
neilmarion / tu_raw_data.json
Last active July 20, 2017 04:16
tu_raw_data
{
"raw_data":{
"member_reference_number":48192,
"user_id":"BB03000104",
"first_name":"Jacqueline",
"last_name":"del Rosario",
"civil_status":"S",
"date_of_birth":"1981-09-14T00:00:00.000+07:30",
"gender":"1",
"ac_holder_type":"HI",
@neilmarion
neilmarion / migration_update_attributes
Last active April 27, 2017 03:22
Number one rule to updating fields of database rows via Rails migration is to first check if they are existing
class UpdateAddressOfASchool < ActiveRecord::Migration
def up
['Ateneo', 'UP'].each do |name|
school = School.where(name: name).first
if school
school.update_attributes(address: "Quezon City")
end
end
end
end
module HealthCheck
class SlackNotification
attr_accessor :health_check
def initialize(health_check)
@health_check = health_check
end
def send
if beyond_threshold? && activated? && !Rails.env.development?
@neilmarion
neilmarion / send
Last active January 4, 2016 07:49
Sending email to mcroldan08@gmail.com through postfix error
# sending to mcroldan08@gmail.com
5416 Jan 24 00:00:27 li387-184 postfix/smtp[25370]: 2AE56FAED: to=<mcroldan08@gmail.com>, relay=gmail-smtp-in.l.google.com[2a00:1450:4008:c01::1b]:25, delay=3.4, delays=0.04/0.05/0.86/2.4, ds n=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[2a00:1450:4008:c01::1b] said: 550-5.7.1 [2400:8900::f03c:91ff:fe70:bb41 12] Our system has detected that 550-5.7.1 this mess age is likely unsolicited mail. To reduce the amount of spam 550-5.7.1 sent to Gmail, this message has been blocked. Please visit 550-5.7.1 http://support.google.com/mail/bin/answer.py?h l=en&answer=188131 for 550 5.7.1 more information. s8si608207bkr.298 - gsmtp (in reply to end of DATA command))
# vim /var/log/mail.log
@neilmarion
neilmarion / feddit_crontab
Last active January 1, 2016 18:09
feddit crontabs
# Development
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /home/neilmarion/ROR/projects/feddit && rvm 2.0.0@feddit && RAILS_ENV=development bundle exec rake trend:newsletter --silent'
# Production
# Begin Whenever generated tasks for: /home/deployer/apps/feddit/releases/20131230142259/config/schedule.rb
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /home/deployer/apps/feddit/current && RAILS_ENV=production ~/.rbenv/shims/bundle exec rake trend:hot --silent'
@neilmarion
neilmarion / spec_helper.rb
Created December 28, 2013 07:12
Drop all Database on Every RSpec Specs When using Mongoid
config.before(:each) do
Mongoid::Sessions.default.collections.select {|c| c.name !~ /system/ }.each(&:drop)
end