This file contains hidden or 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
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
{ | |
$arguments = "& '" + $myinvocation.mycommand.definition + "'" | |
Start-Process powershell -Verb runAs -ArgumentList $arguments | |
Break | |
} | |
This file contains hidden or 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
const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]; | |
getStyle(document.querySelector('p'), 'font-size'); // '16px' |
This file contains hidden or 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
# find folder location by folder name | |
dir=$(sudo find $HOME -type d -name folderName) | |
cd $dir | |
# print file data that starts from specific text | |
cat .flake8 | sed -n -e '/exclude = /,$p' |
This file contains hidden or 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
''' Firefox Driver options ''' | |
options = webdriver.FirefoxOptions() | |
# disable push notifications | |
options.set_preference("dom.push.enabled", False) | |
# maximize window size | |
driver.maximize_window() |
This file contains hidden or 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
.row { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
flex-wrap: wrap; | |
} | |
.row > [class*='col-'] { | |
display: flex; |
This file contains hidden or 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
.image { | |
position: relative; | |
background: #f5f5f5; | |
max-width: 100%; | |
max-height: 100%; | |
overflow: hidden; | |
} | |
.image:after { |
This file contains hidden or 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 | |
function getLang(array $request, $default) | |
{ | |
return | |
!empty($request['get']['lang']) ? $request['get']['lang'] : | |
(!empty($request['cookie']['lang']) ? $request['cookie']['lang'] : | |
(!empty($request['session']['lang']) ? $request['session']['lang'] : | |
(!empty($request['server']['HTTP_ACCEPT_LANGUAGE']) ? substr($request['server']['HTTP_ACCEPT_LANGUAGE'], 0, 2) : $default))); | |
} |
This file contains hidden or 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 | |
function getIP() | |
{ | |
if ($_SERVER['HTTP_CLIENT_IP']) | |
$visitorIP[] = $_SERVER['HTTP_CLIENT_IP']; | |
if ($_SERVER['HTTP_X_FORWARDED']) | |
$visitorIP[] = $_SERVER['HTTP_X_FORWARDED']; | |
if ($_SERVER['HTTP_X_FORWARDED_FOR']) | |
$visitorIP[] = $_SERVER['HTTP_X_FORWARDED_FOR']; |
This file contains hidden or 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
// disallow select content on the page | |
.no-select { | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
} |
This file contains hidden or 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 | |
function wordCount() { | |
$description = "Hello there"; | |
$string = preg_replace('/\s+/', ' ', trim($description)); | |
$words = explode(" ", $string); | |
return count($words); | |
} |