Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| /*! | |
| An experiment in getting accurate visible viewport dimensions across devices | |
| (c) 2012 Scott Jehl. | |
| MIT/GPLv2 Licence | |
| */ | |
| function viewportSize(){ | |
| var test = document.createElement( "div" ); | |
| test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;"; |
| <?php | |
| function theme_form_alter(&$form, &$form_state, $form_id) { | |
| if ($form_id == 'search_block_form') { | |
| $form['search_block_form']['#title'] = t('Search'); // Change the text on the label element | |
| $form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty | |
| //$form['search_block_form']['#size'] = 40; // define size of the textfield | |
| $form['search_block_form']['#default_value'] = t('Search'); // Set a default value for the textfield | |
| //$form['actions']['submit']['#value'] = t('GO!'); // Change the text on the submit button | |
| $form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/immagini/btnCerca.png'); |
| // Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
| // jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
| // author: Pawel Kozlowski | |
| var myApp = angular.module('myApp', []); | |
| //service style, probably the simplest one | |
| myApp.service('helloWorldFromService', function() { | |
| this.sayHello = function() { | |
| return "Hello, World!" |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <configuration> | |
| <system.webServer> | |
| <rewrite> | |
| <rules> | |
| <clear /> | |
| <rule name="TempRewriteToWeb" stopProcessing="false"> | |
| <match url="^(web/)?(.*)$" /> | |
| <action type="Rewrite" url="web/{R:2}" logRewrittenUrl="true" /> | |
| </rule> |
| // Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast) | |
| (function poll(){ | |
| $.ajax({ url: "server", success: function(data){ | |
| //Update your dashboard gauge | |
| salesGauge.setValue(data.value); | |
| }, dataType: "json", complete: poll, timeout: 30000 }); | |
| })(); |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| RewriteEngine On | |
| RewriteBase / | |
| RewriteCond %{REQUEST_URI} !^public | |
| RewriteRule ^(.*)$ /public/$1 [L] |
| //* Move Post Title and Post Info from inside Entry Header to Entry Content on Posts page | |
| add_action( 'genesis_before_entry', 'reposition_entry_header' ); | |
| function reposition_entry_header() { | |
| if ( is_home() ) { | |
| remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); | |
| remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); | |
| remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); | |
| remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); |
| /** | |
| * Object.prototype.watch polyfill | |
| * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch | |
| * | |
| * Known limitations: | |
| * - `delete object[property]` will remove the watchpoint | |
| * | |
| * Based on Eli Grey gist https://gist.github.com/eligrey/384583 | |
| * Impovements based on Xose Lluis gist https://gist.github.com/XoseLluis/4750176 | |
| * This version is optimized for minification |
With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?
/etc/init/$ sudo vim yourapp.conf$ sudo start yourapp$ sudo stop yourapp