Skip to content

Instantly share code, notes, and snippets.

Avatar

Hackrio hackrio1

  • Hackrio
  • Gurugram
View GitHub Profile
View bubble-sort.c
#include <stdio.h>
void bubble_sort(int a[], int n) {
int i = 0, j = 0, tmp;
for (i = 0; i < n; i++) { // loop n times - 1 per element
for (j = 0; j < n - i - 1; j++) { // last i elements are sorted already
if (a[j] > a[j + 1]) { // swop if order is broken
tmp = a[j];
a[j] = a[j + 1];
a[j + 1] = tmp;
}
View without-jsx.js
ReactDOM.render(React.createElement(
'h1',
null,
'Hello World!'
), document.getElementById('root'));
View with-jsx.js
ReactDOM.render(
<h3>Hello World!</h3>
,document.getElementById('root')
);
View dummy-element.js
const element=<h3>Hello World!</h3>;
View demo.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import Hello from './App'
import registrationServiceWorker from './registrationServiceWorker';
ReactDOM.render('Hello', document.getElementById('root'));
registrationServiceWorker();
View hello-world.js
import React, { Component } from 'react';
import './App.css';
class Hello extends Component {
render() {
return (
<h3>Hello World!</h3>
);
}
}
View app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppModule } from './app/component';
import { DemoComponent } from './components/demo/demo.component';
@NgModule({
declarations: [
AppComponent,
DemoComponent
View demo.component.html
<h1>{{ message }}</h1>
<form>
<div>
<label for="message">essage: </label>
<input type="text" [(ngModel)]="message" name="message">
</div>
</form>
View demo.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './demo.component.html',
styleUrls: './demo.component.scss'
})
export class DemoComponent implements OnInit {
message: string,