Skip to content

Instantly share code, notes, and snippets.

@mankind
mankind / rails-aws-ses-ruby-aws-sdk-2.rb
Created March 31, 2016 12:47
Getting started aws ses and demo using aws_sdk gem version 2
Getting started aws ses
http://codechannels.com/video/amazonwebservices/cloud/getting-started-with-amazon-ses/
1. Verify email address
In the sandbox you can send email only from emails yiu have verified.
Go to email AWS SES then on the left clcik on 'verified senders'
to start the verification process:
a. click 'verify a ne sender'
in the dialogue box add your email and click submit. you will receive
@mankind
mankind / rails-elasticbean.txt
Created March 31, 2016 12:39
Deploying a simple Rails application with AWS Elastic Beanstalk
Deploying a simple Rails application with AWS Elastic Beanstalk by Julien SIMON, Principal Technical Evangelist @ Amazon Web Services
18/02/2016
http://www.slideshare.net/JulienSIMON5/deploying-a-simple-rails-application-with-aws-elastic-beanstalk
1. . Create a Git repository with AWS CodeCommit
$ aws codecommit create-repository --repository-name blog --region us-east-1 --repository-description "ElasticBeanstalk demo"
$ git clone ssh://git-codecommit.us- east-1.amazonaws.com/v1/repos/blog
2. Create a new Rails application
@mankind
mankind / gTest2.R
Last active August 29, 2015 14:25
another function to calculate gtest in R
#http://www.stat.wisc.edu/~st571-1/gtest.R
#see page 2 for data & page 17 for g-test http://www.stat.wisc.edu/~st571-1/06-tables-2.pdf
# Bret Larget
# October 28, 2010
# September 30, 2011
# Use source() to read this file into R to use it.
# Example:
@mankind
mankind / gTest.R
Created July 27, 2015 08:49
GTEST CALCULATION WITH R
#https://rforge.net/doc/packages/Deducer/likelihood.test.html
#http://www.pmc.ucsc.edu/~mclapham/Rtips/G%20test.txt
# Log-likelihood tests of independence & goodness of fit
# Does Williams' and Yates' correction
# does Monte Carlo simulation of p-values, via gtestsim.c
#
# G & q calculation from Sokal & Rohlf (1995) Biometry 3rd ed.
# TOI Yates' correction taken from Mike Camann's 2x2 G-test fn.
# GOF Yates' correction as described in Zar (2000)
//https://github.com/maccman/abba/blob/master/app/assets/javascripts/client/index.coffee
var extend, getCookie, host, request, setCookie,
slice = [].slice;
host = function(url) {
var parent, parser;
parent = document.createElement('div');
parent.innerHTML = "<a href=\"" + url + "\">x</a>";
parser = parent.firstChild;
return "" + parser.host;
@mankind
mankind / cms.js
Last active August 29, 2015 14:14
emberjs course
ember new cms
ember generate model page navbar:string title:string body:string
import DS from 'ember-data';
export default DS.Model.extend({
navbar: DS.attr('string'),
title: DS.attr('string'),
body: DS.attr('string'),
@mankind
mankind / attachments.hbs
Created November 18, 2014 09:53
Emberjs file upload with HTML-5 formData
{{upload-file action="saveUpload"}}
@mankind
mankind / route.rb
Created November 4, 2014 14:04
namespaceing devise_for user but not current_user helper
namespace :api do
#when devise_for is called in a namespace, the helpers and controller filters change
#:singular => :user added so we can use current_user instead of current_api_user.
#And before_filter authenticate_user! instead of authenticate_api_user!
#https://github.com/plataformatec/devise/issues/412
#devise_for :users, :singular => :user, skip: :all
get :csrf, to: 'csrf#index'
resources :users
@mankind
mankind / application.js
Last active April 7, 2016 21:58
ember-cli solving rails csrf problems
import Ember from 'ember';
export default Ember.Route.extend({
//a = Charity.__container__.lookup('controller:application')
//a.get('csrfService')
//a.get('csrfService').token.authenticity_token
//or
//a.csrfService
//a.csrfService.token.authenticity_token
@mankind
mankind / controller--application.js
Created November 4, 2014 12:24
ember-cli authentication & user signup
// controllers/application.js
import Ember from 'ember';
export default Ember.Controller.extend({
currentUser: null,
authToken: '',
// used to show, or not show, the log out button
loggedIn: false,