n3paste.de

::

a haskell happstack pastebin

  • New paste
  • View pastes

  • Login

  • About
  • Most recent pastes (filtered)

    Filter pastes (help):

    08:04 - Thu 2017.05.11

    JavaScript

    Paste: /97S/Show related

    No description.

    require('./bootstrap');
    window.Handlebars = require('handlebars');
    
    window.log = console.log;
    
    window.Handlebars.registerHelper('inc', function (c, num) {
        return new Handlebars.SafeString(Handlebars.escapeExpression((c + num).toString(10)));
    });
    
    let sondenform = $('#sondenform');
    if (sondenform) {
        sondenform = Handlebars.compile(sondenform.html());
        const intervalinput = Handlebars.compile($('#intervalinput').html());
        const projcont = $('#projcontroller');
        const target = $('#sondentarget');
        let lastselected = projcont.find(':selected');
        let numprobes = lastselected.data('num');
        let numintervals = [1, 1, 1, 1]; // observe this. ignore index < numprobes
    
        let renderTpl = () => {
    

    19:03 - Sun 2017.04.09

    JavaScript

    Paste: /FE/Show related

    No description.

    // Configure HTTPS + websocket server
    
    const httpsServerOptions = {
      key: fs.readFileSync('keys/key.pem'),
      cert: fs.readFileSync('keys/cert.pem')
    };
    
    const httpsServer = https.createServer(httpsServerOptions, (req, res) => {
      res.setHeader('content-type', 'text/html');
      res.writeHead(200);
      if (shared.host === 'localhost') {
        indexHtml = fs.readFileSync('./index.html');
      }
      res.end(indexHtml);
    });
    
    // start server & bind to port
    httpsServer.listen(shared.srvPort, shared.srvHost);
    
    const srv = new ws.server({
    

    09:47 - Mon 2017.03.13

    JavaScript

    Paste: /Ga/Show related

    No description.

    //DESPLEGABLE PROVINCIAS
    /*Cuando se cargue la página, cargar la lista de provincias en la primera lista
    desplegable: El script del servidor se llama cargaProvinciasXML.php. El
    formato de la respuesta es XML, con la siguiente estructura*/
    
    window.onload = cargaProvincias;
    
    function cargaProvincias(){
        var peticion = new XMLHttpRequest();
        peticion.onreadystatechange = function(){
            if (this.readyState === 4 && this.status === 200) {
                muestraP(this);
            }
        };
    
        peticion.open("GET", "cargaProvinciasXML.php", true);
        peticion.send();
    }
    
    /*Cuando se seleccione una determinada provincia, se carga mediante AJAX
    

    17:49 - Thu 2017.03.02

    JavaScript

    Paste: /OkSU/Show related

    No description.

    <!------ Calculadora DOM ------>
    <!DOCTYPE html>
    <html><head><title>Calculadora</title><meta charset="utf-8">
    <style type="text/css">
    body {font-family: sans-serif; text-align:center;}
    #calculadora { font: bold 14px Arial,sans-serif;
     background-color: #888888;
     border-radius: 3px;
     height: auto; margin: 0 auto;
        padding: 20px 20px 9px;
    	width: 285px;
    	}
    .parteSuperior .pantalla { background-color: rgba(0, 0, 0, 0.2);
     border-radius: 3px; color: #FFFFFF;
     float: right;
     font-size: 17px;
     height: 40px; letter-spacing: 1px;
     line-height: 40px; padding: 0 10px;
     text-align: right; width: 180px;
     }
    

    11:57 - Wed 2015.11.04

    JavaScript

    Paste: /rN/Show related

    No description.

    function largestOfFour(arr) {
    
      for(i=0; i < arr.length; i++){
    
        // sorts nested array, largest to smallest.
        arr[i] = arr[i].sort(function(a,b){
            return b-a;
        });
        // pulls the first entry in each array, which is now the largest.
        arr[i] = arr[i].shift();
    
      }
    
      return arr;
    }
    
    largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
    

    17:24 - Tue 2015.11.03

    JavaScript

    Paste: /PlF/Show related

    Changing the first letter to capitals

    function titleCase(str) {
    
    
      buildCap = str.split(''); // adds characters to the area
      var space = false; // starts boolean expression for spaces yes/no
      buildCap[0] = str.charAt(0).toUpperCase(); // First as upper-case by default.
    
      for(i=1; i < (str.length); i++)
      {
        if(space === false)
          {
            buildCap[i] = str.charAt(i).toLowerCase(); // if there wasn't a space before, lower.
          }
    
        if(space === true)
          {
            buildCap[i] = str.charAt(i).toUpperCase(); // if there was a space before, upper.
            space = false;
          }
    
    

    13:28 - Thu 2012.12.13

    JavaScript

    Paste: /CoKr/Show related

    No description.

        for(var i = 1; i <= count; i++){
          console.log('bind');
          console.log(i);
          $('li#matchimage-control-'+i).click(function(){
            console.log('click');
            console.log(i);
            mi_set(i, true);
          })
        }
    

    23:29 - Tue 2012.09.25

    JavaScript

    Paste: /4R/Show related

    delete all reddit comments

    function delete_all(usr) {
      $.get("/user/" + usr + "/.json", function(data) {
        var ch = data.data.children;
        var mh = data.data.modhash;
        if (ch.length > 0) {
          for (var i in ch) {
            var name = ch[i].data.name;
            console.log("Deleting " + name);
            $.post("/api/del", { id: name, uh: mh });
          }
          delete_all(usr);
        } else {
          console.log("Done!");
        }
      });
    }
    

    06:43 - Mon 2012.04.30

    JavaScript

    Paste: /BS/Show related

    Propbomb - Minified

    function updateNotificationCount(){var a=document.implementation.createHTMLDocument("temp");$.get("/home/",function(b){a.body.innerHTML=b;$("#global_notification_bubble").html(a.getElementById("global_notification_bubble").innerHTML)})}function g(){$("#activity_stream_content").append(buffer);bind_props();$(".give_prop").each(function(){$(this).click()});lastRun=$(".give_prop").length;total+=lastRun;document.title="AUTOPROP - Total: "+total+" Last Run: "+lastRun+" - Fitocracy";updateNotificationCount()}function f(){for(var a=1;a<u;a++){$.get("/activity_stream/"+a*stream_increment+"/?firehose=1",function(a){buffer+=a})}setTimeout(g,3500)}function r(){$("#firehose_view").click();setTimeout(f,1500)}var total=0;var lastRun=0;var u=20;var buffer;document.title="AUTOPROP - Fitocracy";setInterval("r()",4e4);r()
    

    23:45 - Sun 2012.04.29

    JavaScript

    Paste: /at9P/Show related

    Reply to /q6/

    var total=0;
    var startTime = new Date();
    
    function r() {
      $('#firehose_view').click();
      setTimeout(f,3000);
    }
    
    var u=20;
    var v = u;
    
    function f(){
      if(u-- >0) {
        setTimeout(f,1200);
        $.get( '/activity_stream/'+ (v-u)*15 + '/?firehose=1'
             , function(results) {
                 $('#activity_stream_content').append(results);
               })
      } else {
        bind_props();
    

    23:40 - Sun 2012.04.29

    JavaScript

    Paste: /q6/Show related

    Propbomb

    var total=0; var startTime = new Date(); function r() {$('#firehose_view').click(); setTimeout(f,3000);} var u=20; var v = u; function f(){if(u-- >0){setTimeout(f,1200);$.get('/activity_stream/'+ (v-u)*15 + '/?firehose=1', function(results) {$('#activity_stream_content').append(results);})} else {bind_props();$('.give_prop').each(function(){$(this).click();});total += $('.give_prop').length; var endTime = new Date(); alert(total + " casualties in " + ((endTime.getTime() - startTime.getTime()) / 1000 / 60) + "minutes");}} r();
    

    09:56 - Mon 2012.04.23

    JavaScript

    Paste: /nE4/Show related

    No description.

        for (csubindex in delegations){
          alert(csubindex);
          //$('ul#bscontrols-'+index).delegate(delegations[csubindex], 'click', function(){alert(42);});
          $(delegations[csubindex]).live('click', function(){ blockslideShow(index, csubindex);  });
        }
    

    12:52 - Fri 2012.04.20

    JavaScript

    Paste: /WJJY/Show related

    foobar

    (function ($) {
    
    blockslides = {}
    
      $(window).load(function(){
    
        blockslideDiscover();
    
        $(blockslides.groups).each(function(index){
          //$(this).hide();
          blockslideAddControls(index, this);
        });
    
      });
    
    
      function blockslideDiscover(){
        blockslides.groups = new Array();
    
        $('div.blockslide-nodes').each(function(){
    

    15:01 - Tue 2012.01.24

    JavaScript

    Paste: /AkI/Show related

    No description.

    //FIXME: Enable multiple blocksliders at once
    
    (function ($) {
    
    var elem;
    var bsDelay = 5000;
    var inTime = 600;
    var outTime = 600;
    var bsInterval
    
    $(window).load(function(){
      //Start all blockslides
      bsInit($('div.blockslide-wrapper'));
    });
    
    
    function bsInit(blockslide){
      var firstelem = blockslide.children('div').first();
      var lastelem = blockslide.children('div').last();
      var prevelem = firstelem;
    

    13:12 - Mon 2012.01.23

    JavaScript

    Paste: /Qj/Show related

    No description.

    
    function bsStart(){
    
      //alert('play');
      $('#blockslide').children('div').each(
        function(){
          var elem = this;
          $(this).fadeIn(600);
          setTimeout(
            function(){
              $(elem).hide();
              alert('hide');
            },
            window.bsDelay
          );
        }
      );
    }