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
$(document).ready(function() { | |
$("#blockchain button.set").click(function() { | |
var value = parseInt($("#blockchain input.text").val(), 10); | |
SimpleStorage.set(value); | |
addToLog("#blockchain", "SimpleStorage.set(" + value + ")"); | |
}); | |
$("#blockchain button.get").click(function() { | |
SimpleStorage.get().then(function(value) { |
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
<template> | |
<div> | |
<p>Your peerId: {{ myPeerId }}</p> | |
<p> | |
Other peerId: | |
<input type="text" style="width: 420px" v-model="otherPeerId" /><button | |
@click="findOtherPeer" | |
> | |
Find | |
</button> |
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
<template> | |
<main role="main" class="container"> | |
<div class="card"> | |
<div class="card-body"> | |
<h5 class="card-title">Todo example</h5> | |
<p class="card-text">Simple TODO app using Bootstrap and Vue.</p> | |
</div> | |
<ul class="list-group list-group-flush"> | |
<li class="list-group-item" v-for="(todo, idx) in todos" :key="idx"> | |
{{ todo }} |
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
# Docker compose file for a simple WordPress with MySQL | |
# source: https://docs.docker.com/samples/wordpress/ | |
version: "3.3" | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- db_data:/var/lib/mysql |
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 React, { useState, useEffect } from 'react'; | |
import { StyleSheet, Text, View, Platform, Keyboard, Button, FlatList, TextInput } from 'react-native'; | |
const isAndroid = Platform.OS == "android"; | |
export default function App() { | |
const [text, setText] = useState(''); | |
const [tasks, setTasks] = useState([{ key: '0', text: "First task" }]); | |
const [viewPadding, setViewPadding] = useState(0); |
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
// SPDX-License-Identifier: Apache-2.0 | |
pragma solidity ^0.8.4; | |
contract NFTToken { | |
event Mint(address indexed _to, uint256 indexed _tokenId, bytes32 _ipfsHash); | |
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); | |
uint256 tokenCounter = 1; | |
mapping(uint256 => address) internal idToOwner; |
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
# Linear regression using GradientTape | |
# based on https://sanjayasubedi.com.np/deeplearning/tensorflow-2-linear-regression-from-scratch/ | |
import tensorflow as tf | |
import numpy as np | |
import matplotlib.pyplot as plt | |
class Model: | |
def __init__(self): | |
self.W = tf.Variable(16.0) |
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 torch | |
import torchvision | |
import torchvision.transforms as transforms | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import torch.optim as optim | |
transform = transforms.Compose([ |
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 torch | |
import numpy as np | |
import matplotlib.pyplot as plt | |
TRUE_W = 3.0 | |
TRUE_b = 0.5 | |
NUM_EXAMPLES = 1000 | |
x = torch.empty(NUM_EXAMPLES).normal_(mean=0,std=1.0) |
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
<template> | |
<nb-container> | |
<nb-header></nb-header> | |
<nb-grid> | |
<nb-row :style="{ height: 60 }" v-for="(todo, idx) in todos" :key="idx"> | |
<nb-col :size="85" :style="{ justifyContent: 'center' }"> | |
<text :style="{marginLeft: 10}">{{todo}}</text> | |
</nb-col> | |
<nb-col :size="15" :style="{ justifyContent: 'center' }"> | |
<nb-button iconCenter transparent :on-press="() => removeItem(idx)"> |