Skip to content

Instantly share code, notes, and snippets.

View fALKENdk's full-sized avatar
🦄

Kasper Christensen fALKENdk

🦄
View GitHub Profile
@stevewithington
stevewithington / auto-increment-npm
Created March 30, 2021 22:43 — forked from LukePammant/auto-increment-npm
Auto-increment NPM package in Azure Pipelines and publish to Azure Artifacts
trigger:
branches:
include:
- develop
- master
paths:
include:
- ./
resources:
from bs4 import BeautifulSoup
import requests
page_link ='https://www.website_to_crawl.com'
# fetch the content from url
page_response = requests.get(page_link, timeout=5)
# parse html
page_content = BeautifulSoup(page_response.content, "html.parser")
# extract all html elements where price is stored
prices = page_content.find_all(class_='main_price')
@davidwalter0
davidwalter0 / stash-pop-recover
Created August 10, 2017 17:42
Undoing accidental git stash pop
# https://stackoverflow.com/questions/6543519/undoing-accidental-git-stash-pop
# https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git
accepted
If you have only just popped it and the terminal is still open, you will still have the hash value printed by git stash pop on screen (thanks, Dolda).
Otherwise, you can find it using this for Linux and Unix:
git fsck --no-reflog | awk '/dangling commit/ {print $3}'
and for Windows:
@henrik
henrik / danish_organization_number.rb
Last active May 15, 2020 07:26
Validate Danish organization numbers (CVR). Uses https://github.com/barsoom/attr_extras.
# Danish "CVR-nummer".
#
# A 7 digit serial number followed by a mod-11 check digit:
# https://erhvervsstyrelsen.dk/modulus-11-kontrol
#
# Search for real CVRs, to see examples: https://datacvr.virk.dk/data/
# E.g. 35408002, 30715063.
class DanishOrganizationNumber
MOD_11_WEIGHTS = [ 2, 7, 6, 5, 4, 3, 2 ]
@tobi-pb
tobi-pb / migrate.sh
Last active March 3, 2023 23:34
Upgrade MAMP to Mysql 5.6
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-osx10.9-x86_64.tar.gz
tar xfvz mysql-5.6*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
@pburtchaell
pburtchaell / styles.css
Last active February 25, 2024 12:24
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@ihorvorotnov
ihorvorotnov / get-social-shares
Last active October 20, 2020 12:15
Get number of shares from social platforms
Facebook*:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
+ works, returns shares, likes, comments and total
Twitter:
http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
+ v1 API but still works
Reddit:
http://buttons.reddit.com/button_info.json?url=%%URL%%
@jjmu15
jjmu15 / in_viewport.js
Created January 27, 2014 10:19
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@mhberger
mhberger / checkpoint.sh
Last active December 27, 2015 16:09 — forked from bubenkoff/checkpoint.sh
#!/bin/bash
#
# The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext
# which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just
# from time to time
# Usage: checkpoint.sh load|unload
# You will need sudo power, of course
#
COMMAND=$1
@woodworker
woodworker / jekyll.ics
Created September 27, 2013 08:39
a jekyll template for icalendar file
---
layout: none
---
BEGIN:VCALENDAR
VERSION:2.0
PRODID:http://www.example.com/
METHOD:PUBLISH
{% for post in site.posts limit:10 %}BEGIN:VEVENT
UID:{{ post.date | date: "%Y%m%d" }}@example.com
ORGANIZER;CN="Organizer Name":MAILTO:organizer@example.org