Skip to content

Instantly share code, notes, and snippets.

git init
git add .
git commit -m 'First commit'
git remote add origin remote repository URL
git remote -v
git pull origin master
git push origin master
@shotaK
shotaK / Commands
Last active August 29, 2015 14:26 — forked from frontend-gist/Commands
MongoDB
// Mongo configuration file
/etc/mongod.conf
// Start Mongo service
sudo service mongod start
// Check if Mongo is running, last line should be: "[initandlisten] waiting for connections on port 27017"
cat /var/log/mongodb/mongod.log
// Check if Mongo is running
@shotaK
shotaK / sass basics
Last active August 29, 2015 14:26 — forked from frontend-gist/sass basics
sass
/* --------------------- Variables --------------------- */
/* SCSS */
$primary-color: #333;
body {
color: $primary-color;
}
@shotaK
shotaK / Basic NodeJS
Last active August 29, 2015 14:26 — forked from frontend-gist/Basic NodeJS
Node.js
// --------------------------- create basic server --------------------------- \\
var http = require("http");
var myServer = http.createServer(function (request, response) {
response.writeHead(200, {"Content-type": "text/html"});
response.write("<p><strong> hello </strong> batkan </p>");
response.end();
});
myServer.listen(3000);
// app.js ----------------------------------------------------
'use strict';
angular
.module('app', [
'ngSanitize',
'ngAnimate',
'ngTouch',
'ui.bootstrap',
// --------------------------- create a model ---------------------------
yo meanjs:express-model <model-name>
// e.g
yo meanjs:express-model category
// --------------------------- create a controller ---------------------------
yo meanjs:express-controller <controller-name>
// e.g
@shotaK
shotaK / .env file configuration
Last active September 10, 2015 12:11
Laravel 5
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=ghostblog
DB_USERNAME=admin
DB_PASSWORD=pass
@shotaK
shotaK / Don't load partial on specific page
Last active September 19, 2015 21:08
AngularJS - styleguide
// some controller
$rootScope.isListing = false;
var page = '/listings';
$rootScope.$on('$routeChangeSuccess', function (e, current, pre) {
var currentRoute = $location.path();
(currentRoute == noFooterPage) ? $rootScope.isListing = true : $rootScope.isListing = false;
});
@shotaK
shotaK / trusthtml.js
Last active October 10, 2015 16:10 — forked from nelsonpecora/trusthtml.js
Custom filter to trust all html.
// WARNING: Use with caution. Don't use when displaying user-created content.
app.filter('html', ['$sce', function ($sce) {
return function(t) {
return $sce.trustAsHtml(t)
}
}]);
// Usage
<span ng-bind-html="yourDataValue | html"></span>
@shotaK
shotaK / Create user for DB
Last active November 27, 2015 20:20
PostgreSQL
// create user shota with password 1111, when logged in certain DB
CREATE USER shota WITH SUPERUSER LOGIN PASSWORD '1111';
// grant all privileges to specific user
grant all privileges on database db_name to someuser;