Skip to content

Instantly share code, notes, and snippets.

View psahni's full-sized avatar

Prashant psahni

View GitHub Profile
@psahni
psahni / 01-intro.md
Last active August 29, 2015 14:14 — forked from dwayne/01-intro.md

Introduction

Author: Ari Lerner.

AngularJS offers a single framework that can be used to build dynamic, client-centric applications. It provides:

  • Module support
  • DOM manipulation
  • Animations
  • Templating
module Kernel
def from(mod, include: [])
raise TypeError, "argument must be a module" unless Module === mod
# print include
include.each do |name, original|
define_method(name, mod.instance_method(original || name))
end
end
def kernal_test
@psahni
psahni / ruby_http_example.rb
Created March 19, 2015 05:56
ruby_http_example
require 'uri'
require 'net/http'
url = URI("http://mockbin.com/request?foo=bar&foo=baz")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = 'foo=bar; bar=baz'
request["accept"] = 'application/json'
@psahni
psahni / rails_logging.md
Created April 1, 2015 05:52
Rails Production with logging
@psahni
psahni / rails_logging.md
Last active February 18, 2016 19:28
Rails Production with logging
@psahni
psahni / restore_strategy.md
Last active August 29, 2015 14:20
Automated test case and restoring the database.

#Integration testing with live test website. Restoring the state of the database after test suite. ##Challenges

  1. Running the test cases with existing data on test website.
  2. Restoring the original state of data.

Solution proposed

  1. Taking backup/dump of the database, then run test cases over it and after completion of test suite restore the data from dump.
@psahni
psahni / capybara_test.rb
Last active August 29, 2015 14:20
test to sign up and deleting the user
require 'capybara'
require 'capybara/angular'
require 'active_record'
require 'pg'
class ContactServiceTesting
include Capybara::DSL
include Capybara::Angular::DSL
@psahni
psahni / active_record_hacks.rb
Created May 19, 2015 07:40
Active record hacks
# GET COLUMN NAMES AND THEIR TYPE
ActiveRecord::Base.connection.columns(table_name).each {|c| puts "- " + c.name + ": " + c.type.to_s + " " + c.limit.to_s}
@psahni
psahni / 37_points.md
Last active August 29, 2015 14:21
How to manage emotions

##Notes on Self Management

1. How to Become More Optimistic

  • EXPECT something wonderful to happen every day.
  • TREAT people as you'd want to be treated.
  • DON'T waste breath fighting about things you can't change.
  • CONCENTRATE on the job at hand, not the results you seek.
  • ASSUME other people mean well.
  • AVOID depressing people and conversations.
  • EAT something delicious every day.
@psahni
psahni / js_class_with_arguments.html
Last active February 23, 2016 05:39
js_class_with_arguments
<html>
<script>
</script>
<body>
<script>
var Class = function(){