Skip to content

Instantly share code, notes, and snippets.

Avatar

Christoph Werner codepunkt

View GitHub Profile
@codepunkt
codepunkt / index.js
Created Mar 12, 2020
adblock banner delete - work in progress
View index.js
document.querySelectorAll('*').forEach(el => {
const cs = getComputedStyle(el)
//const zIndex = +cs.zIndex
//const aboveThreshold = zIndex > 100000
if (cs.position === 'fixed') {
console.log(el)
el.style.cssText += ';position:static !important;'
}
if (cs.overflow === 'hidden') {
el.style.cssText += ';overflow:auto !important;'
@codepunkt
codepunkt / SomeProject.csproj
Created Sep 22, 2017
Zip file in msbuild build event
View SomeProject.csproj
<Target Name="Build">
<ZipDir
ZipFileName="MyZipFileName.zip"
DirectoryName="MyDirectory"
/>
</Target>
<UsingTask TaskName="ZipDir" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<ZipFileName ParameterType="System.String" Required="true" />
@codepunkt
codepunkt / .hyper.js
Last active Jul 17, 2017
hyper config (windows)
View .hyper.js
module.exports = {
config: {
fontSize: 14,
fontFamily:
'"Fira Code", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
cursorColor: 'rgba(255,255,255,0.8)',
cursorShape: 'BEAM',
foregroundColor: '#fff',
backgroundColor: '#000',
borderColor: '#666',
@codepunkt
codepunkt / config.json
Last active Sep 24, 2020
Host react app built with webpack in non-root directory
View config.json
{
"basePath": "/"
}
@codepunkt
codepunkt / react-motion-preset-keyframes.styl
Last active Jan 21, 2017
react-motion preset keyframe generator in stylus
View react-motion-preset-keyframes.styl
sqrt(x)
if x == 0
result = 0
else
result = 4
for i in (0..10)
result = ((result + (x / result)) / 2)
spring-noWobble(t)
return 2.71828 ** (-13 * t) * (2.71828 ** (13 * t) - 13 * sin(t) - cos(t))
@codepunkt
codepunkt / kill_port.sh
Last active Jun 7, 2016
Kill process running on a port
View kill_port.sh
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
if [ $# -eq 0 ] ; then
echo -e "${RED}Error: No port given${NC}"
exit 1
fi
View temp.js
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
function findMatchingRoutes(routes, urlPath, ancestors) {
var result = [];
ancestors = ancestors || [];
routes.forEach(function (route) {
@codepunkt
codepunkt / index.js
Last active Aug 29, 2015
Async form validation in ampersand
View index.js
// Example of async form validation in ampersand
// Has default `ampersand-input-view` clientside validation.
// If clientside validation passes, async validation is called 1 sec after input to check if given username exists
var FormView = require('ampersand-form-view');
var InputView = require('ampersand-input-view');
var debounce = require('amp-debounce');
var extend = require('amp-extend');
@codepunkt
codepunkt / _px-to-rem.scss
Last active Aug 29, 2015
px to rem mixin
View _px-to-rem.scss
@function px-to-rem($val, $base: 16) {
// if it's a unitless number
@if type-of($val) == number and unitless($val) {
// don't convert 0
@if $val == 0 {
@return 0;
}
// assume its px and convert it to rem based on $base document font-size
@return #{$val / $base}rem;
}
View osx-for-hackers.sh
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
You can’t perform that action at this time.