Skip to content

Instantly share code, notes, and snippets.

@mottet-dev
mottet-dev / client-side.html
Last active September 18, 2023 20:05
Example of HTML structure for client-side rendered pages
<html>
<head>
<script src="https://fakescripturl.com/index.js" type="text/javascript"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
@mottet-dev
mottet-dev / main.go
Created June 10, 2019 16:27
ForEach (Name) - Go Colly
package main
import (
"fmt"
"github.com/gocolly/colly"
)
func main() {
c := colly.NewCollector()
@mottet-dev
mottet-dev / main.go
Created June 20, 2019 20:09
Go Funk - Map - Type assertion
package main
import (
"fmt"
"github.com/thoas/go-funk"
)
func main() {
baseSlice := []int{1, 2, 3, 4, 5}
newSlice := funk.Map(baseSlice, func(x int) int {
@mottet-dev
mottet-dev / main.py
Created September 11, 2018 21:10
InstagramBot - Full
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
class InstagramBot():
def __init__(self, email, password):
self.browserProfile = webdriver.ChromeOptions()
self.browserProfile.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
self.browser = webdriver.Chrome('chromedriver.exe', chrome_options=self.browserProfile)
self.email = email
@mottet-dev
mottet-dev / main.py
Created February 6, 2019 21:23
Real Time Scraper - final version
import requests
from bs4 import BeautifulSoup
from urllib import parse
from flask import Flask
from flask_restful import Resource, Api, reqparse
app = Flask(__name__)
api = Api(app)
{
name: "Compare slices with different number of elements",
args: args{
a: []int{1, 2, 3, 4},
b: []int{2, 4, 1},
},
want: false,
},
{
name: "Compare slices with same number of elements but different elements",
args: args{
a: []int{1, 2, 3, 4},
b: []int{5, 2, 4, 1},
},
want: false,
},
@mottet-dev
mottet-dev / slices_test.go
Created July 10, 2019 20:50
Go Test - TestAreSlicesEqual
func TestAreSlicesEqual(t *testing.T) {
type args struct {
a []int
b []int
}
tests := []struct {
name string
args args
want bool
}{
@mottet-dev
mottet-dev / slices_test.go
Created July 10, 2019 20:45
Go Test - TestAreSlicesEqual
func TestAreSlicesEqual(t *testing.T) {
type args struct {
a []int
b []int
}
tests := []struct {
name string
args args
want bool
}{
@mottet-dev
mottet-dev / slices.go
Created July 10, 2019 20:32
Go test - AreSlicesEqual
func AreSlicesEqual(a, b []int) bool {
if len(a) != len(b) {
return false
}
for _, i := range a {
if !DoesSliceIncludesInt(i, b) {
return false
}
}