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
#!/usr/bin/env python3 | |
from math import gcd | |
from functools import reduce | |
def lcm(a, b): | |
"""lowest common multiple of a and b""" | |
return int(a * b / gcd(a, b)) | |
def gcd_from_list(arr): | |
"""Calculate greatest common divisor from list""" |
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
## | |
# Some nginx config inside server block | |
# | |
# Examples of: | |
# * Using subdirectory | |
# * Server from another directory | |
# * Autoindex file listing | |
# * Using basic auth | |
# | |
# Install and using of htpasswd tools: |
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
add_filter('user_meta_field_display', function ($html) { | |
// Get label html | |
preg_match("/<label.*>.*<\/label>/", $html, $matches); | |
$label = $matches[0]; | |
// Get input html | |
preg_match("/<input.*\/>/", $html, $matches); | |
$input = $matches[0]; | |
// Create new html |
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 | |
/** | |
* Creating instance of error class | |
*/ | |
$error = new WP_Error( 'not_found', 'Page Not Found', 'Page Data' ); | |
/** | |
* Add new error to object | |
*/ |
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 | |
/* | |
Plugin Name: Frontend AJAX Sub-Category Dropdown | |
Plugin URI: http://khaledsaikat.com | |
Description: Load sub-category dropdown based on parent category by ajax call | |
Version: 0.1 | |
Author: Khaled Hossain | |
Author URI: http://khaledsaikat.com | |
*/ |
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
add_filter( 'user_meta_field_config', 'user_meta_field_config_populate_options', 10, 4 ); | |
function user_meta_field_config_populate_options( $field, $fieldID, $formName, $userID ){ | |
if( $fieldID != 'Your_Field_ID' ) // Put your desired field id here | |
return $field; | |
$metaKeys = array( 'key1', 'key2', 'key3' ); | |
$output = null; | |
foreach( $metaKeys as $key ): |
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
package main | |
import ( | |
"fmt" | |
"time" | |
"net/http" | |
) | |
var urls = []string{ | |
"http://google.com", |
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
#include <iostream> | |
#include <opencv2/highgui/highgui.hpp> | |
using namespace std; | |
using namespace cv; | |
int main(int argc, char* argv[]) | |
{ | |
CvCapture *camCapture; | |