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; | |
| server_name ~^(.+)\.frameworks\.loc$; | |
| set $file_path $1; | |
| root /home/_______/www/frameworks/$file_path/public; | |
| index index.html index.php; | |
| include /etc/nginx/defaults.conf; | |
| } | |
| # make sure to create matching entries in /etc/hosts! |
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
| http://labs.laan.com/wp/2011/01/how-to-make-time-lapse-screencaptures-of-your-design-work-for-free-mac/ | |
| In ubuntu I created a bash script and ran it all day while I worked (using apt-get install ImageMagick) | |
| #!/bin/bash | |
| i=1; | |
| while [ 1 ]; | |
| do import -window root -resize 50% my/foldername/$i.jpg | |
| let i++; | |
| sleep 10; |
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 | |
| $regions = array( | |
| 'Africa' => DateTimeZone::AFRICA, | |
| 'America' => DateTimeZone::AMERICA, | |
| 'Antarctica' => DateTimeZone::ANTARCTICA, | |
| 'Aisa' => DateTimeZone::ASIA, | |
| 'Atlantic' => DateTimeZone::ATLANTIC, | |
| 'Europe' => DateTimeZone::EUROPE, | |
| 'Indian' => DateTimeZone::INDIAN, | |
| 'Pacific' => DateTimeZone::PACIFIC |
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
| /* | |
| smtpd.js is SMTP server written for node.js | |
| this one works with node 0.4.8 and is standalone | |
| sudo node smtpd.js | |
| MIT License | |
| */ |
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
| <VirtualHost *:80> | |
| ServerName domain.tld | |
| ServerAdmin [email protected] | |
| DocumentRoot /var/www/domain.tld/ | |
| # mod_rewrite rules | |
| RewriteEngine on | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule ^(.*)$ index.php/$1 [QSA,L] |
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
| <!DOCTYPE html> | |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
| <title>Demo</title> | |
| <style> | |
| #main{margin:0 auto; width:950px; background-color:#0000FF} | |
| div {float:left; width:70px; height:70px; background-color:red;} | |
| div + div { float:left; margin-left: 10px; width:70px; height:70px; background-color:red;} |
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
| These weights are often combined into a tf-idf value, simply by multiplying them together. The best scoring words under tf-idf are uncommon ones which are repeated many times in the text, which lead early web search engines to be vulnerable to pages being stuffed with repeated terms to trick the search engines into ranking them highly for those keywords. For that reason, more complex weighting schemes are generally used, but tf-idf is still a good first step, especially for systems where no one is trying to game the system. | |
| There are a lot of variations on the basic tf-idf idea, but a straightforward implementation might look like: | |
| <?php | |
| $tfidf = $term_frequency * // tf | |
| log( $total_document_count / $documents_with_term, 2); // idf | |
| ?> | |
| It's worth repeating that the IDF is the total document count over the count of the ones containing the term. So, if there were 50 documents in the collection, and two of them contained the term in question, the IDF would be 50/2 = 25. To be accurate, we s |
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 | |
| # | |
| # Portable PHP password hashing framework. | |
| # | |
| # Version 0.3 / genuine. | |
| # | |
| # Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in | |
| # the public domain. Revised in subsequent years, still public domain. | |
| # | |
| # There's absolutely no warranty. |
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
| For those that are interested, it seems full support for [locales](http://php.net/manual/en/function.setlocale.php) and i18n in PHP is finally starting to take place. | |
| // Set the current locale to the one the user agent wants | |
| $locale = Locale::acceptFromHttp(getenv('HTTP_ACCEPT_LANGUAGE')); | |
| // Default Locale | |
| Locale::setDefault($locale); | |
| setlocale(LC_ALL, $locale . '.UTF-8'); | |
| // Default timezone of server |
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
| var $w = function(){ | |
| var $w = function(){ | |
| return new $w.init; | |
| } | |
| $w.prototype = { | |
| // add all of the methods/props you want accessible as $w().method() or $w().prop here: | |
| init: function(){ | |
| console.log('init called'); | |
| }, |