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
//Reverse String | |
function reverse(s){ | |
return s.split("").reverse().join(""); | |
} |
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
/* Method 1 */ | |
.a { | |
width: 200px; | |
height: 200px; | |
background-color: black; | |
color: #fff; | |
display:flex; | |
justify-content:center; | |
flex-direction:column; |
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
using namespace System::Runtime::InteropServices; | |
char * and_SysStringToChar(System::String^ string) | |
{ | |
return (char*)(void*)Marshal::StringToHGlobalAnsi(string); | |
} | |
String^ s = textBox1->Text; | |
char* str = and_SysStringToChar(s); |
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
char buff[100]; | |
if(ptm->tm_mon < 10){ | |
if(ptm->tm_mday < 10){ | |
sprintf(buff,"%u-0%u-0%u",(unsigned)ptm->tm_year,(unsigned)ptm->tm_mon,(unsigned)ptm->tm_mday); | |
}else{ | |
sprintf(buff,"%u-0%u%u",(unsigned)ptm->tm_year,(unsigned)ptm->tm_mon,(unsigned)ptm->tm_mday); | |
} | |
}else{ | |
if(ptm->tm_mday < 10){ | |
sprintf(buff,"%u-%u-0%u",(unsigned)ptm->tm_year,(unsigned)ptm->tm_mon,(unsigned)ptm->tm_mday); |
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
<!DOCTYPE html> | |
<html> | |
<head><head> | |
<body> | |
<header class="scroller"></header> | |
<main> | |
content must be longer than 100vh | |
</main> |
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
from urllib.request import urlopen | |
url = "https://facebook.com" | |
data = urlopen("http://tinyurl.com/api-create.php?url="+url) | |
shorten_url = data.readlines()[0].decode() | |
print(shorten_url) |
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); | |
} |
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 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
<?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))); | |
} |
OlderNewer