Hey, there! Login & share your notes with everyone...

12

Awesome css resource


  • CSS hovering: http://ianlunn.github.io/Hover/
  • Coloring your page: https://www.google.com/design/spec/style/color.html

  • Downvote Upvote Save Open Edit
    10

    Upload an image in rails using image-magick and paperclip


    • Add gems to Gemfile
      • gem 'carrierwave', '0.10.0'
      • gem 'mini_magick', '3.8.0'
    • New migration file
      • rails generate uploader Picture
      • rails generate migration add_picture_to_mytable picture:string
      • rake db:migrate

    • In the mytable model.rb -> mountuploader :picture, PictureUploader
    • Update your _form.html.erb as follows:
    • img1
    • In the controller, allow picture in params
    • In the show, add the picture:
    • img2
    • In the pictureuploader.rb:
      • uncomment def extensionwhitelist function
      • uncomment include CarrierWave::MiniMagick
      • add process resizetolimit: [600, 600]
    • Add some validations to enforce a certain size to the image. We do that in both the model and the client side.
      • In the model.rb:
      • img3
      • In the _form.html.erb, add this script:
      • img4
    • Last thing, go to config/environment.rb and add this line: require 'carrierwave/orm/activerecord'
  • You can also use paperclip to upload photos:
  • Use Carrierwave : http://railscasts.com/episodes/253-carrierwave-file-uploads
  • Multiple file uploads:https://github.com/carrierwaveuploader/carrierwave#multiple-file-uploads

  • Downvote Upvote Save Open Edit
    10

    Jquery api cheat sheet


  • http://oscarotero.com/jquery/
  • Read about JSON: http://json.org/

  • Downvote Upvote Save Open Edit
    9

    Creating a rails project (without scaffold)


    Here are the steps to creating a new rails project from scratch:

    Getting started

  • Create a new rails app: rails new Project -Td postgresql .
  • Install all the software packages needed by the new Rails app. These software packages are called gems and they are listed in the file Gemfile. bundle install
  • runs rails server to make sure every thing works great: rails server

    Create the model

  • rails generate model my_model => this command will create a model file - app/models/my_model.rb and a migration file in db/migrate folder.
  • rake db:migrate => to update your database.
  • rake db:seed => to seed the database with sample data from db/seeds.rb.
  • Create the controller

  • rails generate controller my_controller => this will create a controller file app/controllers/my_controller.rb.
  • In your controller file, create an index method
  • Why index? Rails provides 7 standard controller actions for doing common operations with data https://www.codecademy.com/articles/standard-controller-actions
  • Create the view

  • In the file app/views/my_project/, add your html file: index.html.erb

  • Downvote Upvote Save Open Edit
    8

    Pass a url in the params


  • Use program/*program_id instead of program/:program_id
  • code


    Downvote Upvote Save Open Edit
    8
    Downvote Upvote Save Open Edit
    7

    Alter table in rails


  • First, in your terminal, you need to create a change migration file: rails g migration change_format_in_my_table
  • OR rails g migration FixColumnName
  • In your migration file: change_column :my_table, :my_column, :my_new_type
  • OR rename_column :table_name, :old_column, :new_column
  • Finally you: rake db:migrate

  • Downvote Upvote Save Open Edit
    7

    Mean crud and more


  • The real deal: https://thinkster.io/mean-stack-tutorial
  • notifications: http://code.ciphertrick.com/2015/04/05/easy-notifications-in-angularjs-applications/
  • Create rails angular crud in 15 minutes: http://blog.joshsoftware.com/2014/07/17/building-web-apps-with-rails4-and-angularjs-in-15-minutes/
  • More crud: https://www.airpair.com/javascript/complete-expressjs-nodejs-mongodb-crud-skeleton
  • http://adrianmejia.com/blog/2014/10/01/creating-a-restful-api-tutorial-with-nodejs-and-mongodb/

  • Downvote Upvote Save Open Edit
    6

    Git rake db commands


    git commands


    Downvote Upvote Save Open Edit
    6

    Sortable and draggable angular


  • https://github.com/a5hik/ng-sortable

  • Downvote Upvote Save Open Edit
    6

    Hello class!


    Hey guys, great job on your projects!! I'm proud of you all 😊


    Downvote Upvote Save Open Edit
    5
    Downvote Upvote Save Open Edit
    4

    Setting up heroku


  • $ heroku login
  • Clone the repository : $ heroku git:clone -a my_project then $ cd my_project
  • Deploy your changes: git add . , git commit -m "message" then git push heroku master


  • Downvote Upvote Save Open Edit
    4

    Create a search functionality in 3 steps


    Awesome resource for creating a search functionality in Rails:

  • http://railscasts.com/episodes/37-simple-search-form
  • To create an html search form:

    search Steps

  • Make sure the type is submit and it is an input search form not a button.
  • Check min 4:22 in the video
  • Search for more than one element:
  • search Steps


    Downvote Upvote Save Open Edit
    4

    Awesome frontend javascript


  • http://codepen.io/

  • Downvote Upvote Save Open Edit
    4

    Multi-tenancy gems


  • Milia
  • Apartment
  • About Multi-tenancy: http://davidlesches.com/blog/multitenancy-in-rails


  • Downvote Upvote Save Open Edit
    3

    Commit all except one file


    https://stackoverflow.com/questions/28412886/how-do-i-git-commit-all-except-one-file

    Steps

    • git add .
    • git reset /path/to/unwanted/file
    • git commit -m 'commit message'

    Downvote Upvote Save Open Edit
    2
    Downvote Upvote Save Open Edit
    2

    Create draggable using jquery


  • jQuery UI: http://jqueryui.com/
  • HTML 5: http://www.html5rocks.com/en/tutorials/dnd/basics/
  • https://www.youtube.com/watch?v=sByjNR6okao
  • http://jsfiddle.net/rFHd6/52/
  • http://www.jqueryrain.com/?fdZZ3ekD
  • http://www.jqueryrain.com/2014/08/drag-drop-form-builder-using-bootstrap/

  • Downvote Upvote Save Open Edit
    1

    Create a sortable table and progress bar


  • sortable table: "http://railscasts.com/episodes/228-sortable-table-columns"
  • progress bar: "https://api.jqueryui.com/progressbar/"

  • Downvote Upvote Save Open Edit
    1

    Yooooo


    Hi Dude Great job :)


    Downvote Upvote Save Open Edit
    0
    Downvote Upvote Save Open Edit
    0
    Downvote Upvote Save Open Edit
    0

    More gif support


    I would like to advocate for more obnoxious animation support on the Internet. Gifs 4 life


    Downvote Upvote Save Open Edit
    0

    Steps to using proxy


    Due to the limited number of servers and limited bandwidth, companies limit their api requests to protect their servers. One way to work around this is using a proxy:

    Proxy Steps


    Downvote Upvote Save Open Edit
    0
    Downvote Upvote Save Open Edit
    0
    Downvote Upvote Save Open Edit
    0

    Setting up aws bucket


    1. Go to your Amazon AWS console: here
    2. Create a bucket
    3. Remove access denied here
    4. Add bucker policy

    Now your AWS bucket should be ready. The last thing to do is to setup your prod environment on heroku. On your terminal:

    • "heroku config:set AWSACCESSKEYID"=
    • heroku config:set AWSSECRETACCESSKEY=
    • heroku config:set S3BUCKET=pmcamp
    • heroku config:set AWSREGION=us-west-2
    Note: You can get your credentials from your AWS console, click on your name on the top right > security credentials > Access keys.


    Downvote Upvote Save Open Edit
    0
    Downvote Upvote Save Open Edit
    0
    Downvote Upvote Save Open Edit
    0
    Downvote Upvote Save Open Edit
    0

    Whiteboard using socket.io


  • http://mypocket-technologies.com/2013/08/create-a-collaborative-drawing-application-with-socket-io-node-js-and-canvas/

  • Downvote Upvote Save Open Edit
    0

    Heroku deployment


    rake assets:precompile


    Downvote Upvote Save Open Edit
    0
    Downvote Upvote Save Open Edit
    0

    Setting up sendgrid and actionmailer to send emails


  • Go to app/mailers and create a new file contactmailer.rb
  • Steps
  • Create the mail view = app/views/contactmailer/contact_email.html.erb
  • Proxy Steps
  • Add actions in the controller where you wanna send the email
  • actions
  • Add this code to config/environment.rb
  • config
  • Finally, push your code to Heroku and set up send grid by typing this command in the console heroku addons:add sendgrid:starter

  • Downvote Upvote Save Open Edit
    0

    Adding devise gem


  • Add the gem 'devise'
  • rails generate devise:install
  • rails generate devise User
  • rake db:migrate
  • rails generate devise:views

  • Downvote Upvote Save Open Edit
    0

    8 awesome gems to install in every project


    1. Awesome Print
    2. Rails Panel
    3. Peek
    4. Better Errors
    5. Pry Rails
    6. Quiet Assets
    7. Bullet
    8. NewRelic (No paid account required)

  • Source here: http://www.rubyonrails365.com/7-must-have-gems-to-install-on-any-project/

  • Downvote Upvote Save Open Edit
    0

    Motivation


    You don't try to build a wall. You don't start by saying I'm gonna build the biggest, baddest, greatest wall that's ever been built. You don't start there! You say I'm gonna lay this brick as perfectly as a brick can be laid. And you do that every single day. And soon you have a wall!


    Downvote Upvote Save Open Edit
    0

    Connecting to the server


    1. Add the http script in index.html
      <script src=“node_modules/angular2/bundles/http.dev.js”/>

    2. Create a service:
      import {Http} from ‘angular2/http’;
      import {Injectable} from 'angular2/core';
      import 'rxjs/add/operator/map';

      Injectable()
      export class PostService { constructor(private _http: Http) {}

      getPosts() { return this._http.get(url).map(res => res.json()); } }

    3. In the component:
      import {HTTP_PROVIDERS} from ‘angular2/core’;


    Downvote Upvote Save Open Edit
    0

    Github clone and update remote


  • Clone
  • $ git clone https://github.com/angular/quickstart my-proj $ cd my-proj

  • Delete .git folder
  • $ rm -rf .git

  • Create a new git repo
  • $ git init $ git add . $ git commit -m "Initial commit"

    $ git remote add origin $ git push -u origin master


    Downvote Upvote Save Open Edit