Skip to content

Instantly share code, notes, and snippets.

@RatzeR
RatzeR / edit.js
Created January 2, 2021 14:32
Wordpress - Gutenberg: Get all PostTypes of your installation
export default withSelect((select, props) => {
const { attributes } = props;
const { selectedPostType } = attributes;
let postTypesArray = [];
const getPostTypes = select("core").getPostTypes();
// Gets all PostTypes and add's the name and the slug of each PostType to an array
if (getPostTypes != null) {
getPostTypes.map((type) => {
@RatzeR
RatzeR / CookieLayer.css
Created February 1, 2017 10:49
Cookie Layer
.m-cookie-layer {
box-sizing: border-box;
background: black;
color: white;
padding: 20px 40px 20px 0;
display: none;
position: fixed;
z-index: 1000;
bottom: 0;
width: 100%;
Cookie: {
setCookie: function(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
function iOSversion() {
if (/iP(hone|od|ad)/.test(navigator.platform)) {
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
}
}
var ver = iOSversion();
if (ver[0] >= 7 && ver[0] < 8) {
Scroll: {
init: function() {
App.Scroll.calcScroll();
App.Scroll.onScroll();
},
calcScroll: function() {
<ul class="tabs">
<li><a href="" data-pagenumber="1"></a></li>
<li><a href="" data-pagenumber="2"></a></li>
<li><a href="" data-pagenumber="3"></a></li>
<li><a href="" data-pagenumber="4"></a></li>
</ul>
<div data-page="1"></div>
<div data-page="2"></div>
<div data-page="3"></div>
@RatzeR
RatzeR / HTML
Last active August 29, 2015 14:13
Google Map with Marker, InfoWindow & Adress to Lat/Lng Converter
<div id="gmap" class="" data-adress="Company, Street, Zip, City" data-lat="5.2135123151" data-lng="10.2131212"></div>
<div class="_mapWindow">
<strong>Something</strong>
<p>
Text Text<br />
FoooBaaaar
</p>
</div>
var BrowserDetect =
{
init: function ()
{
this.browser = this.searchString(this.dataBrowser) || "Other";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
},
searchString: function (data)
{
$("input").each(function(){
var val = $(this).attr("placeholder");
$(this).attr("value", val);
});
$("input").on("focus", function(){
var elem = $(this).attr("value");
$(this).attr("value", "");
});
$("input").on("focusout", function(){
var val = $(this).attr("placeholder");
$(this).attr("value", val);
});