Skip to content

Instantly share code, notes, and snippets.

View akisvolanis's full-sized avatar

Akis Volanis akisvolanis

  • e-food.gr
  • Greece
View GitHub Profile

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

// include this code in your application, you don't need to call any initialization manually!
Ember.Application.initializer({
name: "meta",
initialize: function(container, application) {
// helper function to get tag from dom
var _getTag = function(tagname, property, value) {
var tags = document.head.getElementsByTagName(tagname),
tag,
/* Put your CSS here */
html, body {
margin: 20px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<link rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com.s3.amazonaws.com/ember-1.0.0-rc.7.js"></script>
</head>
@akisvolanis
akisvolanis / defaults.yml
Last active October 15, 2020 18:12
Upload ssh key to gitlab for deploy user with ansible
deploy_user_name: 'deployer'
# More info about password: http://docs.ansible.com/faq.html#how-do-i-generate-crypted-passwords-for-the-user-module
# password created with: python -c "from passlib.hash import sha512_crypt; print sha512_crypt.encrypt('example_password')"
deploy_user_password: <encrypted_password>
user_shell: "/bin/bash"
deploy_user_home: "/home/{{ deploy_user_name }}"
repo_api_token: <your_api_token>
repo_project_id: <your_project_id>