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
{"event":"DISCOVER_QUESTION_CLICKED","category":"NEW_EVENT","label":"TOP","value":"null","meta":{"device_id":"1369eb5fba4241e2","version":9999,"platform":"Android","user_id":"39486045"},"data":{"question_text":"What is the best movie you have ever seen?","question_id":null,"bucket":"LIKE","FEED_TYPE":"TOP","current_fragment":"DiscoverFragment","current_activity":"MainActivity"},"timestamp":1454450393022} |
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
public class Solution { | |
public int longestValidParentheses(String s) { | |
int maxLen = 0; | |
// the index that right before the beginning of the current longest substring | |
int left = -1; | |
Stack<Integer> stack = new Stack<Integer>(); | |
for (int i=0; i<s.length(); i++) { | |
if (s.charAt(i) == '(') { | |
stack.push(i); |
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
[ | |
{ | |
"company_deals": [ | |
"\/steak-n-shake\/" | |
], | |
"title": [ | |
"Buy 1, Get 1 Free Holiday Specialty Shakes " | |
], | |
"type": "In-store Coupon", | |
"image_url": [ |
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
import random | |
class Card(object): | |
suits = {'C':'Club', 'D':'Diamond', 'H':'Heart', 'S':'Spade'} | |
ranks = {1:'Ace', 11:'Jack', 12:'Queen', 13:'King'} | |
def __init__(self, rank, suit): | |
# go from 1 to 13 | |
self.rank = rank |
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 is to solve the Lyft Programming Challenge | |
import math | |
def distance_between(p1, p2): | |
"""This calculates the linear distance between two points | |
on a 2D coordinates system. | |
Args: | |
p1: the start point (a tuple of x,y coordinates) | |
p2: the end point (a tuple of x,y coordinates) |
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
1. Listen to changes in the model can be implemented through the initialize() by the following format: this.on('change', callback_function). Listen to changes of a specific attribute can be done through this way too (just add in what attribute after change: change -> change:attr_name) | |
2. validation through Model.validate() | |
3. View does not contain the HTML markup. It contains the logic behind the presentation of the model's data to the user. | |
4. A view’s render() method can be bound to a model’s change() event, enabling the view to instantly reflect model changes without requiring a full page refresh. | |
5. el - a reference to the DOM element which every view has |