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
// Single Element | |
// --- | |
var Nav; | |
// Define Nav as tag, component, anything. | |
// Input (JSX): To be written by you. | |
var app = <Nav color="blue"/>; | |
// Output (JS): Compiled and converted to this by Babel. |
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
// Form Declaration. | |
var MyFormComponent = React.createClass({ ... }); | |
// Subcomponents declaration. | |
MyFormComponent.Row = React.createClass({ ... }); | |
MyFormComponent.Label = React.createClass({ ... }); | |
MyFormComponent.Input = React.createClass({ ... }); | |
// Actual app. | |
var App = ( |
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
// Input (JSX): | |
var person = <Person name={window.isLoggedIn ? window.name : ''}>; | |
// Output (JS): | |
var person = React.createElement( | |
Person, | |
{name: window.isLoggedIn ? window.name : ''} |
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
// Input (JSX): | |
var content = <Container>{window.isLoggedIn ? <Nav /> : <Login />}</Container>; | |
// Output (JS): | |
var content = React.createElement( | |
Container, | |
null, | |
window.isLoggedIn ? React.createElement(Nav) : React.createElement(Login) |
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 props = {}; | |
props.foo = x; | |
props.bar = y; | |
// Write your attribute with the props defined. | |
var component = <Component {...props} />; | |
//-- | |
// If needs to be changed later, this could be done. |
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
vector<int> Knuth_Morris_Pratt(string text,string pattern) | |
{ | |
vector<int> F = build_failure_function(pattern); | |
vector<int> positions; | |
int i = 0; // state of automaton | |
int j = 0; // position of counter in string. | |
for( ; ; ) { | |
if(j == n) break; // we reached the end of the text |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
/*************** Kmp Functions. ***************/ | |
void compute(int * kmparr, char * pattern, int patternlength) { | |
int m = patternlength; | |
kmparr[0] = 0; | |
int len = 0, i; | |
for (i = 1; i < m; ++i) | |
{ | |
if (pattern[i] == pattern[len]) | |
{ |
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 numpy as np | |
import tensorflow as tf | |
from random import shuffle | |
class Glove: | |
"""docstring for Glove""" | |
def __init__(self, corpus, context_size=2, learning_rate=0.05, batch_size=100, num_epochs=100): | |
super(Glove, self).__init__() | |
self.corpus = corpus | |
self.CONTEXT_SIZE = context_size |