Skip to content

Instantly share code, notes, and snippets.

View zacbrac's full-sized avatar

Zac Brachmanis zacbrac

View GitHub Profile
@zacbrac
zacbrac / scraper.py
Last active December 12, 2018 23:25
Web Scraping with Python
from bs4 import BeautifulSoup
import urllib3
http = urllib3.PoolManager()
r = http.request('GET', 'https://www.wsj.com/news/technology')
soup = BeautifulSoup(r.data, 'html.parser')
for element in soup.select('h3.wsj-headline'):
print(element.get_text().encode('utf-8').strip())
@zacbrac
zacbrac / DBInteraction.php
Last active December 15, 2015 23:45
DBInteraction
<?php
/*
* DBInteraction
*/
class DBInteraction
{
public function getReturnVisitByUserId($user_id, $db) {
@zacbrac
zacbrac / distinct_factors.py
Last active October 27, 2015 17:41
Finds the distinct factors of n
def factor(n):
factors = []
for x in range(1,n):
if len(factors) > 1 and x == factors[-1][1] or len(factors) > 1 and factors[-1][0] == factors[-1][1]:
break
elif n % x == 0:
if x != (n / x):
@zacbrac
zacbrac / TableTransferrer.php
Last active September 25, 2015 22:32
TableTransferrerAllows you to transfer tables from one db to another with minimal effort.No file handling necessary, you only need the table names, and a connection from db 1 to db 2.
<?php
/*
* TableTransferrer
*
* Allows you to transfer tables from one db to another with minimal effort.
* No file handling necessary, you only need the table names, and a connection from db 1 to db 2.
*
*/
@zacbrac
zacbrac / charRecurrence.cpp
Last active September 25, 2015 22:34
Gets counts of recurring characters in given string.
#include <iostream>
#include <string>
#include <map>
std::map<char, int, std::less<char>> getRepeatedChars(std::string text) {
std::map<char, int, std::less<char>> counts;
for (int i = 0; i < 403; i++) {
@zacbrac
zacbrac / bootstrap_slider_instructions.md
Last active August 29, 2015 14:18
Instructions For Adding A Bootstrap Slider That Uses Imagemachine

INSTRUCTIONS FOR ADDING A BOOTSTRAP SLIDER THAT USES IMAGEMACHINE

OBVIOUSLY THE BOOTSTRAP JS AND CSS WILL NEED TO BE INCLUDED ON THE PAGE BEFORE EXPECTING ANY OF THIS TO WORK

add this wherever the slider is supposed to go

<div id="product-carousel" class="carousel slide" data-interval="false" data-ride="carousel">
    <div class="carousel-inner" id="innerWrapper">
        <div id="remove-me" class="item active" data-variant="&mvt:variant_option:opt_code;" data-slide-no="&mvt:global:counter;">