Skip to content

Instantly share code, notes, and snippets.

View amirrajabi's full-sized avatar
🎯
Focusing

Amir amirrajabi

🎯
Focusing
View GitHub Profile
---------- Start with EC2 server -----------
- create account on Amazon
- create EC2 enstance
- create group securety in EC2 with SSH:22 (console conection) and HTTP:8080 (web conection)
- connect to server with SSH (test working)
- run code for redirect all http port to 8080 (find on full-stack bookmark)
- create directory "site" on root
- set SFTP filezila for uploading files
- connect to server with filezila (test working)
GET, POST, DELETE, PUSH, PATCH
node install
$ npm init
$ npm install express --save
$ node app.js
$ npm install gulp --save
$ npm install gulp -g
$ npm install gulp-nodemon --save
https://github.com/angular/angular-seed
$ npm install
$ npm start --no-spin
$ npm test --no-spin
catch(errorCallback) – shorthand for promise.then(null, errorCallback)
$scope.$watch(){}
$ sudo npm install -g react-tools
$ jsx src/ build/
@amirrajabi
amirrajabi / Rails Helper
Created July 21, 2015 07:09
selection of usable module code for Rails development
#---------- General Search -----------#
def self.search keywords
return Media.all if keywords.empty? #if field was empty back all content
search_fields = BASIC_SEARCH_FIELDS #list of table fields
search_array = search_fields.map { |f| "#{f} LIKE ?" } #create new array with "LIKE ?"
search_str = search_array.join(' OR ') #Join all cells of array
search_values = keywords.map { |k| "%#{k}%"} * search_fields.count #create new array and add keyword * field.length
Media.where(search_str, *search_values) # serach in select field on db
end
@amirrajabi
amirrajabi / Ruby on Rails Programming
Last active August 29, 2015 14:24
Ruby on Rails Programming syntax
Routing:
get 'demo/index'
match ':controller(/:action(/:id))', :via => :get
match ':controller(/:action(/:id))', :via => [:get, :post]
match ':controller(/:action(/:id(.:format)))', :via => :get
root "demo/index"
class DemoController < ApplicationController
@amirrajabi
amirrajabi / REST API
Last active August 29, 2015 14:24
All about REST API on Ruby on Rails
$ rake routs
----- config/routes.rb
resources :subjects
resources :subjects, except: :destroy
resources :sobjects, only: :index
resources :subjects, only: [:index, :show]
@amirrajabi
amirrajabi / SQL
Created July 14, 2015 00:37
SQL Commands
# ----------------------------- SQL ------------------------
# SELECT *
# FROM movies
# WHERE ganre = "Horrer"
# ORDER BY duration;
# ORDER BY duration DESC;
# WHERE duration > 100; >= <= = > < <>
# AND
# OR
@amirrajabi
amirrajabi / Angular 2
Created July 12, 2015 12:44
Angular 2, Setup and Developing
$ npm install -g 'typescript@^1.5.0-beta'
$ git clone https://github.com/fcoury/angular2-reddit
$ npm install
1 <!doctype html>
2 <html>
3 <head>
4 <title>Angular 2 - Poor Man's Reddit</title>
/*
** for using Dynamic API, you should load jquery!
*/
// vars-----------------------------------------------------------
var winWidth = $(window).width(),
mobileWidth = 750;
//----------------------------------------------------------------
// list of function-----------------------------------------------
setHeight('featured-coffee-tea', winWidth, mobileWidth);