Skip to content

Instantly share code, notes, and snippets.

@Shoora
Shoora / new.js
Last active February 28, 2019 03:50 — forked from tomfuertes/new.js
GA Helper Functions
//Helper Functions
(function(window, document, undefined) {
window.gaGetParameterByName = function(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
};
window.gaGetElementsByClassName = function(e) {
var tags = this.all || this.getElementsByTagName('*');
@Shoora
Shoora / Bookmarklets.js
Last active April 23, 2023 03:56 — forked from heavensrevenge/gist:712735
Bookmarklets
javascript:function tinycc_bookmarklet(){var script=document.createElement('script');script.src='http://tiny.cc/public/javascript/bookmarklet.js';scriptObj=document.body.appendChild(script);}tinycc_bookmarklet();
javascript:void(window.open('http://3.ly/?bm=1&u='+encodeURIComponent(location.href)))
javascript:(function(){var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://identi.ca//index.php?action=bookmarklet',l=d.location,e=encodeURIComponent,g=f+'&status_textarea=%E2%80%9C'+((e(s))?e(s):e(document.title))+'%E2%80%9D%20%E2%80%94%20'+e(l.href);function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=450,height=200')){l.href=g;}}a();})()
javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){location.
@Shoora
Shoora / bookmarklet.js
Created May 17, 2016 00:56 — forked from fiatjaf/bookmarklet.js
the bookmarklet bookmarklet
function getJSON (url, callback) {
var xhr;
xhr = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (callback) {
callback(xhr.responseText);
}
}
};
@Shoora
Shoora / example.html
Last active February 28, 2019 03:37 — forked from mrzlodey/example.html
load font localStorage
<head>
...
<script>
(function(){
function addFont() {
var style = document.createElement('style');
style.rel = 'stylesheet';
document.head.appendChild(style);
style.textContent = localStorage.sourceSansPro;
}
@Shoora
Shoora / Shortcode
Created June 30, 2017 23:34 — forked from Sumonchandrashil/Shortcode
Shortcode
<?php
shortcode tutorial
https://www.smashingmagazine.com/2012/05/wordpress-shortcodes-complete-guide/
http://speckyboy.com/2011/07/18/getting-started-with-wordpress-shortcodes-examples/
//output code for html
<?php echo do_shortcode('[custom]') ;?>
//remove auto break <br /> from shortcode
@Shoora
Shoora / GoogleSpreadsheet.html
Created January 26, 2018 11:40 — forked from terrywbrady/GoogleSpreadsheet.html
Sample HTML/JS to parse a Google Spreadsheet
<!doctype html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var spData = null;
function doData(json) {
spData = json.feed.entry;
}
@Shoora
Shoora / parser.php
Created January 26, 2018 11:48 — forked from martinsik/parser.php
Simple sport results parser in PHP using XPath. For more information visit http://martinsikora.com/parsing-html-pages-using-xpath
<?php
$curl = curl_init('http://www.livescore.com/soccer/england/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10');
$html = curl_exec($curl);
curl_close($curl);
if (!$html) {
<div class="col6">
<div class="group">[text* full-name placeholder "*Insert Full Name"]</div>
<div class="group">[email* the-email placeholder "*Insert Email"]</div>
</div>
<div class="col6">
<div class="group">[textarea* the-message placeholder "*Write your message here"]</div>
</div>
<div class="col12">
@Shoora
Shoora / .htaccess
Created June 8, 2018 18:28 — forked from ludo237/.htaccess
The ultimate .htaccess file. Please feel free to fork it, edit it and let me know what do you think about it.
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
# This is the free sample of .htaccess from 6GO s.r.l.
# @author Claudio Ludovico Panetta (@Ludo237)
@Shoora
Shoora / idna_convert.class.php
Created June 17, 2018 11:53 — forked from AgelxNash/idna_convert.class.php
Encode/decode Internationalized Domain Names
<?php
// {{{ license
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
//
// +----------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU Lesser General Public License as |
// | published by the Free Software Foundation; either version 2.1 of the |
// | License, or (at your option) any later version. |