Skip to content

Instantly share code, notes, and snippets.

View gideonheilbron's full-sized avatar

Gideon Heilbron gideonheilbron

View GitHub Profile
@mmousawy
mmousawy / encode-svg-uri.scss
Created February 28, 2019 13:24
Encode SVG URI and inline SCSS
@function encode-uri($uri) {
$enc: str-replace($uri, '"', "'");
$enc: str-replace($enc, '<', '%3C');
$enc: str-replace($enc, '>', '%3E');
$enc: str-replace($enc, '&', '%26');
$enc: str-replace($enc, '#', '%23');
@return $enc;
}
@maxpou
maxpou / _pagination.html.twig
Last active February 26, 2023 20:28
Example of pagination with Twig
{#
Parameters:
* nbPages (int): number of pages
* currentPage (int): current pages
* url (string): route name & query (string): route parameter
ex: list/page-5?q=myFilter (5 = page and query = myFilter)
#}
{% spaceless %}
{% if nbPages > 1 %}
@wesbos
wesbos / tab-trigger.js
Created November 16, 2015 19:33
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@pierre-b
pierre-b / updateUrlParameter.js
Last active June 13, 2016 14:35
Update or remove a parameter in a URL
// update a parameter in a URL
// or removes it if value is null
// browser should support forEach() function or use a polyfill
var updateUrlParameter = function(url, key, value){
var parser = document.createElement('a');
parser.href = url;
var newUrl = parser.protocol+'//'+parser.host+parser.pathname;
@lamchau
lamchau / ember-component-fadeout.js
Created August 17, 2015 19:53
`fadeIn` and `fadeOut` for Ember Component (ES6; ember-cli)
export default Ember.Component.extend({
fadeDurationInMilliseconds: 300,
didInsertElement() {
let duration = this.get("fadeDurationInMilliseconds"),
element = this.$();
element.fadeIn(duration);
},
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 31, 2024 06:33
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@bugsysop
bugsysop / page-selected-cats.php
Created May 25, 2013 22:56
Anchor CMS. Display only selected categories on a page. Code to add in the custom page template.
<?php
// allowCat contains all catergory ID that you want on your page
$allowCat = array(2,3,4,5,6);
function article_category_id() {
if($category = Registry::prop('article', 'category')) {
$categories = Registry::get('all_categories');
return $categories[$category]->id;
}
@daviddarnes
daviddarnes / Anchor Custom Background Image Field
Last active October 22, 2020 17:30
Custom Image field for Anchor CMS themes.
<div class="bg-header"
<?php
/*
This is to show a custom field from an article.
It will need to be created in the metadata section before it can be used in the post edit area.
In this case the custom field will need to be called 'image' and be set as an image custom field in the dropdown for type.
*/
$image = article_custom_field('image'); // Applying a variable to the custom field, so it can be reused with ease
if ( !empty($image) ) : // Check if the field is empty, if it is the process stops here
?>
@koenpunt
koenpunt / gist:3994501
Created November 1, 2012 15:51
iOS Media Queries
<!-- IPAD 3 -->
<link rel="stylesheet" href="/stylesheets/ipad3.css" type="text/css"
media="only screen and (min-device-width:768px) and (max-device-width:1024px) and (-webkit-min-device-pixel-ratio:1.5)" />
<!-- IPAD 2 -->
<link rel="stylesheet" href="/stylesheets/ipad2.css" type="text/css"
media="only screen and (min-device-width:768px) and (max-device-width:1024px) and (-webkit-max-device-pixel-ratio:1.5)" />
<!-- IPAD -->
<link rel="stylesheet" href="/stylesheets/ipad.css" type="text/css"
media="only screen and (min-device-width:768px) and (max-device-width:1024px)" />
<!-- IPHONE 4 -->
@mwbrooks
mwbrooks / style.css
Created February 23, 2011 18:50
Remove Tap Highlight from Mobile Webkit
* {
-webkit-touch-callout:none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust:none; /* prevent webkit from resizing text to fit */
-webkit-tap-highlight-color:rgba(0,0,0,0); /* prevent tap highlight color / shadow */
-webkit-user-select:none; /* prevent copy paste, to allow, change 'none' to 'text' */
}