View main.rs
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
use std::sync::mpsc::channel; | |
use chrono::{DateTime, Local}; | |
use threadpool::ThreadPool; | |
#[derive(Debug)] | |
struct Site { | |
id: String, | |
url: String, | |
changed: Option<bool>, |
View main.rs
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
use std::env; | |
use std::fs::File; | |
use serde::{Deserialize, Serialize}; | |
#[derive(Serialize, Deserialize, Debug)] | |
struct Site { | |
id: String, | |
#[serde(skip_serializing_if = "Option::is_none")] | |
status_changed: Option<bool>, | |
#[serde(skip_serializing_if = "Option::is_none")] |
View router.js
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, {Component, createElement} from 'react' | |
import createHistory from 'history/createBrowserHistory' | |
import classnames from "classnames" | |
export const history = createHistory() | |
/** | |
* Determines if route path matches history location's pathname. If it does, extracts its params. If not, returns null. | |
* | |
* @param routePath |
View withForm-1.js
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 from "react" | |
const noop = () => false | |
const withForm = (fields, validateFn = noop, validSubmitFn) => WrappedComponent => { | |
class WithForm extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { |
View index.js
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, {Component} from 'react' | |
import ReactDOM from 'react-dom' | |
import App from './App' | |
import createContext from 'create-react-context' | |
const Theme = createContext("light") | |
const Language = createContext("en") | |
const Whatever = createContext("whatever") |
View client.go
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
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"time" | |
) |
View middleware.go
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 ( | |
"context" | |
"net/http" | |
"github.com/Sirupsen/logrus" | |
"github.com/matryer/respond" | |
) | |
func CheckJSON(log *logrus.Logger, h http.Handler, data interface{}, contextKey string) http.HandlerFunc { | |
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
View WP_Settings.php
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
<?php | |
class WP_Settings_Section { | |
protected $id = ''; | |
protected $title = ''; | |
protected $output_callback = ''; | |
protected $fields = array(); | |
public function __construct($id, $title, $output_callback) { | |
$this->id = $id; |
View unsbscribe.js
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, {Component} from 'react' | |
import forEach from 'lodash/forEach' | |
export default () => ComposedComponent => class extends Component { | |
subscriptions = {} | |
componentWillUnmount() { | |
forEach(this.subscriptions, subscription => { | |
subscription.unsubscribe() | |
}) | |
} |
View App.js
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, { Component } from 'react' | |
import Modal from './Modal' | |
export default class extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
isOpen: false |
NewerOlder