Skip to content

Instantly share code, notes, and snippets.

Avatar
🤘

Ozesh Thapa zaagan

🤘
View GitHub Profile
View CoruseWriteService.xer
void CreateCourse(Course)
void UpdateCourse(Course)
@zaagan
zaagan / CoruseReadService.xer
Created Jul 19, 2020
Course Read Service Sample Data
View CoruseReadService.xer
List<Course> GetTop10Courses()
CourseDetail GetCourseDetail(courseID)
List<Course> GetCourses(courseName, limit, offset)
@zaagan
zaagan / CourseInfo.xer
Last active Jul 19, 2020
Course Sample Data
View CourseInfo.xer
List<Course> GetTop10Courses()
CourseDetail GetCourseDetail(courseID)
List<Course> GetCourses(courseName, limit, offset)
void CreateCourse(Course)
void UpdateCourse(Course)
@zaagan
zaagan / javascript:number_to_currency
Created Feb 21, 2020 — forked from Foodguru/javascript:number_to_currency
javascript: number to currency. Rails like
View javascript:number_to_currency
function number_to_currency(number, options) {
try {
var options = options || {};
var precision = options["precision"] || 2;
var unit = options["unit"] || "$";
var separator = precision > 0 ? options["separator"] || "." : "";
var delimiter = options["delimiter"] || ",";
var parts = parseFloat(number).toFixed(precision).split('.');
return unit + number_with_delimiter(parts[0], delimiter) + separator + parts[1].toString();
@zaagan
zaagan / examples.md
Created Feb 9, 2020 — forked from jonschlinkert/examples.md
Three files: examples.md, yaml-cheatsheet.md and yaml-cheatsheet.yml
View examples.md

adapted from this blog

# YAML
name: Jon
# YAML
object:
@zaagan
zaagan / rspec_model_testing_template.rb
Created Feb 9, 2020 — forked from kyletcarlson/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@zaagan
zaagan / Ruby Basics - Custom Exceptions.rb
Created Jan 27, 2020
Ruby Basics - Custom Exceptions
View Ruby Basics - Custom Exceptions.rb
class CustomException < StandardError
attr_reader :message, :error_id
def initialize(message, error_id)
@message = message
@error_id = error_id
end
end
begin
@zaagan
zaagan / Ruby Basics - Exception Handling.rb
Created Jan 27, 2020
Ruby Basics - Exception Handling
View Ruby Basics - Exception Handling.rb
# Example 1
begin
x = 5 / 0
rescue
puts "Ohh no !!!"
ensure
puts "This will always execute"
end
# Example 2
@zaagan
zaagan / Ruby Basics - Upto & Downto.rb
Created Jan 27, 2020
Ruby Basics - Upto & Downto
View Ruby Basics - Upto & Downto.rb
1.upto 5 do |i|
puts i
end
# 1
# ...
# 5
5.downto 1 do |i|
puts i
end
@zaagan
zaagan / Ruby Basics - Case Statements.rb
Created Jan 27, 2020
Ruby Basics - Case Statements
View Ruby Basics - Case Statements.rb
number = 1
case number
when 1 then puts "One"
when 2 then puts "Two"
else puts "Zero"
end
You can’t perform that action at this time.