Skip to content

Instantly share code, notes, and snippets.

View tomysmile's full-sized avatar

Tomy Ismail tomysmile

  • NITOZA
  • Dubai
View GitHub Profile
@tomysmile
tomysmile / NodeJS on Mac OSX.md
Last active October 9, 2015 22:52
Node: Install NodeJS on Mac OSX.md

Install NodeJS and NPM On Mac OS X for Homebrew Users

If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together.

Homebrew

I assume you have Homebrew. If not, go get it. It’s awesome for OSX. You can install tons of great stuff quickly and efficiently with it. Instructions are at the link or for your convenience, run this:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@tomysmile
tomysmile / Getting Started Web Framework.md
Last active October 10, 2015 02:34
Web: Getting Started

Getting-Started

Below are summary of getting started from several famous web/mobile framework

$ npm install -g cordova ionic
$ ionic start myApp tabs
@tomysmile
tomysmile / mongo-like-query.md
Created October 17, 2015 12:42
mongo: query like
db.users.insert({name: 'paulo'})
db.users.insert({name: 'patric'})
db.users.insert({name: 'pedro'})
db.users.find({name: /a/})  //like '%a%'

out: paulo, patric

@tomysmile
tomysmile / node-cors-express-allow.md
Created October 18, 2015 15:36
Node: CORS acceptance

// Setup express

var app = express();
var server = require('http').createServer(app);

// CORS acceptance

app.use(function(req, res, next) {
 res.header("Access-Control-Allow-Origin", "*");
@tomysmile
tomysmile / ionic-listen-port-and-address.md
Last active October 18, 2015 15:39
Ionic: Listen to specific port and address

Makes Ionic server listen to all connection:

$ ionic serve -a

Ionic server listen to specific port:

$ ionic serve -p 8101
@tomysmile
tomysmile / app.js
Created October 19, 2015 07:21 — forked from jbavari/app.js
Node API server with CORS disabled, AngularJS controllers with proxy and no proxy, and the ionic.project settings to allow proxy
var express = require('express')
var app = express()
app.get('/api/feed', function(req, res) {
res.json({name: 'feed', items: ['first', 'second']})
})
var server = app.listen(3000, function () {
var host = server.address().address
@tomysmile
tomysmile / ionic-command.md
Last active October 19, 2015 13:40
Ionic: command list

Ionic command list :

Start your project:

$ ionic start [your-app-name] [based-template]

there are 3 based templates: blank, tabs, sidemenu and map

Choose your platform:

@tomysmile
tomysmile / git-reset.md
Last active October 24, 2015 05:40
Git: Reset

Remove remote branch

git push origin :[branch-name]

Remove stale remote brance

git remote prune origin
@tomysmile
tomysmile / mysql-export-import.md
Last active October 30, 2015 00:34
Mysql: Export Import

To export a mysql database (as a dump) from the command line run:

$ mysqldump database_name > database_exportname.sql
$ mysqldump -h hostname -u username -p wordpress > wordpress.sql

To export all databases:

$ mysqldump -A > all_dbs.sql
$ mysqldump --all-databases > all_databases_export.sql
@tomysmile
tomysmile / create-user.md
Created November 1, 2015 04:51
mysql: create user
mysql> CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'localhost' WITH GRANT OPTION;
mysql> CREATE USER 'user_name'@'%' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'%' WITH GRANT OPTION;
mysql> flush privileges;