Skip to content

Instantly share code, notes, and snippets.

@shotaK
shotaK / destructuring.js
Created May 10, 2016 08:08 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@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>
// app.js ----------------------------------------------------
'use strict';
angular
.module('app', [
'ngSanitize',
'ngAnimate',
'ngTouch',
'ui.bootstrap',
@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);
@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 / 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
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