Skip to content

Instantly share code, notes, and snippets.

@manchoz
manchoz / latlng.sh
Created May 18, 2012 15:18
Address geocoding in Bash with Google Maps API
#!/bin/bash
# Quick and dirty geocoding with Google Maps API
MAPSAPIURL="http://maps.googleapis.com/maps/api/geocode/json"
[ -f latlng.txt ] && rm latlng.txt
[ -f results.json ] && rm results.json
while read line; do
# Get address from column 3 and 4 of a CSV file provided as argument and prepare the string address. YMMV.
@tegansnyder
tegansnyder / find-products-without-images.sql
Created January 16, 2014 21:58
Magento - finding products without images. Raw SQL.
SELECT *
FROM `catalog_product_entity` AS a
LEFT JOIN `catalog_product_entity_media_gallery` AS b ON a.entity_id = b.entity_id
WHERE b.value IS NULL
@cferdinandi
cferdinandi / stop-video.js
Last active July 19, 2024 23:33
A simple method to stop YouTube, Vimeo, and HTML5 videos from playing.
/**
* Stop an iframe or HTML5 <video> from playing
* @param {Element} element The element that contains the video
*/
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;
@kissarat
kissarat / ukrainian-stopwords.txt
Last active August 17, 2021 18:55
Stopwords for ukrainian language
a
б
в
г
е
ж
з
м
т
у
@ghalusa
ghalusa / youtube_id_regex.php
Created June 20, 2015 23:14
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@danielmcclure
danielmcclure / facebook-wca-standard-events.html
Last active January 14, 2024 14:54
Sample Facebook Standard Events for New Facebook WCA (Website Custom Audience) Pixel
<!-- Facebook Custom Audience Pixel Code - Placed on Every Page of Site -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
</script>
@marcora
marcora / gist:cb37b2432c072e8e9d77
Created September 15, 2015 03:24
Install Adobe Source Code Pro font on Linux
#!/bin/sh
echo "installing fonts at $PWD to ~/.fonts/"
mkdir -p ~/.fonts/adobe-fonts/source-code-pro
git clone https://github.com/adobe-fonts/source-code-pro.git ~/.fonts/adobe-fonts/source-code-pro
# find ~/.fonts/ -iname '*.ttf' -exec echo \{\} \;
fc-cache -f -v ~/.fonts/adobe-fonts/source-code-pro
echo "finished installing"
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@yvoronoy
yvoronoy / CODE_AND_DB_DUMP.MD
Last active April 26, 2023 08:35 — forked from tshabatyn/CODE_AND_DB_DUMP.MD
How to Generate Magento2 Code and DB dumps

Code dump

You can use tiny script m2dump it is doing the same thing as described below.

Estimate size of directories and exclude no needed.

du -sh ./* | sort -h
@andrewlimaza
andrewlimaza / honeypot-example.php
Last active July 17, 2024 07:03
Simple honeypot for an HTML form using PHP
<?php
//check if form was sent
if($_POST){
$to = 'some@email.com';
$subject = 'Testing HoneyPot';
$header = "From: $name <$name>";
$name = $_POST['name'];