working on it ...

Filters

Explore Public Snippets

Sort by

Found 4,263 snippets matching: compile

    public by snip2codealeksey  164073  0  3  0

    Compile nginx

    Compile nginx: compile-nginx.sh
    # Install dependencies
    # 
    # * checkinstall: package the .deb
    # * libpcre3, libpcre3-dev: required for HTTP rewrite module
    # * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
    apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
    
    mkdir -p ~/sources/ && \
    
    # Compile against OpenSSL to enable NPN
    cd ~/sources && \
    wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz && \
    tar -xzvf openssl-1.0.1g.tar.gz && \
    
    # Download the Cache Purge module
    cd ~/sources/ && \
    git clone https://github.com/FRiCKLE/ngx_cache_purge.git && \
    cd ~/sources && \
    
    # Download PageSpeed
    cd ~/sources && \
    wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.7.30.4-beta.zip && \
    unzip v1.7.30.4-beta.zip && \
    cd ngx_pagespeed-1.7.30.4-beta && \
    wget https://dl.google.com/dl/page-speed/psol/1.7.30.4.tar.gz && \
    tar -xzvf 1.7.30.4.tar.gz && \
    
    # Get the Nginx source.
    #
    # Best to get the latest mainline release. Of course, your mileage may
    # vary depending on future changes
    cd ~/sources/ && \
    wget http://nginx.org/download/nginx-1.5.12.tar.gz && \
    tar zxf nginx-1.5.12.tar.gz && \
    cd nginx-1.5.12 && \
    
    # Configure nginx.
    #
    # This is based on the default package in Debian. Additional flags have
    # been added:
    #
    # * --with-debug: adds helpful logs for debugging
    # * --with-openssl=$HOME/sources/openssl-1.0.1e: compile against newer version
    #   of openssl
    # * --with-http_spdy_module: include the SPDY module
    ./configure --prefix=/etc/nginx \
    --sbin-path=/usr/sbin/nginx \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --pid-path=/var/run/nginx.pid \
    --lock-path=/var/run/nginx.lock \
    --http-client-body-temp-path=/var/cache/nginx/client_temp \
    --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
    --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
    --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
    --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
    --user=www-data \
    --group=www-data \
    --with-http_ssl_module \
    --with-http_realip_module \
    --with-http_addition_module \
    --with-http_sub_module \
    --with-http_dav_module \
    --with-http_flv_module \
    --with-http_mp4_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_random_index_module \
    --with-http_secure_link_module \
    --with-http_stub_status_module \
    --with-mail \
    --with-mail_ssl_module \
    --with-file-aio \
    --with-http_spdy_module \
    --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' \
    --with-ld-opt='-Wl,-z,relro -Wl,--as-needed' \
    --with-ipv6 \
    --with-debug \
    --with-openssl=$HOME/sources/openssl-1.0.1g \
    --add-module=$HOME/sources/ngx_pagespeed-1.7.30.4-beta \
    --add-module=$HOME/sources/ngx_cache_purge && \
    
    # Make the package.
    make && \
    
    # Create a .deb package.
    #
    # Instead of running `make install`, create a .deb and install from there. This
    # allows you to easily uninstall the package if there are issues.
    checkinstall --install=no -y && \
    
    # Install the package.
    dpkg -i nginx_1.5.12-1_amd64.deb
    
    

    public by Github  76038  0  3  0

    Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#version=soljson-latest.js&optimize=undefined&gist=

    Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#version=soljson-latest.js&optimize=undefined&gist=: Untitled
    contract Ballot {
    
        struct Voter {
            uint weight;
            bool voted;
            uint8 vote;
            address delegate;
        }
        struct Proposal {
            uint voteCount;
        }
    
        address chairperson;
        mapping(address => Voter) voters;
        Proposal[] proposals;
    
        // Create a new ballot with $(_numProposals) different proposals.
        function Ballot(uint8 _numProposals) {
            chairperson = msg.sender;
            voters[chairperson].weight = 1;
            proposals.length = _numProposals;
        }
    
        // Give $(voter) the right to vote on this ballot.
        // May only be called by $(chairperson).
        function giveRightToVote(address voter) {
            if (msg.sender != chairperson || voters[voter].voted) return;
            voters[voter].weight = 1;
        }
    
        // Delegate your vote to the voter $(to).
        function delegate(address to) {
            Voter sender = voters[msg.sender]; // assigns reference
            if (sender.voted) return;
            while (voters[to].delegate != address(0) && voters[to].delegate != msg.sender)
                to = voters[to].delegate;
            if (to == msg.sender) return;
            sender.voted = true;
            sender.delegate = to;
            Voter delegate = voters[to];
            if (delegate.voted)
                proposals[delegate.vote].voteCount += sender.weight;
            else
                delegate.weight += sender.weight;
        }
    
        // Give a single vote to proposal $(proposal).
        function vote(uint8 proposal) {
            Voter sender = voters[msg.sender];
            if (sender.voted || proposal >= proposals.length) return;
            sender.voted = true;
            sender.vote = proposal;
            proposals[proposal].voteCount += sender.weight;
        }
    
        function winningProposal() constant returns (uint8 winningProposal) {
            uint256 winningVoteCount = 0;
            for (uint8 proposal = 0; proposal < proposals.length; proposal++)
                if (proposals[proposal].voteCount > winningVoteCount) {
                    winningVoteCount = proposals[proposal].voteCount;
                    winningProposal = proposal;
                }
        }
    }
    
    
    

    public by lbottaro  3427  2  7  1

    Regular Expression In Python - Simple Grouping

    This python code shows how to define a regular expression path and have it applied to some string. The regex is defined using the compile built-in method of re library. In the following example some groups are used to parse information from filename strings listed by 'ls' linux command. Exception will raise if no match will be found.
    import os, re
    
    # Assume to have some file names listed
    # The matching path is: <id>_<name>_<code>.txt
    
    # Define regex 
    my_regExp = re.compile(r'(?P<id>^[^_]*)_(?P<name>[^.]*)_(?P<code>[^.]*).txt')
    
    for myFile in os.popen('ls -F /some/path').readlines():
        id= ''
        name= ''
        code= ''
        try:
               id= my_regExp.match(myFile).group('id')
        except:
               msgErr='Error on id - ' + myFile
        try:
               name= my_regExp.match(myFile).group('name')
        except:
               msgErr='Error on name - ' + myFile
        try:
               code= my_regExp.match(myFile).group('code')
        except:
               msgErr='Error on code- ' + myFile
    
            

    public by Geometry  1638  1  6  0

    To: Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.

    Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime. The destination type. The value to be converted. The result of the conversion.
    /// <summary>
    ///   Converts an object into another type, irrespective of whether
    ///   the conversion can be done at compile time or not. This can be
    ///   used to convert generic types to numeric types during runtime.
    /// </summary>
    /// 
    /// <typeparam name="T">The destination type.</typeparam>
    /// 
    /// <param name="value">The value to be converted.</param>
    /// 
    /// <returns>The result of the conversion.</returns>
    /// 
    public static T To<T>(this object value)
    {
        if (value is IConvertible)
            return (T)System.Convert.ChangeType(value, typeof(T));
    
        Type type = value.GetType();
        MethodInfo[] methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static);
        foreach (var m in methods)
        {
            if ((m.Name == "op_Implicit" || m.Name == "op_Explicit") && m.ReturnType == typeof(T))
                return (T)m.Invoke(null, new[] { value });
        }
    
        return (T)System.Convert.ChangeType(value, typeof(T));
    }

    public by teppeis  1287  1  4  0

    Mimimal code to compile TypeScript string (from https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API)

    Mimimal code to compile TypeScript string (from https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API): gistfile1.ts
    /// <reference path="typings/node/node.d.ts" />
    /// <reference path="typings/typescript/typescript.d.ts" />
    
    import ts = require("typescript");
    import fs = require("fs");
    import path = require("path");
    
    function transform(contents: string, libSource: string, compilerOptions: ts.CompilerOptions = {}) {
        // Generated outputs
        var outputs = [];
        // Create a compilerHost object to allow the compiler to read and write files
        var compilerHost = {
            getSourceFile: function (filename, languageVersion) {
                if (filename === "file.ts")
                    return ts.createSourceFile(filename, contents, compilerOptions.target, "0");
                if (filename === "lib.d.ts")
                    return ts.createSourceFile(filename, libSource, compilerOptions.target, "0");
                return undefined;
            },
            writeFile: function (name, text, writeByteOrderMark) {
                outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark });
            },
            getDefaultLibFilename: function () { return "lib.d.ts"; },
            useCaseSensitiveFileNames: function () { return false; },
            getCanonicalFileName: function (filename) { return filename; },
            getCurrentDirectory: function () { return ""; },
            getNewLine: function () { return "\n"; }
        };
        // Create a program from inputs
        var program = ts.createProgram(["file.ts"], compilerOptions, compilerHost);
        // Query for early errors
        var errors = program.getDiagnostics();
        // Do not generate code in the presence of early errors
        if (!errors.length) {
            // Type check and get semantic errors
            var checker = program.getTypeChecker(true);
            errors = checker.getDiagnostics();
            // Generate output
            checker.emitFiles();
        }
        return {
            outputs: outputs,
            errors: errors.map(function (e) { return e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; })
        };
    }
    
    // Calling our transform function using a simple TypeScript variable declarations, 
    // and loading the default library like:
    var source = "var x: number  = 'string'";
    var libSource = fs.readFileSync(path.join(path.dirname(require.resolve('typescript')), 'lib.d.ts')).toString();
    var result = transform(source, libSource);
    
    console.log(JSON.stringify(result));
    
    

    public by Github  1107  0  4  0

    Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=0.3.6&optimize=true&gist=

    Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=0.3.6&optimize=true&gist=: GasTest
    contract GasTest {
            
        struct S {
            uint value;
        }
            
        S s;
            
        function GasTest() {
            s = S(1);
        }
            
        function test1() returns (uint) {
            s.value += 1;
            return s.value;
        }
            
        function test2() returns (uint) {
            S r = s;
            r.value += 1;
            return s.value;
        }
            
        function test3() returns (uint) {
            S storage r = s;
            r.value += 1;
            return s.value;
        }
            
        function test4() returns (uint) {
            S memory r = s;
            r.value += 1;
            return s.value;
        }
    }
    
    
    

    public by Github  961  1  3  0

    Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#version=undefined&optimize=undefined&gist=

    Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#version=undefined&optimize=undefined&gist=: Token Standard
    contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
    
        contract MyToken { 
            /* Public variables of the token */
            string public name;
            string public symbol;
            uint8 public decimals;
    
            /* This creates an array with all balances */
            mapping (address => uint256) public balanceOf;
            mapping (address => mapping (address => uint)) public allowance;
            mapping (address => mapping (address => uint)) public spentAllowance;
    
            /* This generates a public event on the blockchain that will notify clients */
            event Transfer(address indexed from, address indexed to, uint256 value);
    
            /* Initializes contract with initial supply tokens to the creator of the contract */
            function MyToken(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol) {
                balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens                    
                name = tokenName;                                   // Set the name for display purposes     
                symbol = tokenSymbol;                               // Set the symbol for display purposes    
                decimals = decimalUnits;                            // Amount of decimals for display purposes        
            }
    
            /* Send coins */
            function transfer(address _to, uint256 _value) {
                if (balanceOf[msg.sender] < _value) throw;           // Check if the sender has enough   
                if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
                balanceOf[msg.sender] -= _value;                     // Subtract from the sender
                balanceOf[_to] += _value;                            // Add the same to the recipient            
                Transfer(msg.sender, _to, _value);                   // Notify anyone listening that this transfer took place
            }
    
            /* Allow another contract to spend some tokens in your behalf */
    
            function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
                allowance[msg.sender][_spender] = _value;     
                tokenRecipient spender = tokenRecipient(_spender);
                spender.receiveApproval(msg.sender, _value, this, _extraData);  
            }
    
            /* A contract attempts to get the coins */
    
            function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
                if (balanceOf[_from] < _value) throw;                 // Check if the sender has enough   
                if (balanceOf[_to] + _value < balanceOf[_to]) throw;  // Check for overflows
                if (spentAllowance[_from][msg.sender] + _value > allowance[_from][msg.sender]) throw;   // Check allowance
                balanceOf[_from] -= _value;                          // Subtract from the sender
                balanceOf[_to] += _value;                            // Add the same to the recipient            
                spentAllowance[_from][msg.sender] += _value;
                Transfer(msg.sender, _to, _value); 
            } 
    
            /* This unnamed function is called whenever someone tries to send ether to it */
            function () {
                throw;     // Prevents accidental sending of ether
            }        
        } 
    
    

    public by Teppei Sato  287  0  3  0

    Closure Compiler Help (v20160201)

    Closure Compiler Help (v20160201): closure-compiler-help.txt
    --angular_pass                         : Generate $inject properties for
                                             AngularJS for functions annotated
                                             with @ngInject
    --assume_function_wrapper              : Enable additional optimizations based
                                             on the assumption that the output
                                             will be wrapped with a function
                                             wrapper.  This flag is used to
                                             indicate that "global" declarations
                                             will not actually be global but
                                             instead isolated to the compilation
                                             unit. This enables additional
                                             optimizations.
    --charset VAL                          : Input and output charset for all
                                             files. By default, we accept UTF-8 as
                                             input and output US_ASCII
    --checks-only                          : Don't generate output. Run checks,
                                             but no compiler passes.
    --closure_entry_point VAL              : Deprecated: use --entry_point.
    --common_js_entry_module VAL           : Deprecated: use --entry_point.
    --common_js_module_path_prefix VAL     : Deprecated: use --js_module_root.
    --compilation_level (-O) VAL           : Specifies the compilation level to
                                             use. Options: WHITESPACE_ONLY,
                                             SIMPLE, ADVANCED
    --conformance_configs VAL              : A list of JS Conformance configuration
                                             s in text protocol buffer format.
    --create_renaming_reports              : If true, variable renaming and
                                             property renaming report files will
                                             be produced as {binary name}_vars_rena
                                             ming_report.out and {binary name}_prop
                                             s_renaming_report.out. Note that this
                                             flag cannot be used in conjunction
                                             with either variable_renaming_report
                                             or property_renaming_report
    --create_source_map VAL                : If specified, a source map file
                                             mapping the generated source files
                                             back to the original source file will
                                             be output to the specified path. The
                                             %outname% placeholder will expand to
                                             the name of the output file that the
                                             source map corresponds to.
    --dart_pass                            : Rewrite Dart Dev Compiler output to
                                             be compiler-friendly.
    --debug                                : Enable debugging options
    --define (--D, -D) VAL                 : Override the value of a variable
                                             annotated @define. The format is
                                             <name>[=<val>], where <name> is the
                                             name of a @define variable and <val>
                                             is a boolean, number, or a single-quot
                                             ed string that contains no single
                                             quotes. If [=<val>] is omitted, the
                                             variable is marked true
    --dependency_mode [NONE | LOOSE |      : Specifies how the compiler should
    STRICT]                                : determine the set and order of files
                                             for a compilation. Options: NONE the
                                             compiler will include all src files
                                             in the order listed, STRICT files
                                             will be included and sorted by
                                             starting from namespaces or files
                                             listed by the --entry_point flag -
                                             files will only be included if they
                                             are referenced by a goog.require or
                                             CommonJS require or ES6 import, LOOSE
                                             same as with STRICT but files which
                                             do not goog.provide a namespace and
                                             are not modules will be automatically
                                             added as --entry_point entries.
                                             Defaults to NONE.
    --entry_point VAL                      : A file or namespace to use as the
                                             starting point for determining which
                                             src files to include in the compilatio
                                             n. ES6 and CommonJS modules are
                                             specified as file paths (without the
                                             extension). Closure-library namespaces
                                             are specified with a "goog:" prefix.
                                             Example: --entry_point=goog:goog.Promi
                                             se
    --env [BROWSER | CUSTOM]               : Determines the set of builtin externs
                                             to load. Options: BROWSER, CUSTOM.
                                             Defaults to BROWSER.
    --export_local_property_definitions    : Generates export code for local
                                             properties marked with @export
    --externs VAL                          : The file containing JavaScript
                                             externs. You may specify multiple
    --extra_annotation_name VAL            : A whitelist of tag names in JSDoc.
                                             You may specify multiple
    --flagfile VAL                         : A file containing additional command-l
                                             ine options.
    --formatting [PRETTY_PRINT | PRINT_INP : Specifies which formatting options,
    UT_DELIMITER | SINGLE_QUOTES]          : if any, should be applied to the
                                             output JS. Options: PRETTY_PRINT,
                                             PRINT_INPUT_DELIMITER, SINGLE_QUOTES
    --generate_exports                     : Generates export code for those
                                             marked with @export
    --help                                 : Displays this message on stdout and
                                             exit
    --hide_warnings_for VAL                : If specified, files whose path
                                             contains this string will have their
                                             warnings hidden. You may specify
                                             multiple.
    --instrumentation_template VAL         : A file containing an instrumentation
                                             template.
    --j2cl_pass                            : Rewrite J2CL output to be compiler-fri
                                             endly.
    --js VAL                               : The JavaScript filename. You may
                                             specify multiple. The flag name is
                                             optional, because args are interpreted
                                             as files by default. You may also use
                                             minimatch-style glob patterns. For
                                             example, use --js='**.js' --js='!**_te
                                             st.js' to recursively include all js
                                             files that do not end in _test.js
    --js_module_root VAL                   : Path prefixes to be removed from ES6
                                             & CommonJS modules.
    --js_output_file VAL                   : Primary output filename. If not
                                             specified, output is written to stdout
    --jscomp_error VAL                     : Make the named class of warnings an
                                             error. Options:accessControls,
                                             ambiguousFunctionDecl, checkEventfulOb
                                             jectDisposal, checkRegExp, checkTypes,
                                             checkVars, conformanceViolations,
                                             const, constantProperty, deprecated,
                                             deprecatedAnnotations, duplicateMessag
                                             e, es3, es5Strict, externsValidation,
                                             fileoverviewTags, globalThis,
                                             internetExplorerChecks, invalidCasts,
                                             misplacedTypeAnnotation, missingGetCss
                                             Name, missingProperties, missingProvid
                                             e, missingRequire, missingReturn,
                                             msgDescriptions, newCheckTypes,
                                             nonStandardJsDocs, reportUnknownTypes,
                                             suspiciousCode, strictModuleDepCheck,
                                             typeInvalidation, undefinedNames,
                                             undefinedVars, unknownDefines,
                                             unnecessaryCasts, unusedLocalVariables
                                             , unusedPrivateMembers, uselessCode,
                                             useOfGoogBase, visibility. '*' adds
                                             all supported.
    --jscomp_off VAL                       : Turn off the named class of warnings.
                                             Options:accessControls, ambiguousFunct
                                             ionDecl, checkEventfulObjectDisposal,
                                             checkRegExp, checkTypes, checkVars,
                                             conformanceViolations, const,
                                             constantProperty, deprecated,
                                             deprecatedAnnotations, duplicateMessag
                                             e, es3, es5Strict, externsValidation,
                                             fileoverviewTags, globalThis,
                                             internetExplorerChecks, invalidCasts,
                                             misplacedTypeAnnotation, missingGetCss
                                             Name, missingProperties, missingProvid
                                             e, missingRequire, missingReturn,
                                             msgDescriptions, newCheckTypes,
                                             nonStandardJsDocs, reportUnknownTypes,
                                             suspiciousCode, strictModuleDepCheck,
                                             typeInvalidation, undefinedNames,
                                             undefinedVars, unknownDefines,
                                             unnecessaryCasts, unusedLocalVariables
                                             , unusedPrivateMembers, uselessCode,
                                             useOfGoogBase, visibility. '*' adds
                                             all supported.
    --jscomp_warning VAL                   : Make the named class of warnings a
                                             normal warning. Options:accessControls
                                             , ambiguousFunctionDecl, checkEventful
                                             ObjectDisposal, checkRegExp, checkType
                                             s, checkVars, conformanceViolations,
                                             const, constantProperty, deprecated,
                                             deprecatedAnnotations, duplicateMessag
                                             e, es3, es5Strict, externsValidation,
                                             fileoverviewTags, globalThis,
                                             internetExplorerChecks, invalidCasts,
                                             misplacedTypeAnnotation, missingGetCss
                                             Name, missingProperties, missingProvid
                                             e, missingRequire, missingReturn,
                                             msgDescriptions, newCheckTypes,
                                             nonStandardJsDocs, reportUnknownTypes,
                                             suspiciousCode, strictModuleDepCheck,
                                             typeInvalidation, undefinedNames,
                                             undefinedVars, unknownDefines,
                                             unnecessaryCasts, unusedLocalVariables
                                             , unusedPrivateMembers, uselessCode,
                                             useOfGoogBase, visibility. '*' adds
                                             all supported.
    --json_streams [NONE | IN | OUT |      : Specifies whether standard input and
    BOTH]                                  : output streams will be a JSON array
                                             of sources. Each source will be an
                                             object of the form {path: filename,
                                             src: file_contents, srcmap: srcmap_con
                                             tents }. Intended for use by stream-ba
                                             sed build systems such as gulpjs.
                                             Options: NONE, IN, OUT, BOTH.
                                             Defaults to NONE.
    --jszip VAL                            : The JavaScript zip filename. You may
                                             specify multiple.
    --language_in VAL                      : Sets what language spec that input
                                             sources conform. Options: ECMASCRIPT3,
                                             ECMASCRIPT5, ECMASCRIPT5_STRICT,
                                             ECMASCRIPT6 (default), ECMASCRIPT6_STR
                                             ICT, ECMASCRIPT6_TYPED (experimental)
    --language_out VAL                     : Sets what language spec the output
                                             should conform to. Options: ECMASCRIPT
                                             3 (default), ECMASCRIPT5, ECMASCRIPT5_
                                             STRICT, ECMASCRIPT6_TYPED (experimenta
                                             l)
    --logging_level VAL                    : The logging level (standard java.util.
                                             logging.Level values) for Compiler
                                             progress. Does not control errors or
                                             warnings for the JavaScript code
                                             under compilation
    --manage_closure_dependencies          : Deprecated: use --dependency_mode=LOOS
                                             E.
    --module VAL                           : A JavaScript module specification.
                                             The format is <name>:<num-js-files>[:[
                                             <dep>,...][:]]]. Module names must be
                                             unique. Each dep is the name of a
                                             module that this module depends on.
                                             Modules must be listed in dependency
                                             order, and JS source files must be
                                             listed in the corresponding order.
                                             Where --module flags occur in
                                             relation to --js flags is unimportant.
                                             <num-js-files> may be set to 'auto'
                                             for the first module if it has no
                                             dependencies. Provide the value
                                             'auto' to trigger module creation
                                             from CommonJSmodules.
    --module_output_path_prefix VAL        : Prefix for filenames of compiled JS
                                             modules. <module-name>.js will be
                                             appended to this prefix. Directories
                                             will be created as needed. Use with
                                             --module
    --module_wrapper VAL                   : An output wrapper for a JavaScript
                                             module (optional). The format is
                                             <name>:<wrapper>. The module name
                                             must correspond with a module
                                             specified using --module. The wrapper
                                             must contain %s as the code placeholde
                                             r. The %basename% placeholder can
                                             also be used to substitute the base
                                             name of the module output file.
    --new_type_inf                         : Checks for type errors using the new
                                             type inference algorithm.
    --noinject_library VAL                 : Prevent injecting the named runtime
                                             libraries.
    --only_closure_dependencies            : Deprecated: use --dependency_mode=STRI
                                             CT.
    --output_manifest VAL                  : Prints out a list of all the files in
                                             the compilation. If --dependency_mode=
                                             STRICT or LOOSE is specified, this
                                             will not include files that got
                                             dropped because they were not
                                             required. The %outname% placeholder
                                             expands to the JS output file. If
                                             you're using modularization, using
                                             %outname% will create a manifest for
                                             each module.
    --output_module_dependencies VAL       : Prints out a JSON file of dependencies
                                             between modules.
    --output_wrapper VAL                   : Interpolate output into this string
                                             at the place denoted by the marker
                                             token %output%. Use marker token
                                             %output|jsstring% to do js string
                                             escaping on the output.
    --output_wrapper_file VAL              : Loads the specified file and passes
                                             the file contents to the --output_wrap
                                             per flag, replacing the value if it
                                             exists.
    --polymer_pass                         : Rewrite Polymer classes to be
                                             compiler-friendly.
    --preserve_type_annotations            : Preserves type annotations.
    --print_ast                            : Prints a dot file describing the
                                             internal abstract syntax tree and
                                             exits
    --print_pass_graph                     : Prints a dot file describing the
                                             passes that will get run and exits
    --print_tree                           : Prints out the parse tree and exits
    --process_closure_primitives           : Processes built-ins from the Closure
                                             library, such as goog.require(),
                                             goog.provide(), and goog.exportSymbol(
                                             ). True by default.
    --process_common_js_modules            : Process CommonJS modules to a
                                             concatenable form.
    --process_jquery_primitives            : Processes built-ins from the Jquery
                                             library, such as jQuery.fn and
                                             jQuery.extend()
    --property_renaming_report VAL         : File where the serialized version of
                                             the property renaming map produced
                                             should be saved
    --rename_prefix_namespace VAL          : Specifies the name of an object that
                                             will be used to store all non-extern
                                             globals
    --source_map_format [DEFAULT | V3]     : The source map format to produce.
                                             Options are V3 and DEFAULT, which are
                                             equivalent.
    --source_map_input VAL                 : Source map locations for input files,
                                             separated by a '|', (i.e. input-file-p
                                             ath|input-source-map)
    --source_map_location_mapping VAL      : Source map location mapping separated
                                             by a '|' (i.e. filesystem-path|webserv
                                             er-path)
    --summary_detail_level N               : Controls how detailed the compilation
                                             summary is. Values: 0 (never print
                                             summary), 1 (print summary only if
                                             there are errors or warnings), 2
                                             (print summary if the 'checkTypes'
                                             diagnostic  group is enabled, see
                                             --jscomp_warning), 3 (always print
                                             summary). The default level is 1
    --third_party                          : Check source validity but do not
                                             enforce Closure style rules and
                                             conventions
    --tracer_mode [ALL | RAW_SIZE |        : Shows the duration of each compiler
    TIMING_ONLY | OFF]                     : pass and the impact to the compiled
                                             output size. Options: ALL, RAW_SIZE,
                                             TIMING_ONLY, OFF
    --transform_amd_modules                : Transform AMD to CommonJS modules.
    --translations_file VAL                : Source of translated messages.
                                             Currently only supports XTB.
    --translations_project VAL             : Scopes all translations to the
                                             specified project.When specified, we
                                             will use different message ids so
                                             that messages in different projects
                                             can have different translations.
    --use_types_for_optimization           : Enable or disable the optimizations
                                             based on available type information.
                                             Inaccurate type annotations may
                                             result in incorrect results.
    --variable_renaming_report VAL         : File where the serialized version of
                                             the variable renaming map produced
                                             should be saved
    --version                              : Prints the compiler version to stdout
                                             and exit.
    --warning_level (-W) [QUIET | DEFAULT  : Specifies the warning level to use.
    | VERBOSE]                             : Options: QUIET, DEFAULT, VERBOSE
    --warnings_whitelist_file VAL          : A file containing warnings to
                                             suppress. Each line should be of the
                                             form
                                             <file-name>:<line-number>?  <warning-d
                                             escription>
    
    
    

    public by teppeis  160  0  2  0

    Fibonacci with TCO https://google.github.io/traceur-compiler/demo/repl.html

    Fibonacci with TCO https://google.github.io/traceur-compiler/demo/repl.html: fib.js
    // Options: --proper-tail-calls 
    
    "use strict";
    
    var cache = {};
    function fib(n) {
      return fib_(n, _ => _);
    }
    function fib_(n, callback) {
      if (n === 0) return callback(0);
      if (n === 1) return callback(1);
      if (cache[n]) return callback(cache[n]);
      return fib_(n - 1, p1 => fib_(n - 2, p2 => callback(cache[n] = p1 + p2)));
    }
    
    console.log(fib(10000));
    
    

    public by teppeis  142  0  2  0

    Closure Compiler failure list for es6-table

    Closure Compiler failure list for es6-table: gistfile1.md
    based on [v20141023 result](https://github.com/teppeis/closure-compiler-es6-compat-table/tree/master/result)
    
    #### arrow functions: no line break between params and `=>`
    input
    ```javascript
    module.exports = function() {
        var f = x
            => 2;
        return f();
    };
    ```
    generated
    ```javascript
    module.exports = function() {
      return 2;
    };
    ```
    expected: should be compile error
    
    #### arrow functions: no "prototype" and "name" properties
    input
    ```javascript
    module.exports = function() {
            var a = () => 5;
            return !a.hasOwnProperty("prototype") && a.name === ""; 
    };
    ```
    generated
    ```javascript
    module.exports = function() {
      var a = function() {
        return 5;
      };
      return!a.hasOwnProperty("prototype") && "" === a.name;
    };
    ```
    expected: arrow functions should have no "prototype" and "name" properties
    
    #### const: temporal dead zone
    input
    ```javascript
    module.exports = function() {
            var passed = (function(){ try { qux; } catch(e) { return true; }}());
            const qux = 456;
            return passed;      
    };
    ```
    generated
    ```javascript
    module.exports = function() {
      var a;
      a: {
        try {
          456;
        } catch (b) {
          a = !0; 
          break a;
        }
        a = void 0;
      }
      return a;
    };
    ```
    compile log
    ```
    WARNING - Suspicious code. This code lacks side-effects. Is there a bug?
            var passed = (function(){ try { qux; } catch(e) { return true; }}());
                                            ^
    
    0 error(s), 1 warning(s)
    ```
    actual: generated code returns undefined  
    expected: should catch an error and return true
    
    #### const: temporal dead zone (strict mode)
    input
    ```javascript
    module.exports = function() {
            'use strict';
            var passed = (function(){ try { qux; } catch(e) { return true; }}());
            const qux = 456;
            return passed;
    };
    ```
    same as "const: temporal dead zone"
    #### let: temporal dead zone
    input
    ```javascript
    module.exports = function() {
            var passed = (function(){ try {  qux; } catch(e) { return true; }}());
            let qux = 456;
            return passed;
    };
    ```
    same as "const: temporal dead zone"
    
    #### let: temporal dead zone (strict mode)
    input
    ```javascript
    module.exports = function() {
            'use strict';
            var passed = (function(){ try {  qux; } catch(e) { return true; }}());
            let qux = 456;
            return passed;
    };
    ```
    same as "const: temporal dead zone"
    
    #### default function parameters: temporal dead zone1
    input 1
    ```javascript
    module.exports = function() {
        (function(a=a){}());
        return false;
    };
    ```
    generated 1
    ```javascript
    module.exports = function() {
      return!1;
    };
    ```
    input 2
    ```javascript
    module.exports = function() {
        (function(a=b,b){}());
        return false;
    };
    ```
    generated 2
    ```javascript
    module.exports = function() {
      return!1;
    };
    ```
    input 3
    ```javascript
    module.exports = function() {
        (function(a=function(){ return b; }){ var b = 1;}());
        return false;
    };
    ```
    generated 3
    ```javascript
    module.exports = function() {
      return!1;
    };
    ```
    expected: all should be error
    
    #### spread (...) operator: with strings, in function calls
    input
    ```javascript
    module.exports = function() {
    
           return Math.max(..."1234") === 4;
          
    };
    ```
    generated
    ```javascript
    module.exports = function() {
      return 4 === Math.max.apply(Math, [].concat("1234"));
    };
    ```
    
    #### spread (...) operator: with strings, in array literals
    input
    ```javascript
    module.exports = function() {
    
           return ["a", ..."bcd", "e"][3] === "d";
        
    };
    ```
    generated
    ```javascript
    module.exports = function() {
      return "d" === [].concat(["a"], "bcd", ["e"])[3];
    };
    ```
    ### super
    input
    ```javascript
    module.exports = function() {
    
        var passed = true;
        var B = class extends class {
          constructor(a) { return this.id + a; }
          foo(a)         { return a + this.id; }
        } {
          constructor(a) {
            this.id = 'AB';
            // "super" in the constructor calls
            // the superclass's constructor on "this".
            passed &= super(a)     === 'ABCD';
            // "super" can be also used to call
            // superclass methods on "this".
            passed &= super.foo(a) === 'CDAB';
          }
          foo(a) {
            passed &= super.foo(a) === 'YZEF';
          }
        }
        var b = new B("CD");
        // "super" is bound statically, even though "this" isn't
        var obj = { foo: b.foo, id:"EF" };
        obj.foo("YZ");
        return passed;
      
    };
    ```
    compile log
    ```
    ERROR - The super keyword may only appear in classes with an extends clause.
        var B = class extends class {
                ^
    
    1 error(s), 0 warning(s)
    java.lang.RuntimeException: INTERNAL COMPILER ERROR.
    Please report this problem.
    
    INTERNAL COMPILER ERROR.
    Please report this problem.
    
    null
      Node(ASSIGN): ./build/42/in.js:10:8
            this.id = 'AB';
      Parent(EXPR_RESULT): ./build/42/in.js:10:8
            this.id = 'AB';
    
      Node(CLASS): ./build/42/in.js:5:26
        var B = class extends class {
      Parent(CLASS): ./build/42/in.js:5:12
        var B = class extends class {
    
    	at com.google.javascript.jscomp.Es6ToEs3Converter$CheckClassAssignments.visit(Es6ToEs3Converter.java:1096)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:587)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBlockScope(NodeTraversal.java:630)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:575)
    	at com.google.javascript.jscomp.NodeTraversal.traverseFunction(NodeTraversal.java:621)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:572)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBlockScope(NodeTraversal.java:630)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:575)
    	at com.google.javascript.jscomp.NodeTraversal.traverseFunction(NodeTraversal.java:621)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:572)
    	at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:289)
    	at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:538)
    	at com.google.javascript.jscomp.Es6ToEs3Converter.checkClassReassignment(Es6ToEs3Converter.java:470)
    	at com.google.javascript.jscomp.Es6ToEs3Converter.visitClass(Es6ToEs3Converter.java:742)
    	at com.google.javascript.jscomp.Es6ToEs3Converter.visit(Es6ToEs3Converter.java:165)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:587)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBlockScope(NodeTraversal.java:630)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:575)
    	at com.google.javascript.jscomp.NodeTraversal.traverseFunction(NodeTraversal.java:621)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:572)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:581)
    	at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:289)
    	at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:538)
    	at com.google.javascript.jscomp.Es6ToEs3Converter.process(Es6ToEs3Converter.java:90)
    	at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:285)
    	at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:217)
    	at com.google.javascript.jscomp.Compiler.check(Compiler.java:849)
    	at com.google.javascript.jscomp.Compiler.compileInternal(Compiler.java:762)
    	at com.google.javascript.jscomp.Compiler.access$000(Compiler.java:93)
    	at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:655)
    	at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:652)
    	at com.google.javascript.jscomp.Compiler$4.call(Compiler.java:699)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.RuntimeException: INTERNAL COMPILER ERROR.
    Please report this problem.
    
    null
      Node(ASSIGN): ./build/42/in.js:10:8
            this.id = 'AB';
      Parent(EXPR_RESULT): ./build/42/in.js:10:8
            this.id = 'AB';
    
    	... 48 more
    Caused by: java.lang.NullPointerException
    	... 48 more
    ```
    
    
    • Public Snippets
    • Channels Snippets