Skip to content

Instantly share code, notes, and snippets.

View Chalarangelo's full-sized avatar
💻
JavaScripting

Angelos Chalaris Chalarangelo

💻
JavaScripting
View GitHub Profile
// React and other imports...
import { connect } from 'react-redux';
import { viewAll, searchPost } from './actions';
class App extends Component {
// Code for our App component...
}
// Mapping state to props
function mapStateToProps(state){
const posts = (state = [], action) => {
let posts = [];
switch(action.type){
case VIEW_ALL:
// TODO: Return all posts
return posts;
case SEARCH_POST:
// TODO: Return posts matched in search
return posts;
default:
// Best practice dictates specifying constants
// for the different types of actions in an application
export const SEARCH_POST = 'SEARCH_POST';
// This is an action creator
export const searchPost = (query) => {
// The returned object is an action
return {
// 'type' is a required field for an action,
// specifying the type of action being performed
import React, { Component } from 'react';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<header className="sticky">
<label htmlFor="drawer-checkbox" className="button drawer-toggle hidden-desktop"></label>
<span href="#" className="logo">Autumn Blog</span>
import requests
import time
from selenium import webdriver
from PIL import Image
from io import BytesIO
url = "https://unsplash.com"
driver = webdriver.Firefox(executable_path=r'geckodriver.exe')
driver.get(url)
import time
from selenium import webdriver
url = "https://unsplash.com"
driver = webdriver.Firefox(executable_path=r'geckodriver.exe')
driver.get(url)
driver.execute_script("window.scrollTo(0,1000);")
time.sleep(5)
import time
from selenium import webdriver
url = "https://unsplash.com"
driver = webdriver.Firefox(executable_path=r'geckodriver.exe')
driver.get(url)
# Scroll page and wait 5 seconds
driver.execute_script("window.scrollTo(0,1000);")
time.sleep(5)
from selenium import webdriver
# The URL we want to browse to
url = "https://unsplash.com"
# Using Selenium's webdriver to open the page
driver = webdriver.Firefox(executable_path=r'geckodriver.exe')
driver.get(url)
// An array of articles with their tags.
var articles = [
{title: "Introduction to Javascript Scope", tags: [ "Javascript", "Variables", "Scope"]},
{title: "Javascript Closures", tags: [ "Javascript", "Variables", "Closures"]},
{title: "A Guide to PWAs", tags: [ "Javascript", "PWA"]},
{title: "Javascript Functional Programming Examples", tags: [ "Javascript", "Functional", "Function"]},
{title: "Why Javascript Closures are Important", tags: [ "Javascript", "Variables", "Closures"]},
];
// A function that reduces the above array to an
// Arrays of expenses.
var oldExpenses = [
{ company: "BigCompany Co.", value: 1200.10},
{ company: "Pineapple Inc.", value: 3107.02},
{ company: "Office Supplies Inc.", value: 266.97}
];
var newExpenses = [
{ company: "Office Supplies Inc.", value: 108.11},
{ company: "Megasoft Co.", value: 1208.99}
];