Skip to content

Instantly share code, notes, and snippets.

@kmassada
kmassada / Angular-Typescript.md
Last active February 20, 2016 02:47
Angular with Typescript project setup

init

mkdir nuProject
bower init
npm init -y

touch gulfile.js
mkdir -p public/{css,js,modules,partials}
touch public/css/style.css
touch public/js/script.js
@kmassada
kmassada / Angular-quickstart.md
Last active February 20, 2016 02:48
Quick Angular project setup

init

mkdir nuProject
bower init
npm init -y

touch gulfile.js
mkdir -p public/{css,js}
touch public/css/style.css
touch public/js/script.js
@kmassada
kmassada / mocha-test.js
Created January 7, 2016 12:56
mocha basic test
var assert = require('assert');
describe('String#split', function(){
it('should return an array', function(){
assert(Array.isArray('a,b,c'.split(',')));
});
});
@kmassada
kmassada / index.js
Created January 6, 2016 17:34
node's hello world
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.get("/", function(req, res) {
@kmassada
kmassada / jasmine-test.js
Created January 6, 2016 17:28
jasmine basic test
(function () {
'use strict';
describe('Give it some context', function () {
describe('maybe a bit more context here', function () {
it('should run here few assertions', function () {
expect(true).toBe(true);
});
});
});
@kmassada
kmassada / vbox-mount-fix.sh
Last active December 20, 2015 12:21
Virtualbox Failed to mount centos7 vagrant
yum update -y; reboot;
yum install kernel-devel -y; reboot;
cd /tmp/;
wget http://download.virtualbox.org/virtualbox/5.0.10/VBoxGuestAdditions_5.0.10.iso;
sudo mkdir /mnt/
sudo mount -o loop VBoxGuestAdditions_5.0.10.iso /mnt
sudo /mnt/VBoxLinuxAdditions.run
@kmassada
kmassada / README.md
Last active September 4, 2021 12:22
Vagrant and KVM(QEMU) on Centos7

Libvirt

yum group install -y "Development Tools"
yum -y install qemu-kvm libvirt virt-install bridge-utils libvirt-devel  libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c
echo "net.ipv4.ip_forward = 1"|sudo tee /etc/sysctl.d/99-ipforward.conf
sysctl -p /etc/sysctl.d/99-ipforward.conf
@kmassada
kmassada / utils.sh
Last active June 12, 2017 03:39
helpers for bash scripts
#!/bin/bash
answer_is_yes() {
[[ "$REPLY" =~ ^[Yy]$ ]] \
&& return 0 \
|| return 1
}
ask() {
print_question "$1"
@kmassada
kmassada / README.md
Last active February 8, 2018 12:22
My GHOST BLOG workflow

STRUCTURE

  • we try out best to separate ghost/ from our application
  • depending on prod/dev ghost/ is git, or latest zip
  • Prod is started using pm2.
.
├── Capfile                        #cap task management 
@kmassada
kmassada / npm-nuke.sh
Last active November 12, 2015 01:42
completely uninstall node js and reinstall
#clear all the npms
npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs npm -g rm
#remove all the binaries
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
#compile
wget http://nodejs.org/dist/v0.10.40/node-v0.10.40.tar.gz
tar -xzf node-v0.10.40.tar.gz
./configure