Skip to content

Instantly share code, notes, and snippets.

View jdahdah's full-sized avatar

Jerome Dahdah jdahdah

View GitHub Profile
@vortizhe
vortizhe / config.rb
Last active October 26, 2017 13:40
Middleman inline svg helper
helpers do
def inline_svg name
root = Middleman::Application.root
file_path = "#{root}/source/assets/images/svg/#{name}.svg"
if File.exists?(file_path)
File.read(file_path)
else
"<span class='icon-error'>Icon #{name} not found</span>"
end
end
@AamuLumi
AamuLumi / code.jsx
Created October 26, 2018 09:53
React Hook to create an internal API Reducer
import React, { Component } from "react";
import { useEffect, useState } from "react";
function createLoadReducer() {
return (state = { loading: false }, action) => {
switch (action.type) {
case "LOADING":
return { loading: true };
case "ERROR":
return { loading: false, error: action.data };
@haydenbleasel
haydenbleasel / transfade.js
Last active July 14, 2019 10:23
Medium-style vertical fading parallax scroll modifier for Stellar.js
// Custom transform and opacity modifier for Stellar.js
$.stellar.positionProperty.transfade = {
setPosition: function(element, newLeft, originalLeft, newTop, originalTop) {
var distance = newTop - originalTop;
var rate = $(window).height() / 5;
element.css('transform', 'translate3d(0, ' + distance + 'px, 0').css('opacity', 1 - (distance / rate));
}
};
#!/bin/sh
#aktualisiert DNS-Einträge bei HostEurope
#XXX durch eigene Zugangsdaten ersetzen
#HostEurope-Zugangsdaten
KUNDENNR=xxx
PASSWORD=xxx
DOMAIN=xxx
#Host-ID des eigentlichen Eintrages
HOSTID=xxx
@nathansmith
nathansmith / config.rb
Created August 29, 2011 21:00
Example config.rb file for Compass
preferred_syntax = :sass
http_path = '/'
css_dir = 'assets/stylesheets'
sass_dir = 'assets/sass'
images_dir = 'assets/images'
javascripts_dir = 'assets/javascripts'
relative_assets = true
line_comments = true
# output_style = :compressed
@erikzrekz
erikzrekz / zendesk-hc-template-and-components-doc.md
Last active April 26, 2022 17:08
Zendesk Help Center Template and Components Documenation

The help center has a series of HTML templates with accompanying components. I put this together to brief myself on the available features within a help center. The official documentation can be found here

Table of Contents

  • Header
  • Footer
  • Home
  • Category
  • Section
  • Article
  • Contribution
@threepointone
threepointone / for-snook.md
Last active August 26, 2023 15:43
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

@marcedwards
marcedwards / high-dpi-media.css
Last active November 19, 2023 12:56
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@hubgit
hubgit / SelectField.tsx
Last active December 29, 2023 03:41
Use react-select with Formik
import { FieldProps } from 'formik'
import React from 'react'
import Select, { Option, ReactSelectProps } from 'react-select'
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({
options,
field,
form,
}) => (
<Select
@DavidWells
DavidWells / netlify.toml
Last active February 7, 2024 08:50
All Netlify.toml & yml values
[Settings]
ID = "Your_Site_ID"
# Settings in the [build] context are global and are applied to all contexts unless otherwise overridden by more specific contexts.
[build]
# This is the directory to change to before starting a build.
base = "project/"
# NOTE: This is where we will look for package.json/.nvmrc/etc, not root.
# This is the directory that you are publishing from (relative to root of your repo)