Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
var myResponse = {"start_date":["A valid integer is required."], | |
"end_date":["A valid integer is required."], "commite":["Require commite."]} | |
//iterate over the serializer error message | |
for (var prop in myResponse) { | |
var errorValue = myResponse[prop]; | |
//test if the current prop has an _ in it string value | |
var _pattern = /_/; | |
if (_pattern.test(prop)) { |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
var myObjArray = [ | |
{ | |
name: 'peter', | |
age: 25 | |
}, | |
{ | |
name: 'john', | |
age: 15 |
import org.apache.commons.codec.binary.Base64; | |
import java.security.SecureRandom; | |
/** | |
* Created by pitaside on 7/12/2015. | |
*/ | |
public class RandomURLKeyGenerator { | |
public static String generateURLKey(int length) { |
class App extends React.Component { | |
static propTypes = { | |
params: PropTypes.object.isRequired, | |
}; | |
state = { | |
.... | |
}; | |
componentWillMount() { |
var InputComponent = React.createClass({ | |
propTypes: { | |
type: React.PropTypes.string, | |
placeholder: React.PropTypes.string, | |
id: React.PropTypes.string, | |
classStyle: React.PropTypes.string, | |
defaultVal: React.PropTypes.oneOfType([ | |
React.PropTypes.string, | |
React.PropTypes.number |
/* | |
Please feel free to comment and any advice | |
* Created by peter | |
*/ | |
var Person = {} | |
// an empty person object | |
//sample json object, can also be from a server | |
var sampleJson = {'name': 'Peter', 'age': "20"}; |
//simple work arroud on getting a property type using a matcher from an array | |
//welcome any comment and modification / enhacnement | |
var myArray = [{"name" : "pitaside", "id" : 1}, {"name":"github", "id" : 3}] | |
filterArrayByType: function (arrayToMatch, fieldType, matcher) { | |
if(! arrayToMatch instanceof Array){throw ("Not an Array")} | |
var filterTypeToReturn = arrayToMatch.filter((items) => { | |
var temp; | |
if (items[String(fieldType)] === matcher) { | |
temp = items[String(fieldType)] |