Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Extended Walker class for use with the
* Twitter Bootstrap toolkit Dropdown menus in Wordpress.
* Edited to support n-levels submenu.
* @author johnmegahan https://gist.github.com/1597994, Emanuele 'Tex' Tessore https://gist.github.com/3765640
* @license CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
*/
class BootstrapNavMenuWalker extends Walker_Nav_Menu {
<?php
/**
* @param string $domain Pass $_SERVER['SERVER_NAME'] here
* @param bool $debug
*
* @debug bool $debug
* @return string
*/
function get_domain($domain, $debug = false)
{
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="Moligaloo">
<title> Submenu example </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css">
#!/bin/bash
if [ ! $(whoami) = 'root' ]; then
echo "This script should be run as root." > /dev/stderr
exit 1
fi
spinner()
{
local pid=$!
#!/bin/bash
## Copyright (C) 2015 Cerebral Gardens http://www.cerebralgardens.com/
##
## Permission is hereby granted, free of charge, to any person obtaining a copy of this
## software and associated documentation files (the "Software"), to deal in the Software
## without restriction, including without limitation the rights to use, copy, modify,
## merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
## permit persons to whom the Software is furnished to do so, subject to the following
## conditions:
import Darwin
public func arc4random <T: IntegerLiteralConvertible> (type: T.Type) -> T {
var r: T = 0
arc4random_buf(&r, UInt(sizeof(T)))
return r
}
public extension UInt {
public static func random(lower: UInt = min, upper: UInt = max) -> UInt {
@haipham
haipham / automator_new_file.scpt
Created September 29, 2015 15:26 — forked from rarylson/automator_new_file.scpt
AppleScript to create a new file in Finder (to be used in Automator)
-- AppleScript to create a new file in Finder
--
-- Use it in Automator, with the following configuration:
-- - Service receives: no input
-- - In: Finder.app
--
-- References:
-- - http://apple.stackexchange.com/a/129702
-- - http://stackoverflow.com/a/6125252/2530295
-- - http://www.russellbeattie.com/blog/fun-with-the-os-x-finder-and-applescript
@haipham
haipham / social-sharing-alignment.html
Created March 25, 2016 21:14 — forked from thebigreason/social-sharing-alignment.html
Align Facebook Like, Twitter Tweet and Google +1 buttons
<div class="social">
<span class="twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="[your-url-here]">Tweet</a>
</span>
<span class="google">
<g:plusone size="medium" href="[your-url-here]"></g:plusone>
</span>
<span class="Facebook">
<iframe src="https://www.facebook.com/plugins/like.php?href=[your-url-here]&amp;show_faces=false&amp;layout=button_count" scrolling="no" frameborder="0" style="height: 21px; width: 100px" allowTransparency="true"></iframe>
</span>
@haipham
haipham / OpenCartValetDriver.php
Created December 24, 2016 14:09 — forked from mikkpokk/OpenCartValetDriver.php
Laravel Valet Driver - OpenCart 2.x
<?php
class OpenCartValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri