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 deno_core::v8::{self}; | |
use deno_core::{JsRuntime, RuntimeOptions}; | |
fn main() { | |
let script1 = std::fs::read_to_string("script1.js").unwrap(); | |
let script2 = std::fs::read_to_string("script2.js").unwrap(); | |
let mut runtime = JsRuntime::new(RuntimeOptions::default()); | |
let _ = runtime.execute_script("script1", script1.into()).unwrap(); |
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>, |
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")] |
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 |
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 = { |
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") |
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" | |
) |
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) { |
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; |
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() | |
}) | |
} |
NewerOlder