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
import subprocess | |
command = "C:/ffmpeg/bin/ffmpeg.exe -i C:/path_to/video.mp4 -ab 160k -ac 2 -ar 44100 -vn audio.wav" | |
subprocess.call(command, shell=True) |
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
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore is now working" |
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 | |
for ($i = 1; $i < 12; $i++) { | |
$cartProductsCollection = Mage::getModel('catalog/product')->getCollection() | |
->addStoreFilter($this->getStoreId()) | |
->addAttributeToSelect('*')->setPageSize( 1000 ) | |
->setCurPage( $i ); | |
// FIND PRODUCT WITH COLOR ATTRIBUTE | |
foreach ( $ProductsCollection as $product) { | |
$attributes = $product->getAttributes(); |
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
#For single file: | |
git rm --cached mylogfile.log | |
#For single directory: | |
git rm --cached -r mydirectory | |
# Now you have to put the file/directory into .gitignore |
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 moveElement(&$array, $a, $b) { | |
$out = array_splice($array, $a, 1); | |
array_splice($array, $b, 0, $out); | |
} |
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
grep -rnw '/etc/path/somewhere/' -e 'pattern' |
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
<html> | |
<head> | |
<!-- This will make the CSS load asynchronously, and also it takes care of users without javascript --> | |
<link rel="stylesheet" href="styles.css" media="none" onload="if(media!='all')media='all'"> | |
<noscript><link rel="stylesheet" href="styles.css"></noscript> | |
</head> | |
</html |
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
UPDATE wp_posts SET guid = REPLACE(guid, 'olddomain.com', 'newdomain.com') WHERE guid LIKE 'http://olddomain.com/%'; | |
UPDATE wp_posts SET guid = REPLACE(guid, 'olddomain.com', 'newdomain.com') WHERE guid LIKE 'https://olddomain.com/%'; |
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
# This will fix errors like this | |
# error: update_ref failed for ref 'refs/remotes/origin/lukas': cannot lock ref 'refs/remotes/origin/lukas': 'refs/remotes/origin/lukas/css' exists; | |
# cannot create 'refs/remotes/origin/lukas' | |
git gc --prune=now | |
git remote prune origin | |
git pull |
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 | |
$product = Mage::getModel('catalog/product') | |
->load(9275); | |
$collection = $product->getTypeInstance(true) | |
->getSelectionsCollection($product->getTypeInstance(true)->getOptionsIds($product), $product); | |
$children_ids = []; |