Skip to content

Instantly share code, notes, and snippets.

View psahni's full-sized avatar

Prashant Sahni psahni

View GitHub Profile
@lifeart
lifeart / EmberStyleAngularController.js
Last active March 4, 2020 01:47
Angular Simple DI for controller ES6
class AngularController {
static injections() {
return ['$scope', 'lodash', '$moment', '$timeout'];
}
static requredInjections() {
return ['lodash', '$timeout'];
}
static getInjections() {
let injections = this.injections();
this.requredInjections().map(injectionName => {
@dwayne
dwayne / advice.md
Last active August 29, 2015 14:06
Suggestions from Jeff Browning at Pinecone on improving my skills at AngularJS and Rails.

AngularJS

  • Build custom directives. Basic controllers and templates are great, but anything beyond basic interactivity usually requires custom directives. The learning curve for custom directives can be challenging, so just take it one step at a time.
  • Inter-directive communication via controllers.
  • Become very familiar with scope usage, best practices, and pitfalls. Scope inheritance, and encapsulation are some of the areas where Angular can drive you insane, but this knowledge is essential in order to build large-scale, maintainable Angular apps.
  • Explore the differences between Services, Factories, and Providers.
  • Become a testing expert. One thing that I like about the Angular community is that tests are expected and encouraged.

Here are some resources to help:

@jr314159
jr314159 / karma.coffee.erb
Created January 15, 2014 16:35
Karma rake task
# Karma configuration
# Generated on Tue Aug 20 2013 16:26:25 GMT-0400 (EDT)
module.exports = (config) ->
config.set
# base path, that will be used to resolve all patterns, eg. files, exclude
basePath: '..'
# frameworks to use
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.
anonymous
anonymous / camelog.rb
Created May 15, 2013 03:32
# Camelog is a Ruby gem that helps Rails developers to browse easily in the application logs.
# It works as a live log file parser, so it's completely independent from Rails.
# Allow to choice what kind of request you want to see.
# It's in early development, so many things will change and many features are comming soon.
# Assets requests is also a GET, but Camelog calls it ASSET.
# By default it shows all requests ignoring ASSETS.
# require 'thread' allows me to use Queue.new.
# 'file-tail' is to "tail" the Rails log file.
@nhance
nhance / method_logger.rb
Created September 6, 2012 12:58
Rails compatible method logging. Use this to log all calls to instance methods of a class to the log.
Model.new.foo
@psahni
psahni / deploy.rb
Created August 24, 2012 13:15 — forked from markoa/deploy.rb
Ingredients to monitor Resque with God automatically via Capistrano (on Ubuntu)
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@oma
oma / mongoid.yml
Created June 9, 2012 12:28 — forked from tal/mongoid.yml
development: &defaults
# Configure available database sessions. (required)
sessions:
# Defines the default session. (required)
default: &default_session
# Defines the name of the default database that Mongoid can connect to.
# (required).
database: delight_development
# Provides the hosts the default session can connect to. Must be an array
# of host:port pairs. (required)