Skip to content

Instantly share code, notes, and snippets.

View tedshd's full-sized avatar

Ted tedshd

View GitHub Profile
@searsia
searsia / proxy.php
Created January 6, 2018 08:45
Simple PHP image proxy
<?php
$PROXY = 'https://yourdomain.top/proxy.php?url=';
# This script forwards the call
# Check for url parameter, and prevent file transfer
if (isset($_GET['url']) and preg_match('#^https?://#', $_GET['url']) === 1) {
$url .= $_GET['url'];
} else {
@showsky
showsky / HZip.php
Created October 26, 2015 09:28
Backup file to google drive
<?php
class HZip {
/**
* Add files and sub-directories in a folder to zip file.
* @param string $folder
* @param ZipArchive $zipFile
* @param int $exclusiveLength Number of text to be exclusived from the file path.
*/
private static function folderToZip($folder, &$zipFile, $exclusiveLength) {
@Rplus
Rplus / URL.js
Last active August 29, 2015 14:07 — forked from jlong/uri.js
var url = "http://example.com:3000/pathname/?search=test#hash";
var _a = new URL(url);
_a.protocol; // => "http:"
_a.hostname; // => "example.com"
_a.port; // => "3000"
_a.pathname; // => "/pathname/"
_a.search; // => "?search=test"
_a.hash; // => "#hash"
@Rplus
Rplus / svg.md
Last active November 15, 2015 22:01
SVG it !

伸縮自在的愛

using svg automaticly generate fonts by gulp-iconfont

獵人動畫中的小傑在天空競技場,被西索誤導欺騙,臉頰因而黏上西索招牌念能力「伸縮自在的愛」的 Q 版畫面

這篇主要是要講如何使用 SVG 圖檔來生成 icon font,
並且要讓這 icon font 能順利在 CSS preprocessor tool 下接軌

目前 github demo repo 是使用 stylus preprocessor

@sindresorhus
sindresorhus / post-merge
Last active May 2, 2024 03:18
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/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"
@martinrusev
martinrusev / imap-search
Last active March 22, 2024 06:50
IMAP Search criteria
@saetia
saetia / gist:1623487
Last active May 1, 2024 19:55
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@kosso
kosso / slider.html
Created August 1, 2011 19:45
A very simple basic 'slider' bar in JavaScript and CSS
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#bar{
width:200px;
height:25px;
border:1px solid black;
position:relative;