text:
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.utils import formatdate
from properties import Property
import requests

class smtp(object):
    def __init__(self):
        self.smtp_user = Property.email_login
        self.smtp_password = Property.email_password
        self.smtp_server = Property.email_server
        self.smtp_port = Property.email_port
        self.smtpserver = smtplib.SMTP(self.smtp_server, self.smtp_port)

    def send(self, to, subject, message_html):

        try:
            msgRoot = MIMEMultipart('related')
            msgRoot['Subject'] = subject
            msgRoot['From'] = Property.email_from
            msgRoot['To'] = to
            msgRoot['Date'] = formatdate(localtime=True)

            msgAlternative = MIMEMultipart('alternative')
            msgRoot.attach(msgAlternative)

            # TODO add plaintext attachment to the email
            # msgText = MIMEText(message_plain, _charset='utf-8')
            # msgAlternative.attach(msgText)

            msgText = MIMEText(message_html, 'html', _charset='utf-8')
            msgAlternative.attach(msgText)

            self.smtpserver.ehlo()
            self.smtpserver.starttls()
            self.smtpserver.ehlo()
            self.smtpserver.login(self.smtp_user, self.smtp_password)
            self.smtpserver.sendmail(self.smtp_user, [to], msgRoot.as_string())
            self.smtpserver.quit()
            return True

        except smtplib.SMTPException:
            return False

class SendGrid(object):
    def __init__(self):
        self.key = Property.sg_api_key

    def send(self, to, subject, message_html):
        data = dict()
        data['to'] = to
        data['toname'] = Property.email_to_name
        data['from'] = Property.email_from
        data['fromname'] = Property.email_from_name
        data['subject'] = subject
        data['html'] = message_html

        session = requests.Session()
        session.headers.update({'Authorization': 'Bearer ' + self.key})
        sg_response = session.post('https://api.sendgrid.com/api/mail.send.json', data)

        if sg_response.json()['message'] == 'success':
            return True
        else:
            return False, sg_response.json()['message']

if __name__ == '__main__':
    # Email = smtp()
    Email = SendGrid()
    test_email = raw_input("What is your email? ")
    message = 'Hello World,\n\tThis is a test!'
    if not Email.send(test_email, 'TEST', message):
        quit("Mail Send Error")
    else:
        print "Message Sent Successfully!"


text:
using Core.WebContent.NHibernate.Models;
using Core.WebContent.NHibernate.Static;
using FluentNHibernate.Mapping;

