Skip to content

Instantly share code, notes, and snippets.

View danielpsf's full-sized avatar

Daniel Fernandes danielpsf

View GitHub Profile
@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 / 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 / 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.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 / 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 / BderH.markdown
Created March 19, 2014 12:52
A Pen by Daniel Pedro dos Santos Fernandes.
@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 / 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);
});
};