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
<!-- custom upload button --> | |
<button id="custom_uploader">upload mp3</button> | |
<script> | |
$( "#custom_uploader" ).click( function() { | |
const send_attachment_bkp = wp.media.editor.send.attachment; | |
const button = $(this); | |
wp.media.editor.send.attachment = function( props, attachment ) { | |
$( button ).parent().prev().attr( "src", attachment.url ); | |
$( button ).prev().val( attachment.id ); | |
wp.media.editor.send.attachment = send_attachment_bkp; |
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
let run = true; | |
let images = []; | |
function getLinks() { | |
$(".block.Image").each(function(){ | |
let link; | |
try { | |
link = $(this).find(".img").attr("style");//.match( /(https.*\.jpg)/ )[0]; | |
} catch ( error ) { | |
console.log( "this", $(this) ); | |
console.log( "img", $(this).find(".img") ); |
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
#!/bin/bash | |
# where the blobs should be saved | |
BLOB_PATH=; | |
# the tsschecker binary | |
TSSCHECKER_PATH=; | |
cd "$BLOB_PATH" || exit 0; | |
# this cache file can stick around for quite a while, so delete it since we aren't running this all the time |
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
set_error_handler( | |
create_function( | |
'$severity, $message, $file, $line', | |
'throw new ErrorException($message, $severity, $severity, $file, $line);' | |
) | |
); | |
try { | |
file_get_contents( "www.google.com" ); | |
} catch ( Exception $error ) { |
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
#!/bin/bash | |
cat "$FILE" | openssl dgst -sha256; |
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
require 'formula' | |
class Sshpass < Formula | |
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz' | |
homepage 'http://sourceforge.net/projects/sshpass' | |
sha256 'c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60' | |
def install | |
system "./configure", "--disable-debug", "--disable-dependency-tracking", | |
"--prefix=#{prefix}" |
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
function isBalanced( string, opening_char = "[", closing_char = "]" ) { | |
let openings = 0; | |
for ( let pos = 0; pos < string.length; pos++ ) { | |
let char = string[ pos ]; | |
// if opening, store that info | |
if ( char === opening_char ) { |
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
#!/bin/bash | |
LOG="$HOME/log/battery.log"; | |
# create TSV headers if log file does not exist | |
if [ ! -f "$LOG" ]; then | |
echo "Creating Log File"; | |
echo -e "Date\tCurrent Charge\tMax Charge\tCycle Count\tCondition\tAmperage\tVoltage" > "$LOG"; | |
fi; |
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
ffmpeg -r 6 -pattern_type glob -i '*.jpg' -vcodec libx264 video.mp4; |
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
#!/bin/bash | |
# enable and disable Gatekeeper in High Sierra | |
if [ "$1" = "enable" ]; then | |
sudo spctl --master-enable; | |
elif [ "$1" = "disable" ]; then | |
sudo spctl --master-disable; | |
else | |
echo "Enter a command 'enable|disable'"; |