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
// ************************************************************************************************ | |
// What Javascript methods would convert the string "20" to an integer (on the fly) so "20" + 20 = 40? | |
"20"+20 = "2020" | |
parseInt('20') + 20; | |
"20"*1 | |
+"20"+20 |
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
Douglas Crockford has been teaching a useful singleton pattern for achieving this discipline, and I thought his pattern might be of interest to those of you building on top of YUI. Douglas calls this the “module pattern.” Here’s how it works: | |
1. Create a namespace object: If you’re using YUI, you can use the YAHOO.namespace() method: | |
YAHOO.namespace("myProject"); | |
This assigns an empty object myProject as a member of YAHOO (but doesn’t overwrite myProject if it already exists). Now we can begin adding members to YAHOO.myProject. | |
2. Assign the return value of an anonymous function to your namespace object: | |
YAHOO.myProject.myModule = function () { |
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
An understanding of algorithms is necessary to pass interviews and write scalable code. | |
Work on programming projects, the larger the better. | |
Get your code reviewed by others, the more experienced the better. | |
Become very good at one programming language. If it's Java, study Effective Java. For C++, Effective C++ and its sequel, etc. | |
Take a Programming Languages course to get exposed to different programming paradigms. Ideas will carry over. (Google's map-reduce came from the Lisp world.) | |
Learn about the memory hierarchy, from registers to secondary storage, and how to optimize performance. | |
Learn about concurrency and synchronization. | |
Study an interview prep book, such as Programming Interviews Exposed orCracking the Coding Interview. | |
When you apply, especially if you're not from a top 5 school, find a Google/FB employee who can refer you. That gets you to the top of the stack, and that person will be motivated to help you, including making sure you don't get lost in the shuffle. Don't apply through the |
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
// Readable javascript... | |
for (var i = 1; i <= 100; i++) { | |
var isDividibleByThree = i % 3 === 0; | |
var isDivisibleByFive = i % 5 === 0; | |
if (isDividibleByThree && isDivisibleByFive) { | |
console.log('FizzBuzz'); | |
} | |
else if (isDividibleByThree) { | |
console.log('Fizz'); |
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
<div ng-repeat="roleFeature in (sortedRoles = (item.role.roleFeatures | orderBy: 'feature.featureCategory.name'))"> | |
<div class="privilegesRoleFeatures"> | |
<div class="profile-hd" ng-if="(sortedRoles[$index].feature.featureCategory.id !== sortedRoles[$index -1].feature.featureCategory.id) && sortedRoles[$index].feature.featureCategory.id != 1" ng-bind="roleFeature.feature.featureCategory.name"></div> | |
<div class="privilegesFeatureName" ng-bind="roleFeature.feature.name"></div> | |
</div> | |
</div> |
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
/* | |
* Array spread operator | |
*/ | |
const arr = [1, 3, 5] | |
arr.concat(7) | |
// [1, 3, 5, 7] // returns a new array, doesn't change arr | |
arr.push(11) | |
// [1, 3, 5, 11] // actually changes arr |
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
this.setState(state => { | |
showAnswer: !state.showAnswer | |
}) | |
this.setState(state => ({ | |
showAnswer: !state.showAnswer | |
})) | |
this.setState(state => { | |
return { ...state, | |
showAnswer: !state.showAnswer }; | |
}); |
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
case TOGGLE_TWEET: | |
return { | |
...state, | |
[action.id]: { | |
...state[action.id], | |
likes: action.hasLiked === true | |
? state[action.id].likes.filter( (uid) => uid !== action.authedUser ) | |
: state[action.id].likes.concat([action.authedUser]) | |
} | |
} |
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
onPressHandle() { | |
Alert.alert( | |
'Alert Title', | |
'My Alert Msg', | |
[ | |
{ | |
text: 'Ask me later', | |
onPress: () => console.log('Ask me later pressed') | |
}, |
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
{questions.map((question, index) => ( | |
<Card | |
key={index} | |
question={question.question} | |
answer={question.answer} | |
index={index} | |
/> | |
))} | |
{Object.keys(decks).map(key => { |
OlderNewer