Skip to content

Instantly share code, notes, and snippets.

View zecar's full-sized avatar
😬

John zecar

😬
View GitHub Profile
@andrewagain
andrewagain / snippet.js
Last active March 28, 2023 13:18
Google Analytics Snippet Unminified
// Source
// https://developers.google.com/analytics/devguides/collection/analyticsjs/
// Original
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
// Unminified
@keon
keon / pagination.js
Last active March 24, 2021 06:16
javascript pagination algorithm
var pagenation = function(current, total){
var list = [];
var pageLimit = 5;
var upperLimit, lowerLimit;
var currentPage = lowerLimit = upperLimit = Math.min(current, total);
for (var b = 1; b < pageLimit && b < total;) {
if (lowerLimit > 1 ) {
lowerLimit--; b++;
}
@AmyStephen
AmyStephen / ProcessInput.php
Created July 11, 2013 00:23
System Plugin - onBeforeCompileHead - you can walk through any assets for the head. Where the head is rendered https://github.com/joomla/joomla-cms/blob/9c576378b4809a245f6fcf18bdbbd00baa4f7ac2/libraries/joomla/document/html/renderer/head.php
<?php
public function onBeforeCompileHead()
{
$head = JFactory::getDocument()->getHeadData();
$styleSheets = $head['styleSheets'];
$newStyleSheets = array();
foreach ($styleSheets as $key => $value)
{
@ryanmcgrath
ryanmcgrath / JapaneseRegex.js
Created May 20, 2011 02:32 — forked from sym3tri/JapaneseRegex.js
Regex to test for presence of Japanese characters
// REFERENCE UNICODE TABLES:
// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml
// http://www.tamasoft.co.jp/en/general-info/unicode.html
//
// TEST EDITOR:
// http://www.gethifi.com/tools/regex
//
// UNICODE RANGE : DESCRIPTION
//
// 3000-303F : punctuation