Skip to content

Instantly share code, notes, and snippets.

Avatar

Marius Hauken mhauken

View GitHub Profile
@mhauken
mhauken / __useful_javascript-snippets.md
Last active Mar 22, 2016
Useful javascript-snippets
View __useful_javascript-snippets.md

Useful javascript-snippets:

  • fuzzy search
  • Get closest in a group
  • Reach clicked element inside functions
  • Scroll to top of element
  • Skip to content
  • Set timing in javascript
  • toggle specific class via general javascript and data-attributes
@mhauken
mhauken / __Useful.html
Last active Apr 6, 2018
Useful HTML snippets
View __Useful.html
<!--
&shy; = Soft hyphen. To break text where you want
-->
Onelongword&shy;thatwewant&shy;tobreak
@mhauken
mhauken / idiotic.md
Last active Aug 29, 2015
Idiotic things that don't work in browsers
View idiotic.md
  • You cant change ::selection in input-fields..
  • You can't have before or after-elements on input, -submit, checkboxes, radiobuttons etc.
  • you can't target elements before or parent-elements
  • you can't target a ::before-element from the parent class
@mhauken
mhauken / compact-svg.sh
Last active Aug 29, 2015
For more compact SVG-export in @sketchapp run this in Terminal:
View compact-svg.sh
defaults write com.bohemiancoding.sketch3 exportCompactSVG -bool yes
@mhauken
mhauken / findings.md
Created Jan 11, 2016
Browser testing
View findings.md

IE 11 reads the content outside of the SVG-viewbox as well.

@mhauken
mhauken / svgo.json
Last active Apr 16, 2018 — forked from bendc/svgo.json
Sketch's SVGO Compressor settings
View svgo.json
{
"comment": "A modified svgo compression-settings for SVGO-compresspor by Marius Hauken. For more info, please check <https://github.com/BohemianCoding/svgo-compressor>",
"pretty": false,
"indent": 0,
"plugins": [
{
"name": "cleanupAttrs"
},
{
"name": "cleanupEnableBackground"
@mhauken
mhauken / plot.js
Last active Feb 28, 2017
Useful snippets from React in Flipdflops
View plot.js
/**
* This component should render a plot with Plotly, taking these three props:
*
* - xData: the data to be rendered on the x-axis as an array
* - yData: The data to be rendered on the y-axis as an array
* - type: The type of plot we want Plotly to render
*
* To see an example of how you should use Plotly look at the index.html file in the public/ folder.
* (and feel free to delete the code in there)
*/
View .bash_profile
# When you open a new Terminal session, this file is loaded by Bash.
# It loads in the other dotfiles path,bash_prompt,exports,aliases,functions,extra
# and configures some useful settings such as auto correcting typos when using cd completion.
# In some instances .bashrc can be loaded, so this file makes sure that .bash_profile is called.
# Add `~/bin` to the `$PATH`
export PATH="$HOME/bin:$PATH"
# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
View arrow.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mhauken
mhauken / modulo.jsx
Last active Nov 21, 2019
Modulus example
View modulo.jsx
import React from "react"
import styled from "styled-components"
const anArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
const colorArray = ["#D8CFAC", "#F8F2D3", "#FFAB00", "#62796C", "#DAE0DC"]
const ModulusExample = () => (
<Wrapper>
{anArray.map((item, index) => (
You can’t perform that action at this time.