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 | |
echo '<pre>'; | |
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL; | |
// Download file | |
file_put_contents('wp.zip', file_get_contents('https://wordpress.org/latest.zip')); | |
$zip = new ZipArchive(); | |
$res = $zip->open('wp.zip'); | |
if ($res === TRUE) { |
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 | |
$local_file = 'file_path'; //path to a local file on your server | |
$post_fields = array( | |
'name' => 'value', | |
); | |
$boundary = wp_generate_password( 24 ); | |
$headers = array( | |
'content-type' => 'multipart/form-data; boundary=' . $boundary, | |
); |
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
#!/bin/bash | |
set -euo pipefail | |
FIRST="${1:-}" | |
SECOND="${2:-}" | |
CURL="curl" | |
CURL_FLAGS="${CURL_FLAGS:--sSki}" |
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
#!/bin/bash | |
# Start this scipt above the /piwik directory. | |
# We assume that the webserver runs under www-data. | |
# download & verify | |
wget -nv "http://builds.piwik.org/piwik.zip" || exit 1 | |
wget -nv "http://builds.piwik.org/piwik.zip.asc" || exit 2 | |
gpg --verify piwik.zip.asc || exit 3 |
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 bash | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# git hook to run a command after `git pull` if a specified file was changed | |
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" |
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
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) | |
/******/ return installedModules[moduleId].exports; |
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
@{% | |
const merge = d => d.join(''); | |
const nth = n => d => d[n]; | |
%} | |
@builtin "whitespace.ne" | |
json -> _ object _ {% nth(1) %} | |
| _ array _ {% nth(1) %} |
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
>>> class X: | |
... def __getitem__(self, item): | |
... print isinstance(item, slice) | |
... print item | |
... | |
>>> y=X() | |
>>> y[1:3,5] | |
False | |
(slice(1, 3, None), 5) | |
>>> y[{'foo':'bar'}] |
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
#!/bin/bash | |
if [[ $1 == "--help" || $1 == "-h" ]]; then | |
cat <<USAGE | |
usage: $(basename $0) FILE [REVISION] | |
Compare file size between version at REVISION (default: index) and | |
on disk. | |
USAGE | |
exit |
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
#!/bin/bash | |
ERROR=0 | |
mkdir -p "$HOME/.fonts" | |
for name in "$@"; do | |
if [[ ! -f $name ]]; then | |
echo "Can't find $name" >&2 | |
ERROR=1 |
NewerOlder