Skip to content

Instantly share code, notes, and snippets.

View UnJavaScripter's full-sized avatar

Diego Coy UnJavaScripter

View GitHub Profile
<!DOCTYPE HTML>
<html lang="en" ng-app="cosasPorHacer">
<body ng-controller="cosasPorHacer_Ctrl">
<!-- ng-submit se dispara cuando el formulario se envía (bien sea por el accionar de la tecla Enter o por clic sobre el botón "Enviar"); ejecutará "agregarElemento" es el nombre de la función que inserta elementos en el array "$scope.listaDeCosas". -->
<form ng-submit="agregarElemento()">
<!-- La propiedad ' ng-model="cosaPorHacer" ' del input hace que Angular pueda tomar su valor desde el controlador. Angular se debe referir a este modelo usando "$scope.cosaPorHacer" -->
<input type="text" ng-model="cosaPorHacer" placeholder="Agregar nueva cosa por hacer">
<input type="submit">
</form>
@UnJavaScripter
UnJavaScripter / filtro_booleanos
Created August 14, 2014 16:10
Filtro para AngularJS para convertir valores booleanos (1-0,true-false) en cadenas de texto legibles, "falso" y "verdadero"
function filtroBooleanos () {
return function (input) {
if(input === false || input == 0){
return "falso";
}else if(input === true || input == 1){
return "verdadero"
}
}
}
angular
@UnJavaScripter
UnJavaScripter / decaser
Created November 7, 2014 18:21
Converts camel or bumpy cased strings to human readable space separated strings
var decaser = function(input){
var newStr = [],
resultStr;
for( var i = 0 ; i < input.length ; i++ ){
if(input.substring(i,i+1) === input.substring(i,i+1).toUpperCase()){
var spacedDecased = " "+input.substring(i,i+1).toLowerCase();
newStr.push(spacedDecased);
}else{
newStr.push(input.substring(i,i+1))
}
@UnJavaScripter
UnJavaScripter / Console.log.sublime-snippet
Last active October 8, 2015 03:18
Console.log Sublime Text 2 Snippet
<!--
* Sublime Text 2
* Inside Sublime go to
* Preferences -> Browse Packages
* Open the JavaScrip folder
* Save this snippet there with the .sublime-snippet file extension
* Sublime Text 3
* Tools > New Snippet > *Replace the content with this* > *Save right there where Sublime suggests*
-->
@UnJavaScripter
UnJavaScripter / codeGenerator.js
Last active September 4, 2015 17:44
Time based code generator ( without Math.random )
function () {
var a = (Date.now()*(Date.now())*1e+1*(3e+8*(Date.now()))).toString(36);
return a.substr(5,a.length);
}
@UnJavaScripter
UnJavaScripter / listaDeCosasPorHacer_0_42.html
Last active September 5, 2015 01:41
listaDeCosasPorHacer
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body ng-app="listaDeCosasPorHacer">
La respuesta a la vida, el universo y todo es: {{7*6}}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
@UnJavaScripter
UnJavaScripter / .aliases
Last active October 7, 2022 17:04
Aliases
alias gss='git status'
alias gc='git add --all && git commit -am'
alias gl='git log'
alias gco='git checkout '
alias gresetrepo='git fetch origin && git reset --hard origin/master && git clean -f -d'
alias cls='printf "\033c"'
# An alias to set an environment variable depending on the user input
alias aliasvar="read -p 'Alias variable name: ' var; read -p 'Alias variable value: ' val; export \"\$var\"=\"\$val\""
@UnJavaScripter
UnJavaScripter / install_stuff.sh
Last active March 4, 2016 15:14
install_stuff
#!/bin/sh
THEM_APPS="google-chrome-stable \
git-core \
tig \
curl"
THEM_MODULES="yo \
gulp \
bower \
live-server \
@UnJavaScripter
UnJavaScripter / vscode_angular-snippets.js
Created June 27, 2016 18:38
Visual Studio Code AngularJS Snippets
{
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
// Example:
"Console log": {
"prefix": "c",
"body": [
"console.log($1);"
@UnJavaScripter
UnJavaScripter / tostada.js
Created July 27, 2016 00:13
A sample toaster library - Una librería para 'toasts' de ejemplo
"use strict";
class Tostada {
constructor(config) {
// Exponemos config como una variable 'global' dentro de la clase
this.config = config;
let estilos = document.createElement('style');
estilos.innerHTML = `