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
| jQuery.fn.shake = function(intShakes, intDistance, intDuration) { | |
| this.each(function() { | |
| $(this).css({position:"relative"}); | |
| for (var x=1; x<=intShakes; x++) { | |
| $(this).animate({left:(intDistance*-1)}, (((intDuration/intShakes)/4)), "swing") | |
| .animate({left:intDistance}, ((intDuration/intShakes)/2), "swing") | |
| .animate({left:0}, (((intDuration/intShakes)/4)), "swing"); | |
| } | |
| }); | |
| return this; |
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
| // Two ways to serve transparent GIF | |
| var buf = new Buffer([ | |
| 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, | |
| 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c, | |
| 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, | |
| 0x02, 0x44, 0x01, 0x00, 0x3b]); | |
| res.send(buf, { 'Content-Type': 'image/gif' }, 200); |
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 latestYoutube ($channel) { | |
| error_reporting(E_ALL); | |
| $feedURL = 'http://gdata.youtube.com/feeds/api/users/' . $channel . '/uploads?max-results=20'; | |
| $sxml = simplexml_load_file($feedURL); | |
| $i = 0; | |
| foreach ($sxml->entry as $entry) { | |
| $media = $entry->children('media', true); | |
| $url = (string)$media->group->player->attributes()->url; | |
| $index = strrpos($url, "&"); | |
| $url = substr($url, 0, $index); |
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
| @echo off | |
| if "%PHPBIN%" == "" set PHPBIN=C:\path\to\PHP\executable\dir\.\php.exe | |
| "%PHPBIN%" "C:\path\to\composer.phar" %* |
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
| server { | |
| listen 80 default_server; | |
| server_name domain.com *.domain.com; | |
| root /srv/www/domain.com/public; | |
| access_log /srv/www/domain.com/log/access.log; | |
| error_log /srv/www/domain.com/log/error.log; | |
| location / { | |
| index index.php; |
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
| <?php | |
| $fileName = $_FILES['afile']['name']; | |
| $fileType = $_FILES['afile']['type']; | |
| $fileContent = file_get_contents($_FILES['afile']['tmp_name']); | |
| $dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent); | |
| $json = json_encode(array( | |
| 'name' => $fileName, | |
| 'type' => $fileType, | |
| 'dataUrl' => $dataUrl, |
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
| #!/usr/bin/env python | |
| import urllib, sys, bs4 | |
| print bs4.BeautifulSoup(urllib.urlopen("http://data.alexa.com/data?cli=10&dat=s&url="+ sys.argv[1]).read(), "xml").find("REACH")['RANK'] |
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
| { | |
| "europe": { | |
| "va": "vatican city", | |
| "ch": "switzerland", | |
| "ad": "andorra", | |
| "ee": "estonia", | |
| "is": "iceland", | |
| "am": "armenia", | |
| "al": "albania", | |
| "cz": "czech republic", |
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 | |
| # | |
| # This script configures WordPress file permissions based on recommendations | |
| # from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
| # | |
| # Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
| # | |
| WP_OWNER=www-data # <-- wordpress owner | |
| WP_GROUP=www-data # <-- wordpress group | |
| WP_ROOT=$1 # <-- wordpress root directory |
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
| # PIL RGB 'im' to CV2 BGR 'imcv' | |
| imcv = np.asarray(im)[:,:,::-1].copy() | |
| # Or | |
| imcv = cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2BGR) | |
| # To gray image | |
| imcv = np.asarray(im.convert('L')) | |
| # Or | |
| imcv = cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2GRAY) |
OlderNewer