Skip to content

Instantly share code, notes, and snippets.

View elcodabra's full-sized avatar
🎯
Focusing

Aleksandr Konovalov elcodabra

🎯
Focusing
View GitHub Profile
@elcodabra
elcodabra / Aeroport Table.markdown
Last active August 29, 2015 14:27
Aeroport Table
@elcodabra
elcodabra / app.jsx
Last active September 20, 2017 09:01
Bootstrapping a React project
const App = () => {
return (
<div className="container">
<div className="starter-template">
<h1>React Project</h1>
</div>
</div>
)
}
@elcodabra
elcodabra / app.component.html
Last active September 20, 2017 08:59
Bootstrapping an Angular project
<div class="container">
<div class="starter-template">
<h1>Angular Project</h1>
</div>
</div>
@elcodabra
elcodabra / app.jsx
Created September 20, 2017 09:33
Adding a React Component
import React from 'react';
import Header from './components/header';
const App = () => {
return (
<div className="container">
<div className="starter-template">
<Header />
</div>
</div>
@elcodabra
elcodabra / tweets-list.component.html
Created September 20, 2017 11:10
View List Component for Angular
<div>
<ul class="list-unstyled">
<li class="media" *ngFor="let row of tweets; let i = index">
<img class="img-thumbnail rounded-circle mr-3" [src]="row?.account?.img" />
<div class="media-body">
<h5 class="mt-0 mb-1">{{row?.account?.fullName || "You"}}</h5>
<p class="text-muted">Posted at: {{row.createdAt}}</p>
{{row.content}}
<div class="mt-2">
<a href="#">
@elcodabra
elcodabra / ListTweets.jsx
Created September 20, 2017 11:33
New Item for React
import React from 'react';
// ...BackendService, classnames
import NewTweet from './NewTweet';
class ListTweets extends React.Component {
// ...constructor, componentDidMount, getTweets
onAdd(tweet) {
this.backendService.addTweet(tweet)
.then((data) => {
@elcodabra
elcodabra / new-tweet.component.html
Last active September 20, 2017 11:42
New Item for Angular
<form (ngSubmit)="onAdd()">
<div class="form-group">
<input
type="text" name="content"
placeholder={{placeholder}}
[(ngModel)]="model.content">
</input>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
@elcodabra
elcodabra / NewTweet.jsx
Created September 20, 2017 12:34
Adding Validation for React
import React from 'react';
import BackendService from '../../../services/backend';
import { Field, reduxForm } from 'redux-form';
import classnames from 'classnames';
export const required = value => value ? undefined : 'Field is required';
const renderField = ({
input,
placeholder,
@elcodabra
elcodabra / new-tweet.component.html
Created September 20, 2017 12:38
Adding Validation for Angular
<form #regForm="ngForm" (ngSubmit)="onAdd()">
<div class="form-group">
<textarea
type="text" name="content"
required
[ngClass]="{'form-control':true,'is-invalid':!regForm.form.valid && regForm.form.touched}"
placeholder={{placeholder}}
[(ngModel)]="model.content">
</textarea>
<div class="invalid-feedback" *ngIf="!regForm.form.valid && regForm.form.touched">