This file contains hidden or 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'; | |
import {connect} from 'react-redux'; | |
import { | |
SearchBlock | |
} from "./search-form.styled"; | |
import { makeSearch } from "./search-form.actions"; | |
const SearchForm = (props) => { |
This file contains hidden or 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 * as productActions from '../../state/search-results/search-results.actions'; | |
export function makeSearch(keyword) { | |
// by using redux-thunk middleware | |
// async redux action can be handled | |
return function (dispatch, getState) { | |
// get the promise | |
const promise = fetch("http://api.url/"); |
This file contains hidden or 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::fs::OpenOptions; | |
fn main() { | |
// read the command line arguments | |
// and skip the first one, which | |
// is the command itself | |
for arg in std::env::args().skip(1) { | |
// get the filename from arg |
This file contains hidden or 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'; | |
import {connect} from 'react-redux'; | |
import { Container } from "./{component-name}.styled"; | |
import * as actions from "./{component-name}.actions"; | |
type Props = {}; | |
const ComponentName = (props: Props) => { | |
return <Container /> | |
}; |
This file contains hidden or 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
extern crate handlebars; | |
#[macro_use] | |
extern crate serde_json; | |
use handlebars::Handlebars; | |
use std::path::Path; | |
use std::error::Error; | |
use std::fs::OpenOptions; | |
use std::io::prelude::*; |
This file contains hidden or 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
fn component_name_to_dashed(name: &String) -> String { | |
println!("{}",name); | |
let dashed = name.clone(); | |
dashed | |
} | |
#[test] | |
fn component_name_to_dashed_works(){ | |
let camel: String = "ComponentName".to_string(); | |
let expected = "component-name".to_string(); |
This file contains hidden or 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
fn component_name_to_dashed(name: &String) -> String { | |
let mut dashed:String = String::new(); | |
let camel_catcher: Regex = Regex::new(r"([A-Z][a-z]*)").unwrap(); | |
let words: Vec<&str> = camel_catcher.find_iter(name) | |
.map(|match_| match_.as_str()) | |
.collect(); |
This file contains hidden or 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
fn uncapitalize_first_from_string(name: &String) -> String { | |
let mut result = String::new(); | |
let _name_len = name.len(); | |
for (i, c) in name.chars().enumerate() { | |
match i == 0 { | |
true => { | |
let mut lower = c.to_lowercase(); | |
result.push(lower.next().unwrap()) | |
}, | |
false => result.push(c) |
This file contains hidden or 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
(defn stream-bytes | |
"Input stream to bytes. i.e. (-> file io/input-stream stream-bytes)" | |
[is] | |
(let [baos (java.io.ByteArrayOutputStream.)] | |
(io/copy is baos) | |
(.toByteArray baos))) |
This file contains hidden or 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
(ns project.auth0 | |
(:require [re-frame.core :as rf] | |
[ajax.core :as ajax] | |
["@auth0/auth0-spa-js" :as spa] | |
[reitit.frontend.easy :as rfe] | |
[clojure.string :as str]) | |
(:import [goog.history Html5History])) | |
(defonce client |
OlderNewer