Skip to content

Instantly share code, notes, and snippets.

View danielpsf's full-sized avatar

Daniel Fernandes danielpsf

View GitHub Profile
@danielpsf
danielpsf / jsbin.oQoMoMo.html
Last active December 22, 2015 16:28
A little demonstration about the ng-tree using this component: https://github.com/dump247/angular.tree Take a look here how its work here: http://jsbin.com/EbicERu/3/
<!DOCTYPE html>
<html>
<head>
<meta name="description" />
<meta charset=utf-8 />
<title>Angular Tree</title>
</head>
<body ng-app="myApp" ng-controller="myController">
<ul ng-tree="family">
<li select="selected()">{{item.name}}</li>
@danielpsf
danielpsf / jsbin.ULIFOwI.css
Created September 25, 2013 14:34
How to call directives inside controllers (AngularJS). Run code here -> http://jsbin.com/ULIFOwI/3/
.red {
color : red !important;
}
.blue {
color : blue !important;
}
@danielpsf
danielpsf / jsbin.Ozijuwi.html
Created January 9, 2014 13:16
This is a really simple way to get a formatted string from the database and put it into front end with AngularJS. You can see it working here: https://gist.github.com/danielpsf/8333968
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="myApp" ng-controller="myController">
<div my-directive>
@danielpsf
danielpsf / app.js
Last active August 29, 2015 13:55
Just to understand more about binding an event watch to some element into a directive. you can see here: http://jsbin.com/EluKodAC/3
angular.module('myApp', [])
.controller('myCtrl', ['$scope', function($scope) {
$scope.MyProccessedData = "";
}])
.directive('myDirective', [function(){
return function(scope, element, attrs) {
element.bind('keydown', function(event) {
scope.MyProccessedData = scope.$eval(attrs.ngModel);
});
};
@danielpsf
danielpsf / specHelper.js
Created March 6, 2014 18:36
This is my jasmine spec helper
'use strict';
beforeEach(function() {
this.addMatchers({
toEqualData: function(expected) {
this.message = function () {
var notText = this.isNot ? " not" : "";
return "Expected " + JSON.stringify(this.actual) + notText + " to be equals that " + JSON.stringify(expected);
}
return JSON.stringify(this.actual) === JSON.stringify(expected);
@danielpsf
danielpsf / BderH.markdown
Created March 19, 2014 12:52
A Pen by Daniel Pedro dos Santos Fernandes.
@danielpsf
danielpsf / SassMeister-input.scss
Created August 5, 2015 16:27
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
//Variables
$default-font-color: red;
$default-width: 10px;
$title-font-color: blue;
//Mixins (functions)
@danielpsf
danielpsf / potatoes.py
Created August 24, 2018 16:27
Simple way of using multiple parameters in Python using argparse
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'--potatoes', '-p',
nargs='*',
type=str,
required=True,
help='Type of potatoes that you like most'
@danielpsf
danielpsf / devsecops_challenge_1.md
Last active April 30, 2019 14:56
A devops small challenge to be used on interviews

AWS Security monitoring and alert

After a technical interview where the candidate will have the oportunity to go over these topics this challenge can be used to assess the automation and coding skills as well as the AWS knowledge of a candidate.

Assumptions

  • Although documentation is not mandatory for this challenge it still is quite important
  • Any automation tool can be used, so feel free to use whatever you are most comfortable with, bash script included
  • Although our main development languages are Python and Go, feel free to pick whatever you are most comfortable with
@danielpsf
danielpsf / devops_questions_1.md
Last active December 3, 2020 08:42
A devops small set of questions to be used on interviews

DevOps questions to be asked

  • Please describe how would you do the deploy and configure of the items below in terms of technologies and deployment (CICD):
    • Deploy a high available Application using EC2
      • https://botkit.ai
      • https://riot.im
      • A PostgreSQL
      • Web API using Java SpringBoot, Python (Flask), Go (MUX), NodeJS (Express or Restify) that connects with a PostgreSQL
    • Deploy a SPA
  • Please describe how would you architect, configure and deploy your network in terms of technologies and deployment (CICD) in a way that your applications would be safe