Skip to content

Instantly share code, notes, and snippets.

View amiut's full-sized avatar
🎯
Focusing

Amin Abdolrezapoor amiut

🎯
Focusing
View GitHub Profile
@amiut
amiut / is-woocommerce-page.php
Created December 11, 2017 21:13
Check if is woocommerce page or not
/**
* Is woocommerce page
*
* @param string $page ( 'cart' | 'checkout' | 'account' | 'endpoint' )
* @param string $endpoint If $page == 'endpoint' and you want to check for specific endpoint
* @return boolean
*/
if( ! function_exists('is_woocommerce_page') ){
function is_woocommerce_page( $page = '', $endpoint = '' ){
if( ! $page ){
/**
* Time ago - Human time diff enhanced
*
* @param string $timeformat Fallback date format
* @param int $timestamp Post or comment or anyhing's timestamp
* @return string
*/
if( ! function_exists('dw_time_ago') ){
function dw_time_ago( $timeformat = 'j F Y H:i', $timestamp = '' ){
if( ! $timestamp ){
@amiut
amiut / rem-calc.scss
Created June 14, 2018 20:12
Convert px values to rem in SASS
$html-base-font-size = 12px;
@function rem( $px ){
@if( unit( $px ) == 'rem' ){
@return $px;
}
@else if( unit($px) == 'px' ) {
@return ( $px / $html-base-font-size ) + 0rem;
}
@else if( unit( $px ) == '' ) {
# Delete missing files
svn status | ? { $_ -match '^!\s+(.*)' } | % { svn rm $Matches[1] }
# Added new files
svn status | ? { $_ -match '^\?\s+(.*)' } | % { svn add $Matches[1] }
# Commit repository
svn commit -m "This commit is done by a PowerShell bat"
<?php
set_time_limit(0);
$url = 'http://www.freewarelovers.com/android/download/temp/1306495040_Number_Blink_1.1.1.apk';
$file = fopen(dirname(__FILE__) . '/downloads/a.apk', 'w+');
$curl = curl_init();
// Update as of PHP 5.4 array() can be written []
curl_setopt_array($curl, [