Skip to content

Instantly share code, notes, and snippets.

@r2dev
r2dev / main.js
Created December 27, 2015 03:46
bookmark interface using reactjs, based on the quick start in react official website
var BookmarkCollection = React.createClass({
loadBookmarksFromServer: function() {
$.ajax({
url: this.props.link,
dataType: 'json',
cache: false,
success: function(data) {
this.setState({data: data.bookmarks})
}.bind(this),
error: function(xhr, status, err) {
@r2dev
r2dev / form.html
Last active January 8, 2016 12:06
Fail of the day i guess
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>form</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.5/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.5/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
@r2dev
r2dev / App.java
Created January 29, 2016 02:06
lol i dont understand 100% but almost 80%, but whatever
public class App {
private static int fieldWidth, fieldSize;
private static long[] result;
private static int[] fieldCheck, fieldCheckR;
private static int[] rotationOffset = new int[8],
rotationX = new int[8],
rotationY = new int[8];
private static int linkData[] = new int[4];
public static void main(String[] args) {
int cell = 8;
import java.util.Scanner;
class Matrix {
private static int row;
private static int[][] matrix;
private static int[][] temp;
public static void main(String[] args) {
System.out.println("Enter the number of rows in the square matrix: ");
Scanner input = new Scanner(System.in);
row = input.nextInt();
matrix = new int[row][row];
import java.util.ArrayList;
interface Perimeter<T> {
double getPerimeter(T s);
}
interface Area<T> {
double getArea(T s);
}
public class Picture implements Cloneable{
private ArrayList<Shape> sps;
const SelectProvince = ({ provinces, value, onChange }) => (
<select value={value} onChange={onChange}>
{provinces.map((pro, index) => {
return (
<option value={pro} key={index}>
{pro}
</option>
);
})}
</select>
@r2dev
r2dev / test.jsx
Created March 17, 2017 16:25
test.js
const SelectProvince = ({ provinces, value, onChange }) => (
<select value={value} onChange={onChange}>
{provinces.map((pro, index) => {
return (
<option value={pro} key={index}>
{pro}
</option>
);
})}
</select>
@r2dev
r2dev / index.html
Created December 14, 2017 22:58
vuex
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb"
crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ"
class I18n {
constructor(locale) {
this.locale = locale;
this.subscriptions = [];
this.text = window[locale]
}
setLocale(locale) {
if (this.locale !== locale) {
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta content="width=device-width,minimum-scale=1.0" name="viewport">
<title>Hello World</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>