This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Question: In a binary tree, if in the path from root to the node A, there is no node with greater value than A’s, this node A is visible. | |
// We need to count the number of visible nodes in a binary tree. | |
// For example, in the following tree: | |
// | |
// 5 | |
// / \ | |
// 3 10 | |
// / \ / | |
// 20 21 1 | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('ABSPATH')) exit("Direct access not permitted."); | |
define('APP_NAME', 'Viral Startup'); | |
define('APP_SLUG', 'viral-startup'); | |
define('APP_VERSION', SCRIPT_DEBUG ? uniqid() : 1); | |
define('ASSETS_PATH', get_template_directory() . '/assets/dist'); | |
define('ASSETS_URI', get_template_directory_uri() . '/assets/dist'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function get_rand { | |
echo "$(date +%s)" | |
} | |
function is_empty { | |
if [[ -z "$1" ]]; then echo 1; else echo 0; fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/a/1026087 | |
function capitalizeFirstLetter(string) { | |
return (typeof string === 'string' || string instanceof String) ? | |
string.charAt(0).toUpperCase() + string.slice(1) : | |
false; | |
} | |
/** | |
* Enum for css event group values. | |
* @readonly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
l = log --pretty=format:\"%C(yellow)%h %ad%Cred%d %Creset%s%Cblue [%cn]\" --decorate --date=iso | |
la = "!git l --author=\"$(git config user.name)\"" | |
s = status --short | |
a = add | |
aa = add --all | |
ac = !git add . && git commit --all --message | |
b = branch | |
c = commit --verbose | |
cm = commit --verbose --message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.facebook-spinner { | |
@include facebook-spinner; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2020 Justin Bull | |
# 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: | |
# The above copyright notice and this permission notice shall be included in all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="message orient-left theme-blue"> | |
<div class="message-inner"> | |
<div class="message-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar sodales ipsum, sit amet ultricies sem ultrices ut. Fusce lorem.</div> | |
</div> | |
</div> | |
<div class="message orient-right theme-gray"> | |
<div class="message-inner"> | |
<div class="message-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar sodales ipsum, sit amet ultricies sem ultrices ut. Fusce lorem.</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAddressComponents(address_components) { | |
var result = {}, | |
allowable_types = ['country', 'locality', 'postal_code', 'route', 'street_number', 'administrative_area_level_1'], | |
type_aliases = { | |
administrative_area_level_1: "region" | |
}; | |
$.each(address_components, function (index, value) { | |
var type = value.types[0]; | |
if (allowable_types.indexOf(type) >= 0) { | |
if (type_aliases.hasOwnProperty(type)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convert_color(&$color) { | |
if (strpos($color, "0x")) return; | |
$color = ltrim($color, "#"); | |
if (ctype_xdigit($color)) $color = "0x" . $color; // is the color value a hexadecimal digit? | |
} | |
function static_google_map($mapAddress = null, $customParams = array(), $output = true) { | |
$delimiter = "&"; | |
$pipe = "%7C"; | |
$maxDimension = 640; | |
$apiPath = 'http://maps.googleapis.com/maps/api/staticmap'; |