Skip to content

Instantly share code, notes, and snippets.

@JArmando
JArmando / example.cs
Created June 20, 2019 20:19
Static properties for value classes
class Blabler{
string Text {get;set;}
int A {get;set;}
int B {get;set;}
int C {get;set;}
public static Blaber Blah = new Blabler { A = 1, B = 2, C = 3, Text = "Blah" };
public static Blaber Bleh = new Blabler { A = 2, B = 3, C = 4, Text = "Bleh" };
public static Blaber Bluh = new Blabler { A = 44, B = 13, C = 34, Text = "Bluh" };
}
{
"Dialog": {
"DialogID": 1,
"dialogItems": [
{
"Message": "Hola, Mi nombre es el Profesor Oak!"
},
{
"Message": "Eres hombre o mujer?",
"Answers": [
@JArmando
JArmando / DoYouNeedAClass.md
Created April 19, 2018 19:07
Single page guide on when to create a class

Do I need a class?

• Do you have multiple properties that go around a specific noun?
	`string BookName`
	`int BookPageCount`
	`bool IsTheBookPretty`
	`string CapitalizedBookName`

	That noun should be class.
@JArmando
JArmando / ReactAnimations.md
Last active August 31, 2017 15:36
React Animations using animate.css

ReactAnimations with animate.css:

Say you want to animate a list of items. Wrap these children components in a <ReactCssTransitionGroup> and set the animation settings (duh) similar to this:

//… the rest of the component declaration
// … this goes in the render function
render: function(){
	var ReactCssTransitionGroup = React.addons.cssTransitionGroup;
@JArmando
JArmando / rss translation
Created January 8, 2015 15:51
MIC - Precios de los combustibles (rss)
var str = 'http://www.mic.gob.dohttp://www.mic.gob.do/hidrocarburos/precios-de-combustibles/2015/1/03-al-09-de-enero-del-2015.aspx2015-01-02T00:00:00Dirección de Hidrocarburos, MIC <div> <strong>Gasolina Premium:</strong> RD$197.00 </div><div> <strong>Gasolina Regular:</strong> RD$174.10 </div> <div> <strong>Gasoil Premium:</strong> RD$163.00 </div> <div> <strong>Gasoil Regular:</strong> RD$154.90 </div><div> <strong>Kerosene:</strong> RD$138.70 </div><div> <strong>Gas Licuado de Petróleo (GLP):</strong> RD$85.90 </div> <div> <strong>Gas Natural Vehicular (GNV):</strong> RD$31.44 </div> <br clear="all"/> 197.00174.10163.00154.90138.7085.9031.44http://www.mic.gob.do/hidrocarburos/precios-de-combustibles/2015/1/03-al-09-de-enero-del-2015.aspx'
var preciosDeCombustibles = [];
str.split('<div>').map(function(element){
var matchResult = element.match(/<strong>(.*.)<\/strong>(.*.)<\/div>/);
if(matchResult){
element = {combustible:matchResult[1], precio:matchResult[2]};//element.replace(/<strong>/g
@JArmando
JArmando / DisplayInvalid.coffee
Created November 19, 2014 13:45
A directive that allows displaying an invalid modelValue in angular and triggers validations
directives.directive 'displayInvalid', () ->
restrict: 'A',
require: 'ngModel',
link: (scope, elm, attrs, model) ->
displayed = false
scope.$watch attrs.ngModel, (newValue, oldValue, scope) ->
if displayed is false and oldValue isnt undefined
displayed = true
elm.val model.$modelValue
model.$setViewValue(model.$modelValue)
@JArmando
JArmando / gist:586fee20dbc9c836aace
Created October 21, 2014 03:25
#DevDo como crear un json a partir de texto
var texto = '1 Pablo Batida 2 soy una prueba';
var listaBonita = texto.split(/\d/g);
var jsonsito = '';
listaBonita.map(function(element, index){
jsonsito += element ? '{"'+ index + '":"' + element + '"}':''
});
console.log(jsonsito);