namespace Core.WebContent.NHibernate.Mappings
{
    public class WebContentWidgetMapping : ClassMap<WebContentWidget>
    {
        public WebContentWidgetMapping()
        {
            Cache.Region("WebContent_WebContentWidgets").ReadWrite();
            Table("WebContent_WebContentWidgets");
            Id(widget => widget.Id);
            Map(widget => widget.ItemsNumber);
            Map(widget => widget.ShowPagination);
            Map(widget => widget.ViewMode).CustomType<WebContentWidgetViewMode>();
            References(widget => widget.Article);
            References(widget => widget.Section);
            HasMany(widget => widget.Categories).KeyColumn("WebContentWidgetId")
            .Table("WebContent_WebContentWidgetCategories").AsSet()
            .Access.ReadOnlyPropertyThroughCamelCaseField(Prefix.None)
            .Inverse()
            .LazyLoad()
            .Cascade.AllDeleteOrphan();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
//----------------------------------------------------------------------------
// Copyright (c) 2012, Codalogic Ltd (http://www.codalogic.com)
// All rights reserved.
//
// The license for this file is based on the BSD-3-Clause license
// (http://www.opensource.org/licenses/BSD-3-Clause).
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// - Redistributions of source code must retain the above copyright notice,
//   this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution.
// - Neither the name Codalogic nor the names of its contributors may be used
//   to endorse or promote products derived from this software without
//   specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//----------------------------------------------------------------------------

//----------------------------------------------------------------------------
// cl::clunit, is a simple C++ unit testing framework.  It's USP is that it
// supports to-do statements so that you can easily record tests that you plan
// to do, but haven't implemented yet.  This allows you to plan ahead, but
// still only work on fixing one test at a time.
//
// A test function is created using the TFEATURE( "A descriptive string" )
// macro.  This represents the beginning of a test function that is
// automagically registered for execution when the tests are initiated.
//
/* For example:

example-test.cpp:
    #include "clunit.h"

    TFEATURE( "Example tests" )         // Register test with descriptive name
    {
        TDOC( "Test description" );     // Add any documentation (anywhere in function)
        TTOC( "Example description" );  // Output table of contents entry to toc file
        TSETUP( int t=1 );              // Do any lines needed to setup a test
        int b=1;                        // Use of TSETUP for test setup is optional
        TTODO( "Need todo this" );      // Log any tests that need to be done
        TTODON( 2, "Need todo this" );  // As above but with a depth indicator (i.e. 2) to help prioritise work
        TTODOX( t == b );               // Log a todo that is compilable but not trying to pass yet
        TTODOXN( 2, t == b );           // A version of TTODOX() with a depth indicator
        TDOC( "More description" );
        TTEST( 1 != 0 );                // Run a test
        TTESTN( 2, 1 != 0 );            // A version of TTEST() to mirror TTODOXN()
        TCRITICALTEST( 1 == 1 );        // Return from function immediately if test fails
        TCRITICALTESTN( 2, 1 == 1 );    // Version of TCRITICALTEST() with depth indicator
        TTESTFAIL( 1 != 0 );            // Fail a test that should pass - to check it's being run
        TTESTNFAIL( 1, 1 != 0 );        // TTESTN variant of TTFAIL()
        TCALL( func( 12, "y", "y" ) );  // Call a test function
    }
*/
// A note can be made of features that need to be tested using the TFEATTODO()
// macros.  These effectively create a test function containing a single
// TTODO() test description macro.
//
/* For example (not in a function):

    TFEATTODO( "Feature Todo" );        // A quick way of recording a feature that needs testing

    TFEATTODON( 2, "Feature N Todo" );  // As above but with a depth indicator
*/
//
// The tests are initiated by calling the TRUNALL(); macro in the test
// program's main() function.  Before doing #include "clunit.h" in the test
// file containing main(), be sure to #define CLUNIT_HOME first.
//
/* For example:

main-test.cpp:
    #define CLUNIT_HOME
    #include "clunit.h"

    int main()
    {
        TRUNALL();  // Run registered tests and print final pass/fail result
    }
*/
//
// By default the test output goes to "clunit.out". If you wish to direct
// the test output to a different file, do:
//       #define CLUNIT_OUT "tout.out"
// or similar.
//----------------------------------------------------------------------------

#ifndef CLUNIT
#define CLUNIT

#include <iostream>
#include <fstream>
#ifdef _MSC_VER
    #include <strstream>
#endif
#include <sstream>
#include <vector>
#include <string>
#include <ctime>
#include <cstring>

#ifdef _MSC_VER
    #include <crtdbg.h>
    extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA( const char * lpOutputString );
    #define TVS_DEBUG_CONSOLE_OUT( x ) OutputDebugStringA( (x).c_str() )
#else
    #define TVS_DEBUG_CONSOLE_OUT( x )
#endif

namespace cl {

#define TCAT( x, y ) TCAT2( x, y )
#define TCAT2( x, y ) x ## y

#define TFEATURE( d ) TFEATURE_IMPL( d, TCAT( test_func_, __LINE__ ) )
#define TFEATURE_IMPL( d, f ) static void f(); TREGISTERD( f, d ); void f()
#define TREGISTERD( f, d ) static cl::clunit f ## _registered_clunit_test( f, d, __FILE__, __LINE__ );
#define TFUNCTION( f ) static void f(); TREGISTER( f ); void f()
#define TREGISTER( f ) static cl::clunit f ## _registered_clunit_test( f );
#define TBEGIN( d ) cl::clunit::tbegin( d, __FILE__, __LINE__ )
#define TTOC( d ) cl::clunit::ttoc( d, __FILE__, __LINE__ )
#define TDOC( d ) cl::clunit::tdoc( d )
#define TSETUP( x ) cl::clunit::tsetup_log( #x ); x
#define TTODO( d ) cl::clunit::ttodo( d, __FILE__, __LINE__ )
#define TTODON( n, d ) cl::clunit::ttodo( "[" #n "] " d, __FILE__, __LINE__ )
#define TTODOX( x ) { cl::clunit::ttodox( #x, (x), __FILE__, __LINE__ ); }
#define TTODOXN( n, x ) { cl::clunit::ttodox( "[" #n "] " #x, (x), __FILE__, __LINE__ ); }
#define TTEST( x ) { cl::clunit::ttest( #x, (x), __FILE__, __LINE__ ); }
#define TTESTN( n, x ) TTEST( x )
#define TTESTFAIL( x ) { cl::clunit::ttestfail( #x, (x), __FILE__, __LINE__ ); }
#define TTESTNFAIL( n, x ) TTESTFAIL( x )
#define TCRITICALTEST( x ) { if( ! cl::clunit::ttest( #x, (x), __FILE__, __LINE__ ) ) return; }
#define TCRITICALTESTN( n, x ) TCRITICALTEST( x )
#define TCALL( x ) { cl::clunit::tcall( #x, __FILE__, __LINE__ ); (x); }
#define TFEATURETODO( d ) TFUNCTION( TCAT( todo_function_, __LINE__ ) ) { TTODO( d ); }
#define TFEATURETODON( n, d ) TFUNCTION( TCAT( todo_function_, __LINE__ ) ) { TTODON( n, d ); }
#define TRUNALL() { cl::clunit::run(); size_t n_errors = cl::clunit::report(); if( n_errors > 255 ) return 255; return n_errors; }

typedef void(*job_func_ptr)();
struct job_description
{
    job_func_ptr job;
    const char * p_description;
    const char * p_file;
    int line;
    job_description( job_func_ptr job_in )
        : job( job_in ), p_description( 0 ), p_file( 0 ), line( 0 )
    {}
    job_description( job_func_ptr job_in, const char * p_description_in,
            const char * p_file_in, int line_in )
        : job( job_in ), p_description( p_description_in ),
            p_file( p_file_in ), line( line_in )
    {}
};
typedef std::vector< job_description > job_list;

class fixed_size_log
{
    // We want to log TODO operations while carrying out tests, but also
    // check for memory leaks.  Therefore memory for logging can't be
    // allocated during the testing process.  Therefore this class allocates
    // a chunk of memory up front and we log into that until it is full.
private:
    std::string log;
    size_t n_items_logged;
    bool is_log_full;

public:
    fixed_size_log( size_t size )
        :
        n_items_logged( 0 ),
        is_log_full( false )
    {
        log.reserve( size );
    }
    void insert( const std::string & new_entry )
    {
        ++n_items_logged;
        if( ! is_log_full )
        {
            if( log.size() + new_entry.size() < log.capacity() )
                log += new_entry;
            else
                is_log_full = true;
        }
    }
    const std::string & get() const { return log; }
    size_t size() const { return n_items_logged; }
    bool empty() const { return  n_items_logged == 0; }
};

class clunit
{
private:
    class singleton
    {
    private:
        bool is_first_tout;
        bool is_new_tout_section;
        bool is_new_print_all_section;
        int n_tests;
        int n_errors;
        int n_forced_fails_invoked;
        int n_forced_fails_occurred;
        bool is_first_ttoc;
        const char * p_current_test_file;
        fixed_size_log todo_log;

        job_list & get_jobs();
        std::ostream & tout();
        std::ostream & ttocout();

    public:
        singleton()
            :
            is_first_tout( true ),
            is_new_tout_section( false ),
            is_new_print_all_section( false ),
            n_tests( 0 ),
            n_errors( 0 ),
            n_forced_fails_invoked( 0 ),
            n_forced_fails_occurred( 0 ),
            is_first_ttoc( true ),
            p_current_test_file( 0 ),
            todo_log( 10000 )
        {}

        void tregister( job_func_ptr job )
        {
            get_jobs().push_back( job_description( job ) );
        }
        void tregister( job_func_ptr job, const char * p_description,
                const char * p_file, int line )
        {
            get_jobs().push_back(
                    job_description( job, p_description, p_file, line ) );
        }
        void tbegin( const char * what, const char * file, int line )
        {
            std::string indent( "    " );
            std::ostringstream documentation;
            documentation << what << " [" << file_base( file ) << ":" << line << "]";
            std::string heading( documentation.str() );
            std::string underline( heading.size(), '=' );
            print_to_all_outputs( indent + heading + "\n" + indent + underline + "\n" );
            ttoc( what, file, line);
        }
        void ttoc( const char * what, const char * file, int line )
        {
            if( ! p_current_test_file || strcmp( p_current_test_file, file ) != 0 )
            {
                ttocout() << "\n";
                ttocout() << "# " << file_base( file ) << "\n";
                ttocout() << "| Description | Line |\n";
                ttocout() << "|-------------|------|\n";
                p_current_test_file = file;
            }
            ttocout() << "| " << what << " | " << line << " |\n";
        }
        void tdoc( const char * what )
        {
            tout() << "      " << what << "\n";
        }
        void tsetup_log( const char * what )
        {
            tout() << "      : " << what << '\n';
        }
        void ttodo( const char * what, const char * file, int line )
        {
            std::ostringstream report;
            report << "- " << what << " [" << file_base( file ) << ":" << line << "]\n";
            todo_log.insert( report.str() );
        }
        void ttodox( const char * what, bool is_passed, const char * file, int line )
        {
            std::ostringstream report;
            report << "- " <<
                    what << ((is_passed)?" (passing)":" (failing)") <<
                    " [" << file_base( file ) << ":" << line << "]\n";
            todo_log.insert( report.str() );
        }
        bool ttest( const char * what, bool is_passed, const char * file, int line )
        {
            std::ostringstream report;
            if( ! is_passed )
            {
                report << "not ";
                ++n_errors;
            }
            else
            {
                report << "    ";
            }
            ++n_tests;
            report << "ok: " << what;
            if( ! is_passed )
                report << " (" << line << ")";
            report << "\n";
            if( is_passed )
                tout() << report.str();
            else
                print_to_all_outputs( report.str() );
            return is_passed;
        }
        bool ttestfail( const char * what, bool is_passed, const char * file, int line )
        {
            ++n_forced_fails_invoked;
            int n_errors_at_beginning = n_errors;
            bool result = ttest( what, ! is_passed, file, line );
            n_forced_fails_occurred += n_errors - n_errors_at_beginning;
            return result;
        }
        void tcall( const char * what, const char * file, int line )
        {
            tout() << "      Calling: " << what << " (" << line << ")" << "\n";
        }
        void run()
        {
            {
            // The iostream (and possibly string) functions dynamically allocate memory
            // -the first time they are called.  They are not cleared until the program
            // -ends.  So that these allocations do not muck up the heap checking stats,
            // -dummy uses of the libraries are made so that they are initialised.  We
            // -can then checkpoint the heap after this point.
            #ifdef _MSC_VER
                std::ostrstream t1;
                t1 << "" << 12;
            #endif
            std::ostringstream t2;
            t2 << "" << 12;
            tout() << "";
            }

            for( job_list::const_iterator job( get_jobs().begin() ), job_end( get_jobs().end() );
                    job != job_end;
                    ++job )
            {
#if defined( _MSC_VER ) && defined( _DEBUG )
                _CrtMemState s1, s2, s3;
                // Store a memory checkpoint in the s1 memory-state structure
                _CrtMemCheckpoint( &s1 );
#endif

                try
                {
                    is_new_tout_section = is_new_print_all_section = true;
                    if( job->p_description )
                        tbegin( job->p_description, job->p_file, job->line );
                    job->job();
                }
                catch(...)
                {
                    TTEST( "Unhandled exception" == NULL );     // Force fail case
                }

#if defined( _MSC_VER ) && defined( _DEBUG )
                // Store a 2nd memory checkpoint in s2
                _CrtMemCheckpoint( &s2 );
                TTEST( ! _CrtMemDifference( &s3, &s1, &s2 ) );
                if ( _CrtMemDifference( &s3, &s1, &s2 ) )
                {
                    _CrtMemDumpStatistics( &s3 );
                    _CrtMemDumpAllObjectsSince( &s1 );
                }
#endif
            }

#if defined( _MSC_VER ) && defined( _DEBUG )
            TTEST( _CrtCheckMemory() != 0 );
#endif
        }
        size_t report()
        {
            if( ! todo_log.empty() )
            {
                std::ostringstream todo_report;
                todo_report <<
                        "\nTODOs (" <<
                        todo_log.size() <<
                        "):\n------------------------\n" <<
                        todo_log.get() <<
                        "\n";
                print_to_all_outputs( todo_report.str() );
            }
            std::ostringstream summary;
            summary <<
                    n_errors << " error(s), " <<
                    todo_log.size() << " todo(s), " <<
                    n_tests << " test(s)\n";
            if( n_forced_fails_invoked > 0 )
                summary <<
                        "FORCED FAILURES: " <<
                            n_forced_fails_invoked << " invoked, " <<
                            n_forced_fails_occurred << " occurred\n";
            print_to_all_outputs( summary.str() );
            return n_errors;
        }
        void print_to_all_outputs( const std::string & message )
        {
            if( is_new_print_all_section )
            {
                is_new_print_all_section = false;
                std::cout << "\n";
                TVS_DEBUG_CONSOLE_OUT( std::string( "\n" ) );
            }
            tout() << message;
            std::cout << message;
            TVS_DEBUG_CONSOLE_OUT( message );
        }
        void clear() { get_jobs().clear(); }
    private:
        static const char * file_base( const char * p_file )
        {
            const char * p_base = p_file;
            for( const char * p_seek = "/\\:"; *p_seek; ++p_seek )
            {
                const char * p_found = strrchr( p_base, *p_seek );
                if( p_found && *(p_found + 1) )
                    p_base = p_found + 1;
            }
            return p_base;
        }
    };

    static singleton my_singleton;

public:
    clunit( job_func_ptr job )
        { tregister( job ); }
    clunit( job_func_ptr job, const char * p_description,
                const char * p_file, int line )
        { tregister( job, p_description, p_file, line ); }
    static void tregister( job_func_ptr job )
        { my_singleton.tregister( job ); }
    static void tregister( job_func_ptr job, const char * p_description,
                const char * p_file, int line )
        { my_singleton.tregister( job, p_description, p_file, line ); }
    static void tbegin( const char * what, const char * file, int line )
        { my_singleton.tbegin( what, file, line ); }
    static void ttoc( const char * what, const char * file, int line )
        { my_singleton.ttoc( what, file, line ); }
    static void tdoc( const char * what )
        { my_singleton.tdoc( what ); }
    static void tsetup_log( const char * what )
        { my_singleton.tsetup_log( what ); }
    static void ttodo( const char * what, const char * file, int line )
        { my_singleton.ttodo( what, file, line ); }
    static void ttodox( const char * what, bool is_passed, const char * file, int line )
        { my_singleton.ttodox( what, is_passed, file, line ); }
    static bool ttest( const char * what, bool is_passed, const char * file, int line )
        { return my_singleton.ttest( what, is_passed, file, line ); }
    static bool ttestfail( const char * what, bool is_passed, const char * file, int line )
        { return my_singleton.ttestfail( what, is_passed, file, line ); }
    static void tcall( const char * what, const char * file, int line )
        { my_singleton.tcall( what, file, line ); }
    static void run()
        { my_singleton.run(); }
    static size_t report()
        { return my_singleton.report(); }
    static void clear()
        { my_singleton.clear(); }
};

#ifdef CLUNIT_MAIN
#define CLUNIT_HOME
    } // End of namespace cl

    int main( int argc, char * argv[] )
    {
        TRUNALL();
    }

    namespace cl {
#endif

#ifdef CLUNIT_HOME
    clunit::singleton clunit::my_singleton;
    job_list & clunit::singleton::get_jobs()
    {
        static job_list jobs;
        return jobs;
    }
    std::ostream & clunit::singleton::tout()
    {
#ifdef CLUNIT_OUT
        static std::ofstream os( CLUNIT_OUT );
#else
        static std::ofstream os( "clunit.out" );
#endif
        if( is_first_tout )
        {
            time_t t=time(NULL);
            os << "Tests run on " << ctime(&t);
            is_first_tout = false;
        }
        if( is_new_tout_section )
        {
            is_new_tout_section = false;
            os << "\n";
        }
        return os;
    }
    std::ostream & clunit::singleton::ttocout()
    {
        static std::ofstream os( "clunit-toc.md" );
        if( is_first_ttoc )
        {
            time_t t=time(NULL);
            os << "Tests table of contents generated on " << ctime(&t);
            is_first_ttoc = false;
        }
        return os;
    }
#endif

} // End of namespace cl

#endif // CLUNIT


text:
function Hub(id, configs) {
	this.servers = [];
	this.online = 0;
	this.max = 0;
	this.name = "Fetching...";
	this.id = id;
    this.configs = configs;
}
Hub.prototype.addServer = function(server){
	this.servers.push(server);
}
Hub.prototype.calculatePercentage = function() {
	return this.max == 0 ? 0 : (this.online / this.max * 100);
}
Hub.prototype.calculateOnlinePlayers = function() {
	this.online = 0;

	for(var i in this.servers) {
		this.online += this.servers[i].players.online;
	}
	return this.online;
}
Hub.prototype.calculateMaxPlayers = function() {
    this.max = 0;
	for(var i in this.servers) {
		this.max += this.servers[i].players.max;
	}
	return this.max;
}
Hub.prototype.calculateTotalPing = function() {
	var totalping = 0;
	for(var i = 0; i < this.servers.length; i++) {
		totalping += parseInt(Math.ceil(this.servers[i].ping));
	}
	return Math.ceil(totalping / this.servers.length);
}
Hub.prototype.reset = function() {
    var status = this.element.find(".label");
    status.removeClass().addClass("label label-danger");
    status.text("Offline");
}
Hub.prototype.update = function() {
    var progressbar = this.element.find(".progress .progress-bar");
    progressbar.css("width", this.calculatePercentage() + "%");
    progressbar.text(this.calculateOnlinePlayers() + "/" + this.calculateMaxPlayers());

    var title = this.element.find(".title-text");
    title.text(this.name);

    var status = this.element.find(".label");

    if(status.hasClass(this.configs["classes"]["ping"]["warning"])) {
        status.removeClass(this.configs["classes"]["ping"]["warning"]);
    }

    var ping = this.calculateTotalPing();
    if(ping == 0) {
        status.removeClass(this.configs["classes"]["ping"]["success"]).addClass(this.configs["classes"]["ping"]["danger"]);
        status.text(this.configs["texts"]["status"]["offline"]);
    } else {
        status.removeClass(this.configs["classes"]["ping"]["danger"]).addClass(this.configs["classes"]["ping"]["success"]);
        status.text(ping + "ms");
    }
}

Hub.prototype.draw = function(server) {

    var _document = document;

    //

    var id1 = $('

');

    //
{$server.NAME}{if $server.ONLINE }Online{/if}

    var id2 = $('
' + this.name + '
');

    var ping = this.calculateTotalPing();
    var id3 = $('').text(ping + "ms");
    if(ping == 0) {
        id3.removeClass(this.configs["classes"]["ping"]["success"]).addClass(this.configs["classes"]["ping"]["success"]).text(this.configs["texts"]["pinging"]);
    }

    //

    var id4 = $('

');

    //{$server.PLAYERS} / {$server.MAXPLAYERS}
    var id5 = $('');

    //

    var id6 = $('

').text(this.calculateOnlinePlayers() + "/" + this.calculateMaxPlayers());

    id2.append(id3);
    id2.append(id3);
    id1.append(id2);
    id1.append(id4);
    id4.append(id5);
    id4.append(id6);

    this.configs["elements"]["start"].append(id1);

    this.element = id1;
    this.drawn = true;
}


text:
require_relative "../lib/scanner"

RSpec.describe(Toolset::Scanner) do
    before(:all) do
        @scanner = Toolset::Scanner.new
    end

    it("scans a project") do
        path = "#{File.dirname(__FILE__)}/../sample-projects/php"

        expect(@scanner.scan_project(path))
            .to eq({
                :php => {
                    :language => "php",
                    :packages => ["phpspec/phpspec", "phpunit/phpunit"],
                },
            })

        project = @scanner.scan_project(path, true).values.first

        expect(project).to be_a(Hash)
        expect(project[:report]).to be_a(Hash)
        expect(project[:report][:json]).to be_a(String)
        expect(project[:report][:plain]).to be_a(String)
    end

    it("raises IOError if something goes wrong") do
        expect {
            @scanner.scan_project("invalid-path")
        }.to raise_error(IOError)

        expect {
            @scanner.scan_projects("invalid-path")
        }.to raise_error(IOError)
    end

    it("scans 1+ projects") do
        path = File.dirname(__FILE__) + "/../sample-projects/js"

        expect(@scanner.scan_projects(path))
            .to eq({
                :bower => {
                    :language => "js",
                    :packages => ["angular", "bootstrap", "jquery"],
                },
                :"npm-component" => {
                    :language => "js",
                    :packages => ["mocha", "chai"],
                },
                :"npm-package" => {
                    :language => "js",
                    :packages => ["chai", "karma"],
                },
            })

        projects = @scanner.scan_projects(path, true)

        expect(projects[:bower][:report]).to be_a(Hash)
    end
end


text:
#ifndef _GS_EXCEPTION_H_
#define _GS_EXCEPTION_H_

#include <exception>
#include <string>
#include "gridstore.h"

using namespace std;

namespace griddb {

	/**
	 * This class creates exception corresponding to error code
	 */
	class GSException : public exception {
		int32_t mCode;
		string mMessage;
	public:
		GSException(int32_t code) : exception(), mCode(code) {
			mMessage = "Error with number " + to_string((long long int)mCode);
		}

		GSException(const char* message) : exception(),
				mCode(-1), mMessage(message) {
		}

		GSException(int32_t code, const char* message) : exception(),
				mCode(code), mMessage(message) {
		}

		~GSException() throw() {}

		int32_t get_code() {
			return mCode;
		}

		virtual const char* what() const throw() {
			return mMessage.c_str();
		}

		/*
		 * Check timeout. Convert from C-API: gsIsTimeoutError
		 */
		bool is_timeout() {
			if (mCode != -1) {
				//Case exception with error code.
				return gsIsTimeoutError(mCode);
			}
			//Case exception with message only.
			return false;
		}
	};

}

#endif


text:
$.widget("ui.RawJavascriptExtractor",{
  options: {},
  _create:function(){
    this.container = this.options.container;

    this.div = $("<div>");

    this.element.append(this.div);

  },

  get:function(type){
    var entry = null;
     $.each(this.container.children,function(i, node){
        if(node.type == type){
          entry = node;
        }
     });
     return entry;
  },

  set:function(object){
     var self = this;
     $.each(this.container.children,function(i, node){
        if(node.type == object.type){
          self.container.removeChild(node)
        }
     });
     this.container.add(object);
  }

});


text:
""" Generic Unification algorithm for expression trees with lists of children

This implementation is a direct translation of

Artificial Intelligence: A Modern Approach by Stuart Russel and Peter Norvig
Second edition, section 9.2, page 276

It is modified in the following ways:

1.  We allow associative and commutative Compound expressions. This results in
    combinatorial blowup.
2.  We explore the tree lazily.
3.  We provide generic interfaces to symbolic algebra libraries in Python.

A more traditional version can be found here
http://aima.cs.berkeley.edu/python/logic.html
"""

from __future__ import print_function, division

from sympy.utilities.iterables import kbins

class Compound(object):
    """ A little class to represent an interior node in the tree

    This is analagous to SymPy.Basic for non-Atoms
    """
    def __init__(self, op, args):
        self.op = op
        self.args = args

    def __eq__(self, other):
        return (type(self) == type(other) and self.op == other.op and
                self.args == other.args)

    def __hash__(self):
        return hash((type(self), self.op, self.args))

    def __str__(self):
        return "%s[%s]" % (str(self.op), ', '.join(map(str, self.args)))

class Variable(object):
    """ A Wild token """
    def __init__(self, arg):
        self.arg = arg

    def __eq__(self, other):
        return type(self) == type(other) and self.arg == other.arg

    def __hash__(self):
        return hash((type(self), self.arg))

    def __str__(self):
        return "Variable(%s)" % str(self.arg)

class CondVariable(object):
    """ A wild token that matches conditionally

    arg   - a wild token
    valid - an additional constraining function on a match
    """
    def __init__(self, arg, valid):
        self.arg = arg
        self.valid = valid

    def __eq__(self, other):
        return (type(self) == type(other) and
                self.arg == other.arg and
                self.valid == other.valid)

    def __hash__(self):
        return hash((type(self), self.arg, self.valid))

    def __str__(self):
        return "CondVariable(%s)" % str(self.arg)

def unify(x, y, s=None, **fns):
    """ Unify two expressions

    inputs:
        x, y - expression trees containing leaves, Compounds and Variables
        s    - a mapping of variables to subtrees
    outputs:
        lazy sequence of mappings {Variable: subtree}

    Example
    =======

    >>> from sympy.unify.core import unify, Compound, Variable
    >>> expr    = Compound("Add", ("x", "y"))
    >>> pattern = Compound("Add", ("x", Variable("a")))
    >>> next(unify(expr, pattern, {}))
    {Variable(a): 'y'}
    """
    s = s or {}

    if x == y:
        yield s
    elif isinstance(x, (Variable, CondVariable)):
        for match in unify_var(x, y, s, **fns):
            yield match
    elif isinstance(y, (Variable, CondVariable)):
        for match in unify_var(y, x, s, **fns):
            yield match
    elif isinstance(x, Compound) and isinstance(y, Compound):
        is_commutative = fns.get('is_commutative', lambda x: False)
        is_associative = fns.get('is_associative', lambda x: False)
        for sop in unify(x.op, y.op, s, **fns):
            if is_associative(x) and is_associative(y):
                a, b = (x, y) if len(x.args) < len(y.args) else (y, x)
                if is_commutative(x) and is_commutative(y):
                    combs = allcombinations(a.args, b.args, 'commutative')
                else:
                    combs = allcombinations(a.args, b.args, 'associative')
                for aaargs, bbargs in combs:
                    aa = [unpack(Compound(a.op, arg)) for arg in aaargs]
                    bb = [unpack(Compound(b.op, arg)) for arg in bbargs]
                    for match in unify(aa, bb, sop, **fns):
                        yield match
            elif len(x.args) == len(y.args):
                for match in unify(x.args, y.args, sop, **fns):
                    yield match

    elif is_args(x) and is_args(y) and len(x) == len(y):
        if len(x) == 0:
            yield s
        else:
            for shead in unify(x[0], y[0], s, **fns):
                for match in unify(x[1:], y[1:], shead, **fns):
                    yield match

def unify_var(var, x, s, **fns):
    if var in s:
        for match in unify(s[var], x, s, **fns):
            yield match
    elif occur_check(var, x):
        pass
    elif isinstance(var, CondVariable) and var.valid(x):
        yield assoc(s, var, x)
    elif isinstance(var, Variable):
        yield assoc(s, var, x)

def occur_check(var, x):
    """ var occurs in subtree owned by x? """
    if var == x:
        return True
    elif isinstance(x, Compound):
        return occur_check(var, x.args)
    elif is_args(x):
        if any(occur_check(var, xi) for xi in x): return True
    return False

def assoc(d, key, val):
    """ Return copy of d with key associated to val """
    d = d.copy()
    d[key] = val
    return d

def is_args(x):
    """ Is x a traditional iterable? """
    return type(x) in (tuple, list, set)

def unpack(x):
    if isinstance(x, Compound) and len(x.args) == 1:
        return x.args[0]
    else:
        return x

def allcombinations(A, B, ordered):
    """
    Restructure A and B to have the same number of elements

    ordered must be either 'commutative' or 'associative'

    A and B can be rearranged so that the larger of the two lists is
    reorganized into smaller sublists.

    >>> from sympy.unify.core import allcombinations
    >>> for x in allcombinations((1, 2, 3), (5, 6), 'associative'): print(x)
    (((1,), (2, 3)), ((5,), (6,)))
    (((1, 2), (3,)), ((5,), (6,)))

    >>> for x in allcombinations((1, 2, 3), (5, 6), 'commutative'): print(x)
        (((1,), (2, 3)), ((5,), (6,)))
        (((1, 2), (3,)), ((5,), (6,)))
        (((1,), (3, 2)), ((5,), (6,)))
        (((1, 3), (2,)), ((5,), (6,)))
        (((2,), (1, 3)), ((5,), (6,)))
        (((2, 1), (3,)), ((5,), (6,)))
        (((2,), (3, 1)), ((5,), (6,)))
        (((2, 3), (1,)), ((5,), (6,)))
        (((3,), (1, 2)), ((5,), (6,)))
        (((3, 1), (2,)), ((5,), (6,)))
        (((3,), (2, 1)), ((5,), (6,)))
        (((3, 2), (1,)), ((5,), (6,)))
    """

    if ordered == "commutative":
        ordered = 11
    if ordered == "associative":
        ordered = None
    sm, bg = (A, B) if len(A) < len(B) else (B, A)
    for part in kbins(range(len(bg)), len(sm), ordered=ordered):
        if bg == B:
            yield tuple((a,) for a in A), partition(B, part)
        else:
            yield partition(A, part), tuple((b,) for b in B)

def partition(it, part):
    """ Partition a tuple/list into pieces defined by indices

    >>> from sympy.unify.core import partition
    >>> partition((10, 20, 30, 40), [[0, 1, 2], [3]])
    ((10, 20, 30), (40,))
    """
    return type(it)([index(it, ind) for ind in part])

def index(it, ind):
    """ Fancy indexing into an indexable iterable (tuple, list)

    >>> from sympy.unify.core import index
    >>> index([10, 20, 30], (1, 2, 0))
    [20, 30, 10]
    """
    return type(it)([it[i] for i in ind])


text:
+++
date = "2019-02-04T00:00:00"
draft = false
tags = ["ওপেন সোর্স", "গিটহাব"]
title = "How To Setup Git with Google Drive, Dropbox, Onedrive"
math = false
summary = """
Install google drive, dropbox on your local PC and enable sync
"""

[header]
image = "headers/c2.jpg"
caption = "Image credit: Me !"

+++

* **step - 01 :** Install google drive, dropbox on your local PC and enable sync.
* **step - 02 :** install and configure git on your PC.
* **step - 03 :** create a folder on google-drive and open `git-bash` there
* **step - 04 :** write git command `git init --bare`
* **step - 05 :** Initialize a git repo outside of google-drive
* **step - 06:** now connect google drive repo with your the repo that you just created outside of google drive.
 `git remote add origin "/C/Users/JoeUser/Google Drive/git/project1.git"` (note if the url does not have any space then remove double quote)
to check if the remote added `git remote -v`
* **step - 07 :** If remote added without any error then push your local changes `git push -u origin master`
And you done. now you can make changes and push your local changes to google-drive repo.
If you want to clone that repo then simply `git clone "/C/Users/JoeUser/Google Drive/git/project1.git"`

[video tutorial] (https://www.youtube.com/watch?v=T2aJP5MOxug)

Follow me on
[Githab](https://github.com/shohan4556/)|
[Twitter](https://twitter.com/shohan4556/)|
[Facebook](https://facebook.com/shohan4556/)|
[Quora](https://www.quora.com/profile/Shohanur-Rahaman)

***© copyright reserved by the Author.***