• Do you have multiple properties that go around a specific noun?
`string BookName`
`int BookPageCount`
`bool IsTheBookPretty`
`string CapitalizedBookName`
That noun should be class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" }; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Dialog": { | |
"DialogID": 1, | |
"dialogItems": [ | |
{ | |
"Message": "Hola, Mi nombre es el Profesor Oak!" | |
}, | |
{ | |
"Message": "Eres hombre o mujer?", | |
"Answers": [ |
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;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |