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
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
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
from datetime import date, timedelta | |
from dateutil import easter | |
from dateutil.relativedelta import * | |
def get_holidays(year=2010): | |
""" Returns Polish hollidays dates (legally considered non-working days) """ | |
easter_sunday = easter.easter(year) | |
holidays = {'New Year': date(year,1,1), | |
'Trzech Kroli': date(year,1,6), | |
'Easter Sunday': easter_sunday, |
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 | |
/* | |
How To Locally Mirror Remote Images With WordPress | |
Source: http://forrst.com/posts/Locally_Mirror_Remote_Images_With_WordPress-XSE | |
*/ | |
// URL of the image you want to mirror. Girl in pink underwear for instance. | |
$image = 'http://i.imgur.com/Hq4QA.jpg'; |
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( $, plugin ) { | |
"use strict"; | |
// Working with promises to bubble event later than core. | |
$.when( someObjectWithEvents ).done( function() { | |
console.log( 'AJAX request done.' ); | |
} ) | |
.then( function() { | |
setTimeout( function() { | |
console.log( 'AJAX requests resolved.' ); |
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 | |
$file = '/path/to/file.png'; | |
$filename = basename($file); | |
$upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
if (!$upload_file['error']) { | |
$wp_filetype = wp_check_filetype($filename, null ); | |
$attachment = array( | |
'post_mime_type' => $wp_filetype['type'], | |
'post_parent' => $parent_post_id, |
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 git_likely_authority() { | |
# Outputs a ranked list of likely author(itie)s regarding tracked files matching *${1}* | |
# (Makes it easier to discover who likely knows most about the matched files) | |
# (Note: Not always indicative if large refactors/renamings have occurred) | |
# E.g. `git_likely_authority some_pattern_that_matches_a_path` | |
git ls-files "*${1}*" | | |
grep -v -E 'node_modules|vendor' | # edit to avoid certain files/dirs | |
xargs -n1 git blame --line-porcelain | | |
sed -n 's/^author //p' | | |
sort -f | |
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
license: mit |
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
<script src="http://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.1/processing-api.min.js"></script><html> | |
<!-- | |
Created using jsbin.com | |
Source can be edited via http://jsbin.com/pdfjs-helloworld-v2/8598/edit | |
--> | |
<body> | |
<canvas id="the-canvas" style="border:1px solid black"></canvas> | |
<input id='pdf' type='file'/> | |
<!-- Use latest PDF.js build from Github --> |
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
// Calculating the bounding box | |
function boundbox ($lat, $lon, $distance, $units="km") { | |
return array ( "N" => getDestinationCoordinates ($lat,$lon, 0,$distance,$units), | |
"E" => getDestinationCoordinates ($lat,$lon, 90,$distance,$units), | |
"S" => getDestinationCoordinates ($lat,$lon, 180,$distance,$units), | |
"W" => getDestinationCoordinates ($lat,$lon, 270,$distance,$units)); | |
} |
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 | |
# credits to: https://gist.github.com/2called-chaos/4285767 | |
# Install: | |
# curl -O https://gist.githubusercontent.com/ziogaschr/74884b8d5095c86a7cef/raw/d236c87d89a34b588f37838843279e8e02f073e9/setup-autossh-tunnel.sh | |
# chmod u+x setup-autossh-tunnel.sh | |
# ./setup-autossh-tunnel.sh | |
# | |
# Extra: | |
# it is good to make a new user on both host and remote (http://linuxaria.com/howto/permanent-ssh-tunnels-with-autossh) | |
# useradd -m -s /bin/false autossh |
OlderNewer