Skip to content

Instantly share code, notes, and snippets.

View williankeller's full-sized avatar
💻
Software engineer

Willian Keller williankeller

💻
Software engineer
View GitHub Profile
@williankeller
williankeller / dom-handler.js
Created September 26, 2017 18:12
Functions to handle DOM without jQuery
// DOM
var ge = function (el) {
return (typeof el == 'string' || typeof el == 'number') ? document.getElementById(el) : el;
};
var geByTag = function (searchTag, node) {
node = ge(node) || document;
return node.getElementsByTagName(searchTag);
};
/*
* Usage:
*
<div class="sk-double-bounce">
<div class="sk-child sk-double-bounce1"></div>
<div class="sk-child sk-double-bounce2"></div>
</div>
*
*/
.sk-double-bounce {
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
@williankeller
williankeller / amp-converter.php
Last active February 18, 2024 12:46
Convert HTML to AMP
<?php
class AMP {
private $html;
/**
* HtmlToAmp constructor.
*/
public function __construct($htmlContent) {
// SUPERSCRIPT REGISTERED TRADEMARK SYMBOL
jQuery(function ($) {
$('h1,h2,h3,p,a').contents().filter(function() {
return this.nodeType === 3;
}).replaceWith(function() {
return this.nodeValue.replace(/(@SUP\s*)(.+?)(\s*@SUP)/gi, '<sup class="custom-sup">$2</sup>');
});
});
@williankeller
williankeller / goto.js
Created October 25, 2016 12:37
GoTo global function
(function ($) {
"use strict";
var opt = {
// Area to detect click ation
onClickArea: document,
// Attribute to get the click ation
attribute: '.goto a',
// Incremental space difference to top
spaceToTop: 20,
public function addSpace($n, $string = '') {
if ($n === 0) {
return $string;
}
else {
$space = '&nbsp;';
return $space .= addSpace($n - 1);
}
}
/*
* Hide sidebar on video start manually
* @returns {undefined}
*/
function hideSidebar() {
// Variables
var $thumbVideoSection = jQuery('.thumbnails-video-section'), $shareSection = jQuery('.share-section');
$thumbVideoSection.addClass('retracted') ;
$shareSection.addClass('retracted');
# Use to open context 'subl ~/.bashrc'
MYSQL_USER="root"
MYSQL_PASS="admin"
# Restart Apache.
fapache_restart() {
sudo service apache2 restart
}
var ex = {
p: '.phtml',
h: '.html'
};
var url = {
a: '/',
b: '/signin',
c: '/signup',