This gist is deprecated in favor of https://github.com/ninenines/cowboy/blob/master/doc/src/guide/specs.asciidoc which has a formatted version at https://ninenines.eu/docs/en/cowboy/2.0/guide/specs/
### | |
### | |
### UPDATE: For Win 11, I recommend using this tool in place of this script: | |
### https://christitus.com/windows-tool/ | |
### https://github.com/ChrisTitusTech/winutil | |
### https://www.youtube.com/watch?v=6UQZ5oQg8XA | |
### iwr -useb https://christitus.com/win | iex | |
### | |
### |
I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.
I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.
defmodule XmlNode do | |
require Record | |
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl") | |
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl") | |
def from_string(xml_string, options \\ [quiet: true]) do | |
{doc, []} = | |
xml_string | |
|> :binary.bin_to_list | |
|> :xmerl_scan.string(options) |
var listenOn = 3000; | |
if(process.env.NODE_ENV == 'production'){ | |
listenOn = "tmp/socket"; | |
} | |
var startServer = function(){ | |
app.listen(listenOn, undefined, undefined, function(){ | |
console.log("Listening on " + listenOn); | |
if(typeof(listenOn) == 'string'){ | |
fs.chmod(listenOn, 0777); |
<?php | |
// php setup | |
error_reporting(E_ALL); | |
ini_set('display_errors', 'On'); | |
date_default_timezone_set('America/Los_Angeles'); | |
// | |
// grab input data | |
if (isset($_GET['max'])){ | |
$max=$_GET['max']; |
<?php | |
/** | |
* Application driver class to initialize Phalcon and | |
* other resources. | |
*/ | |
class Application extends \Phalcon\Mvc\Application | |
{ | |
private static $mode = 'development'; // TODO change default to production | |
private static $modules = array( | |
'portal' => array( |
#!/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 |
//Adds $.xhr and jQuery-like $.ajax methods to the prescribed namespace. | |
//Inspired from David Flanagans excellent cross-platform utils http://www.davidflanagan.com/javascript5/display.php?n=20-1&f=20/01.js | |
//Includes underscore.js _.each and _.extend methods | |
//modified to behave like jQuery's $.ajax(), not complete. | |
(function($) { | |
var win=window, xhrs = [ | |
function () { return new XMLHttpRequest(); }, | |
function () { return new ActiveXObject("Microsoft.XMLHTTP"); }, | |
function () { return new ActiveXObject("MSXML2.XMLHTTP.3.0"); }, | |
function () { return new ActiveXObject("MSXML2.XMLHTTP"); } |