Skip to content

Instantly share code, notes, and snippets.

View rkt2spc's full-sized avatar
🏎️

Tuan rkt2spc

🏎️
View GitHub Profile
@rkt2spc
rkt2spc / PrintTriangle.cpp
Created March 12, 2016 13:27
Print out n-layered number-triangle
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int n = 15;
for (int i = 1; i <= n; i++)
{
@rkt2spc
rkt2spc / NMTC_ChienThuatTruyenTin
Last active March 14, 2016 14:27
Chiến lược vòng Nối Mạng Toàn Cầu
Truyền tin dạng DEC:
...
Truyền tin dạng Binary:
...
@rkt2spc
rkt2spc / Decoder.h
Last active March 21, 2016 08:35
Encoder và Decoder cho vòng thi Nối Mạng Toàn Cầu cuộc thi Thách Thức 2016
#pragma once
#include <string>
#include <vector>
#include <math.h>
using namespace std;
class Decoder
{
public:
char K = 0;
@rkt2spc
rkt2spc / Answer.html
Last active March 28, 2016 14:04
Answer
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="css/normalize.css"/>
<link rel="stylesheet" href="css/bootstrap.min.css"/>
</head>
<body>
<div class="container-fluid">
@rkt2spc
rkt2spc / Answer2.html
Created March 28, 2016 14:12
Answer2
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="css/normalize.css"/>
<link rel="stylesheet" href="css/bootstrap.min.css"/>
</head>
<body style="background-color: gray;">
<div style="width: 960px; margin: 8px auto; background-color: white">
Project Structure
- index.js //Your NodeJs code
- /public // What in here is your tradition Angular App (like the one on Angular Tutorial)
- /css
- /js
- app.js // Your Angular code
- index.html
================= Server Side =============================
//Node index.js
@rkt2spc
rkt2spc / markdown.md
Created December 13, 2016 13:50 — forked from rikukissa/POST.md
Unit testing Angular.js app with node.js, mocha, angular-mocks and jsdom

Testing Angular.js app headlessly with node.js + mocha

Lean unit tests with minimal setup

Code examples

Keypoints

  • Fake DOM (Everything works without a real browser)
  • Uses ngMocks to inject and mock Angular.js dependencies
  • I'm assuming you are already using browserify (but everything works fine without it)
@rkt2spc
rkt2spc / client-app.js
Created December 28, 2016 08:55
Handle oauth token redirect front-end angular
var app = angular.module('app', ['ui.router']);
app.config(['$stateProvider',
function ($stateProvider) {
// UI-Router
// Application states
var applicationStates = [
// Pre-authenticated
{
@rkt2spc
rkt2spc / basic-firewall.sh
Created January 15, 2017 17:35
Linux op works
ufw allow OpenSSH
ufw allow http
ufw allow https
ufw enable
ufw status
error_code("OK", 0)
error_code("InternalError", 1)
error_code("BadValue", 2)
error_code("OBSOLETE_DuplicateKey", 3)
error_code("NoSuchKey", 4)
error_code("GraphContainsCycle", 5)
error_code("HostUnreachable", 6)
error_code("HostNotFound", 7)
error_code("UnknownError", 8)
error_code("FailedToParse", 9)