• Untitled

    rorattol        
    0 Likes0 Commentsphp

    <?php
    
    echo "test is over";
    
    ?>
  • Rob

    trobertsonsf        
    0 Likes0 Commentsjavascript

    import renderWrapper from './renderWrapper';
    
    export default renderWrapper(ReactClass => !!ReactClass.rerenderViz);
    
  • Untitled

    KennyFernandez        
    0 Likes0 Commentsjava

    public class test {
        static public void main(String[] args)
        {
            int a = 5;
            int b = 7;
            b |= a;
            System.out.println(b);
            b = 7;
            b %= a;
            System.out.println(b);
            b = 7;
            b %= a;
            System.out.println(b);
            b = 7;
            b <= a;
            System.out.println(b);
        }
    }
    
  • Using properly PDO class

    angelhvargas        
    0 Likes0 Commentsphp

    <?php
    namespace Project\DB;
    class PDOBase extends \PDO {
      //custom properties
      protected $connection_property_1;
      protected $status;
      protected $partition;
      public function __construct()
      {
        //to the PDO class
        //Read PHP cocumentation
        parent::construct();
      }
      
      public function __clone()
      {
        return null;
      }
      
      public function custom_1()
      {
        // custom methods
      }
      
      public function status() {}
      
    }
  • Untitled

    noroutine        
    0 Likes0 Commentsmarkdown

    Любіть чистим серцем - і йдіть,
    підкошені зводьтеся знов
    і мовчки в душі хороніть
    одурену вашу любов
  • new game

    mscoutermarsh        
    0 Likes0 Commentsruby

    $ git stash list | wc -l
    => 258
  • Untitled

    dermesser        
    0 Likes0 Commentsgolang

    func (s *RpcServer) registerHandlers() {
      s.srv.RegisterHandler(RPC_SERVICE, "ConfigChange", s.ConfigRequestHandler)
      s.srv.RegisterHandler(RPC_SERVICE, "AppendEntries", s.AppendEntriesHandler)
    	s.srv.RegisterHandler(RPC_SERVICE, "RequestVote", s.RequestVoteHandler)
    	s.srv.RegisterHandler(RPC_SERVICE, "InstallSnapshot", s.InstallSnapshotHandler)
    }
    
    // Sends a request to the given processor. Returns nil if the processor doesn't exist.
    func (s *RpcServer) sendRequest(cluster_id string, rq *RpcRequest) *RpcResponse {
    	s.mx.Lock()
    	defer s.mx.Unlock()
    
    	c, ok := s.processors[cluster_id]
    
    	if !ok {
    		return &RpcResponse{err: errors.New("No such cluster")}
    	}
  • quicksort

    picmuse        
    0 Likes0 Commentspython

    import random
    
    def quicksort(arr):
        if arr is None:
            return arr
    
        return _quicksort(arr, 0, len(arr))
    
    
    def _quicksort(arr, start, end):
        if start + 1 >= end:
            return arr
    
        pivot = _partition(arr, start, end)
        _quicksort(arr, start, pivot)
        _quicksort(arr, pivot + 1, end)
    
        return arr
    
    
    def _partition(arr, start, end):
        pivot = start
        l = start
        r = start + 1
        while r < end:
            if arr[r] <= arr[pivot]:
                l = l + 1
                tmp = arr[l]
                arr[l] = arr[r]
                arr[r] = tmp
            r = r + 1
    
        tmp = arr[l]
        arr[l] = arr[pivot]
        arr[pivot] = tmp
    
        return l
    
    
    print quicksort(None)
    print quicksort([])
    print quicksort([3])
    print quicksort([3,1])
    print quicksort([3,1,2])
    print quicksort([int(random.random() * 200) for x in range(1, 200)])
  • JS Game logic

    ajweeks        
    0 Likes0 Commentsjavascript

        return OptionState;
    })(BasicState);
    var LevelSelectState = (function (_super) {
        __extends(LevelSelectState, _super);
        function LevelSelectState(sm) {
            _super.call(this, STATE.LEVEL_SELECT, sm);
            this.height = 8;
            this.numOfLevels = 64;
            this.offset = 150;
            this.maxOffset = -(Math.ceil(this.numOfLevels / this.height) * 250 - window.innerWidth + 150);
            get('levelselectstate').style.display = "block";
            var x, y, str = '', n;
            for (x = 0; x < Math.ceil(this.numOfLevels / this.height); x++) {
                str += '<div class="col">';
                for (y = 0; y < this.height; y++) {
                    n = (x * this.height) + y;
                    var enabled = Game.defaultLevels[n] !== undefined;
                    str += '<div class="button lvlselect' + (enabled ? ' enabled' : '') +
                        (enabled ? 'onmousedown="if (clickType(event)===\'left\') Game.sm.enterState(\'game\') +
                        '>' + decimalToHex(n) + '</div>';
                }
                str += '</div>';
            }
            str += '<div id="backarrow" onmouseover="Game.lvlselectButtonDirection=1;" onmouseout="Game.lvlselectButtonDirection = 0;" style="visibility: hidden"><p>◀</p></div>';
            str += '<div id="forwardarrow" onmouseover="Game.lvlselectButtonDirection=-1" onmouseout="Game.lvlselectButtonDirection = 0;"><p>▶</p></div>';
            str += '<div class="button" onmousedown="if (clickType(event)===\'left\') Game.sm.enterPreviousState();" style="margin-left: -90px; margin-top: -490px;">Back</div>';
            get('levelselectstate').style.width = 250 * Math.ceil(this.numOfLevels / this.height) + 'px';
            get('levelselectstate').style.marginLeft = '150px';
            get('levelselects
  • Binary sorted _.contains with cache

    trueter        
    0 Likes0 Commentscoffee

    onQuantcast = _.memoize ( m ) -> ~ ! _.indexOf quantcast_domains, m.origin.domain, true