Skip to content

Instantly share code, notes, and snippets.

View maximelebreton's full-sized avatar

Maxime Le Breton maximelebreton

View GitHub Profile
@fabianmichael
fabianmichael / assets_css_editor.css
Created June 28, 2018 09:38
Simple Inline Editor for Kirby
input[type="text"],
textarea {
-webkit-appearance: none;
border: 0;
border-radius: 0;
font: inherit;
line-height: inherit;
resize: none;
width: 100%;
padding: 0;
@bastianallgeier
bastianallgeier / graphql.js
Created April 26, 2017 09:01
GraphQL micro client
// Client
const query = (query, data, headers) => {
return fetch('/api', {
method: 'POST',
headers: headers || {},
body: JSON.stringify({
query: query,
variables: data
})
}).then((response) => {
@neveldo
neveldo / Logger.gs
Last active November 5, 2020 18:25
Google Apps Script : send server logs to the browser console
/**
* Set of function that allow log messages to be retrieved from the view in order to be displayed
* into the regular JS console
*/
/**
* Push one or several objects into the log stack
* @param obj1 ... objN A list of JavaScript objects to log.
*/
function log() {
@BenMorel
BenMorel / viewport-units-ios.scss
Last active March 11, 2022 13:15
SCSS mixin to support vh and vw units on all iOS Safari versions. Based on an idea by Patrick Burtchaell's: https://gist.github.com/pburtchaell/e702f441ba9b3f76f587
/**
* Fix for vw, vh, vmin, vmax on iOS 7.
* http://caniuse.com/#feat=viewport-units
*
* This fix works by replacing viewport units with px values on known screen sizes.
*
* iPhone 6 and 6 Plus cannot run iOS 7, so are not targeted by this fix.
* Target devices running iOS 8+ will incidentally execute the media query,
* but this will still produce the expected result; so this is not a problem.
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@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/
*/
@lukas-shawford
lukas-shawford / autoGrowInput.js
Created January 19, 2014 22:22
Auto Expanding/Grow input directive for AngularJS This is the single-line <input> analogue of this gist: https://gist.github.com/thomseddon/4703968 Original jQuery implementation here: http://jsbin.com/ahaxe
/*
* Auto-expanding textbox directive for single-line <input> controls.
*
* This is adapted from: https://gist.github.com/thomseddon/4703968
*
* See the above link for auto-growing multiline <textarea> controls, a similar but slightly
* different objective.
*
* The original, pure jQuery (and non-AngularJS) version of this can be found here:
* http://jsbin.com/ahaxe
@btm1
btm1 / set-if
Created October 2, 2013 23:51
set-if will conditionally show or hide elements in the DOM once and will not apply a $watch listener. An additional attribute (wait-for) can be applied to the element to wait for data to be populated before evaluating the if statement i.e. <div set-if="should.behere" wait-for="should"></div>
angular.module('setIf',[]).directive('setIf',function () {
return {
transclude: 'element',
priority: 1000,
terminal: true,
restrict: 'A',
compile: function (element, attr, linker) {
return function (scope, iterStartElement, attr) {
if(attr.waitFor) {
var wait = scope.$watch(attr.waitFor,function(nv,ov){
@btm1
btm1 / set-repeat.js
Created September 28, 2013 20:17
Set repeat is an AngularJS directive to iterate over a group of elements only one time and not add any watch listeners. It works the same way as ng-repeat and uses angular templating engine to render it's results. i.e. set-repeat="message in messages" where messages is an array of objects. This iteration will not update if the length of the arra…
angular.module('setRepeat',[]).directive('setRepeat', function () {
return {
transclude: 'element',
priority: 1000,
compile: compileFun
};
function compileFun(element, attrs, linker) {
var expression = attrs.setRepeat.split(' in ');
@ebidel
ebidel / Web Components Resources.md
Last active February 27, 2023 22:04
List of resources related to Web Components