Skip to content

Instantly share code, notes, and snippets.

View shaddyshad's full-sized avatar
♟️
coding

ank3r shaddyshad

♟️
coding
View GitHub Profile
def solution(A):
# sort the array of unique items
sorted_a = list(sorted(set(A)))
# record the index of the last negative number or 0
neg_index = 0
for i in range(len(sorted_a)):
if sorted_a[i] <= 0 :
neg_index = i
@shaddyshad
shaddyshad / main.py
Created May 1, 2020 09:38
Extract all images from a website url
import re
import requests
from bs4 import BeautifulSoup
def extract_images(site):
""" Extract images from the url given"""
response = requests.get(site)
soup = BeautifulSoup(response.text, 'html.parser')
@shaddyshad
shaddyshad / .baberc
Created April 7, 2018 20:09
Babel configurations
{
"presets" : ["env", "react"]
}
@shaddyshad
shaddyshad / run dev
Last active April 7, 2018 20:05
The configurations of run dev
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack-dev-server --config ./webpack.config.js"
},
@shaddyshad
shaddyshad / App.js
Created April 7, 2018 16:31
App js boilerplate
import React, {Component} from 'react'
export default class HelloWorldReact extends Component{
render(){
return <p>Hello world, I just bootstrapped a react app from source. </p>
}
}
@shaddyshad
shaddyshad / index.js
Created April 7, 2018 16:21
Index.js boilerplate
import React from 'react'
import ReactDOM from 'react-dom'
//our main application
import App from './src/App'
ReactDOM.render(<App />, document.getElementById('app'));
@shaddyshad
shaddyshad / index.html
Last active April 7, 2018 20:27
index.html boilerplate
<!DOCTYPE html>
<html>
<head>
<title>React App</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width initial-scale=1.0">
<head>
<body>
<div id="app"></div>
@shaddyshad
shaddyshad / webpack config
Last active April 7, 2018 20:37
Webpack configurations
const path = require('path');
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
mode: 'development',
devServer: {