Skip to content

Instantly share code, notes, and snippets.

View noblesilence's full-sized avatar
🏠
Working from home

Aye Aye Mon noblesilence

🏠
Working from home
View GitHub Profile
import React, { Component } from 'react';
import { connect } from 'react-redux';
import CounterControl from '../../components/CounterControl/CounterControl';
import CounterOutput from '../../components/CounterOutput/CounterOutput';
class Counter extends Component {
state = {
counter: 0
}
const initialState = {
counter: 0
}
const reducer = (state = initialState, action) => {
if (action.type === 'INCREMENT') {
return {
counter: state.counter + 1
}
}
import React, { Component } from "react";
import "./App.css";
import EasyTimer from "easytimer";
class App extends Component {
constructor() {
super();
this.state = { timer: null, timeValues: "" };
}
@noblesilence
noblesilence / gulpfile.js
Created May 12, 2018 03:35 — forked from atelic/gulpfile.js
Basic gulpfile for minify and concat css and javascript
/*
Before using make sure you have:
npm install --save-dev gulp gulp-minify-css gulp-concat gulp-uglify gulp-autoprefixer gulp-sass
Make sure to change the directory names in the default watch function to the CSS/SCSS/SASS directories you are using so it reloads
*/
var gulp = require('gulp'),
minifyCSS = require('gulp-minify-css'),
concat = require('gulp-concat')
React = require 'react'
PropTypes = require 'prop-types'
CreateReactClass = require 'create-react-class'
ReactCountdownClock = CreateReactClass
_seconds: 0
_radius: null
_fraction: null
_content: null
_canvas: null
import React, { Component } from 'react';
import PropTypes from 'prop-types';
class ReactCountdownClock extends Component {
constructor(props) {
super(props);
this.state = {
seconds: 0,
radius: null,
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS104: Avoid inline assignments
* DS205: Consider reworking code to avoid use of IIFEs
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const React = require("react");
var renderPage = true;
if(navigator.userAgent.indexOf('MSIE')!==-1
|| navigator.appVersion.indexOf('Trident/') > 0){
/* Microsoft Internet Explorer detected in. */
alert("Please view this in a modern browser such as Chrome or Microsoft Edge.");
renderPage = false;
}
<script>document.documentElement.className="js";var supportsCssVars=function(){var e,t=document.createElement("style");return t.innerHTML="root: { --tmp-var: bold; }",document.head.appendChild(t),e=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)")),t.parentNode.removeChild(t),e};supportsCssVars()||alert("Please view this in a modern browser such as latest version of Chrome or Microsoft Edge.");</script>
@noblesilence
noblesilence / PhotoAdapter.java
Created August 13, 2016 04:55 — forked from jirivrany/PhotoAdapter.java
Example of undo action for Android RecyclerView onSwipe.
public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.PhotoViewHolder> implements View.OnClickListener {
private ArrayList<Photo> photos;
public ArrayList<Photo> photosToRemove;
private OnItemClickListener onItemClickListener;
private Context context;
public PhotoAdapter(Context context, ArrayList<Photo> photos, Map<Integer, String> authors, int colHeigth) {