Skip to content

Instantly share code, notes, and snippets.

@yanofsky
yanofsky / LICENSE
Last active June 5, 2024 21:51
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@danharper
danharper / background.js
Last active June 25, 2024 02:13
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@manfromanotherland
manfromanotherland / formspree.html
Last active July 30, 2021 07:05
JS: Ajax send forms using the most excellent Formspree » http://formspree.io #snippet
<form id="contact-form" action="//formspree.io/your@email.com" method="post">
<input type="text" name="Name" placeholder="Name" required>
<input type="email" name="Email" placeholder="Email" required>
<textarea name="Message" cols="30" rows="6" placeholder="Message" required></textarea>
<!-- CONFIG -->
<input class="is-hidden" type="text" name="_gotcha">
<input type="hidden" name="_subject" value="Subject">
<input type="hidden" name="_cc" value="email@cc.com">
<!-- /CONFIG -->
<input class="submit" type="submit" value="Send">
@Yagisanatode
Yagisanatode / Tkinter_filedialog.py
Last active July 15, 2021 11:58
Python 3 - Open file dialog window in tkinter with filedialog
#! Python 3.4
"""
Open a file dialog window in tkinter using the filedialog method.
Tkinter has a prebuilt dialog window to access files.
This example is designed to show how you might use a file dialog askopenfilename
and use it in a program.
"""
@CurtHagenlocher
CurtHagenlocher / multipart.m
Created July 20, 2015 20:18
Using multipart/form-data with Power Query. This assumes that any files being uploaded are textual; changing this to support arbitrary binary data is possible, but wasn't interesting to me.
let
Web.MultiPartPost = (url as text, parts as record) as binary =>
let
unique = Text.NewGuid(),
boundary = "--" & unique,
crlf = "#(cr)#(lf)",
item = (name, value) =>
let
filename = Value.Metadata(value)[name]?,
contentType = Value.Metadata(value)[type]?,
@tonyromarock
tonyromarock / NBA_stats_mining.py
Last active April 27, 2018 16:13
Scrapping NBA player stats from stats.nba.com
import requests
import csv
import sys
# get me all active players
url_allPlayers = ("http://stats.nba.com/stats/commonallplayers?IsOnlyCurrentSeason"
"=0&LeagueID=00&Season=2015-16")
#request url and parse the JSON
@westc
westc / getVideoImage.js
Last active October 2, 2019 21:48
A function to grab the frame at a specific point within a video.
function getVideoImage(path, secs, callback) {
var me = this, video = document.createElement('video');
video.onloadedmetadata = function() {
if ('function' === typeof secs) {
secs = secs(this.duration);
}
this.currentTime = Math.min(Math.max(0, (secs < 0 ? this.duration : 0) + secs), this.duration);
};
video.onseeked = function(e) {
var canvas = document.createElement('canvas');
@temsool
temsool / elementor-plugins
Last active November 26, 2018 01:28
Elementor Plugins
DynamicConditions
https://wordpress.org/plugins/dynamicconditions/
----------------------
Elementor Custom Skin
https://wordpress.org/plugins/ele-custom-skin/
----------------------
Elementor Google Map Extended
https://wordpress.org/plugins/extended-google-map-for-elementor/
----------------------
Lenix Elementor Leads addon
@1RedOne
1RedOne / Example.md
Last active December 30, 2019 16:56
Extracting content from an API from a site

Extracting Content from a site's unpublished API

Imagine that youve found a site that has a perfect list of some info you need, but the site owner's don't have it in a format you can easily use! This happens a lot, but fortunatley for us, if the data can be retrieved and displayed in a web browser, we can normally request that same data directly through a web call instead!

The problem is that the API endpoints we need to hit may not always be published publically.

For instance, this webpage has a lot of good info on beer, but no great way to export it.

https://www.systembolaget.se/sok-dryck/?subcategory=%C3%96l&type=Ale%20brittisk-amerikansk%20stil&style=Imperial%2FDubbel%20IPA&fullassortment=1