Skip to content

Instantly share code, notes, and snippets.

View alokkarma's full-sized avatar

Alok Vishwakarma alokkarma

View GitHub Profile
@mikebridge
mikebridge / withNavigation.tsx
Last active January 18, 2018 09:01
Example typescript wrapper around react-router 4 for blog entry
import * as React from "react";
import {RouteComponentProps, withRouter} from "react-router";
export interface IWithNavigationProps {
navigate: () => void;
}
export function withNavigation<P, S>(
Component: React.ComponentClass<P & IWithNavigationProps> | React.SFC<P & IWithNavigationProps>,
routeWhenClicked: string): React.ComponentClass<P> {
@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}
@ericlee996
ericlee996 / HelloYaml.java
Created September 10, 2012 00:52
Simple SnakeYAML example
public class HelloYaml {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws FileNotFoundException {
Yaml yaml = new Yaml();
System.out.println(yaml.dump(yaml.load(new FileInputStream(new File(
"hello_world.yaml")))));
Map<String, Map<String, String>> values = (Map<String, Map<String, String>>) yaml
.load(new FileInputStream(new File("hello_world.yaml")));