In this tutorial we will precompile jsx codes with babel and then pack the entire app that includes tailwindcss and React
with webpack. At
last we have app.js
bundle file that contains all javascript source codes, dependencies and tailwindcss.
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 'dart:convert'; | |
import 'dart:core'; | |
import 'dart:io'; | |
class MySocket { | |
final int port = 5000; | |
final String host = "10.0.2.2"; | |
final String data; | |
MySocket(this.data); |
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
async function getData(url) { | |
const headers = {} // Add headers here | |
const init = { | |
method: 'GET', | |
headers: new Headers(headers), | |
} | |
const response = await fetch(url, init); | |
if (response.ok) { | |
return await response.json(); | |
} |
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
class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.chooseVideo = this.chooseVideo.bind(this); | |
} | |
chooseVideo(newVideo) { | |
this.setState({ | |
// Change something | |
}); |
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
from django import forms | |
class NameForm(forms.Form): | |
your_name = forms.CharField(label='Your name', max_length=100) |
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
<!-- polls/templates/polls/detail.html --> | |
<form action="{% url 'polls:vote' question.id %}" method="post"> | |
{% csrf_token %} | |
<fieldset> | |
<legend><h1>{{ question.question_text }}</h1></legend> | |
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} | |
{% for choice in question.choice_set.all %} | |
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}"> | |
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br> | |
{% endfor %} |
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
# mysite/urls.py | |
from django.contrib import admin | |
from django.urls import include, path | |
urlpatterns = [ | |
path('polls/', include('polls.urls')), | |
path('admin/', admin.site.urls), | |
] |
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
from django.http import HttpResponse | |
def index(request): | |
return HttpResponse("Hello, world. You're at the polls index.") |
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
class BST_Tree { | |
Node nodeHead; | |
/** | |
* @param customRoot The custom node is a root that will be calculate number of sub trees from that | |
*/ | |
int countSubTree(Node customRoot) { | |
if (customRoot.left != null && customRoot.right != null) { | |
int subTreeLeft = countSubTree(customRoot.left); | |
int subTreeRight = countSubTree(customRoot.right); |
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
#define MIN(a, b) a < b ? a : b | |
void changeSize(int* &arr, int &size, int newSize) { | |
// Allocate a new array | |
int* newArray = new int[newSize]; | |
// Copy all elements to the new array | |
for(int i = 0; i < MIN(size, newSize); ++i) { | |
newArray[i] = arr[i]; | |
} | |
// Free and assign the new Array |
NewerOlder