• The first Java function entirely written by me

    tsbgroup        
    0 Likes0 Commentsjava

    private void fill() throws Exception {
    
        //формируем xml объект
        URLReader xml = new URLReader(this.getChanelUrl());
    
        //формируем из xml объект для парсинга
        Document doc = parseXML(xml.getUrlConnection().getInputStream());
    
        // /получаем список узлов документа в виде массива
        NodeList podcastTitles = doc.getElementsByTagName("title");
    
        //инициализируем имя подкаст-ленты
        this.setName(podcastTitles.item(0).getTextContent());
    
        //получаем все подкасты из xml
        NodeList podcastItems = doc.getElementsByTagName("item");
        
        //производим само заполнение массива подкастов
        for(int i=0; i < podcastItems.getLength(); i++)
        {
            this.podcastList.add(new Podcast(podcastItems.item(i)));
        }
    
      }
  • keyboardr        
    0 Likes0 Commentsxml

    <style name="TextAppearance.Grandparents">
      <item name="allCaps">true</item>
    </style>
  • yaml translations

    MattKetmo        
    0 Likes0 Commentsyaml

    menu:
        home: "Home"
        about: "About"
        contact: "Contact"
    
    footer:
        trademark: "© me %date%"
    
    page.index:
        jumbotron:
            title: "This is Openl10n"
            paragraph: "Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus."
            button: "Learn more"
    
    marketing:
        item1:
            title: "Subheading 1"
            text: "Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum."
        item2:
            title: "Subheading 2"
            text: "Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum."
        item3:
            title: "Subheading 3"
            text: "Maecenas sed diam eget risus varius blandit sit amet non magna."
        item4:
            title: "Subheading 4"
            text: "Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum."
    
  • Heartbleed

    tarraschk        
    0 Likes0 Commentsc_cpp

    unsigned char *buffer, *bp;
        int r;
        
    		buffer = OPENSSL_malloc(1 + 2 + payload + padding);
    		bp = buffer;
    
    		*bp++ = TLS1_HB_RESPONSE;
    		s2n(payload, bp);
    		memcpy(bp, pl, payload);
    		bp += payload;
    		
    		RAND_pseudo_bytes(bp, padding);
    
    		r = dtls1_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding);
    
    		if (r >= 0 && s->msg_callback)
    			s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT,
    				buffer, 3 + payload + padding,
    				s, s->msg_callback_arg);
    
    		OPENSSL_free(buffer);
  • Sass color variable

    CharlesMassry        
    0 Likes0 Commentsscss

    $primary-color: #E3E7F2;
    
    body{
      background-color: $primary-color;
    	font: 14px Helvetica, Arial, sans-serif;
    }
  • cschlisner        
    0 Likes0 Commentsjava

    class q3 {
         public static void main(String args[]){     		
    			long n = 600851475143L, i=2;
    			while (true){
    				if (i==n)
    					break;
    				else if ((n%i)==0){
    					n=n/i;
    					i=2;
    					continue;
    				}
    				else ++i;	
    			}
    			System.out.println(n);
    	   }
    }
  • Express.js app

    choochootrain        
    0 Likes0 Commentsjavascript

    var express = require("express");
    var ejs = require("ejs");
    var app = express();
    
    
    ///////////////////////////////////////////////////////////////////////////////
    // APP CONFIGURATION                                                         //
    ///////////////////////////////////////////////////////////////////////////////
    //configure logging
    app.use(express.logger());
    //make files in static folder publicly accessible
    app.use('/static', express.static(__dirname + '/static'));
    //use ejs for html templates
    app.engine('html', ejs.renderFile);
    
    
    ///////////////////////////////////////////////////////////////////////////////
    // APP ROUTES                                                                //
    ///////////////////////////////////////////////////////////////////////////////
    //default route
    app.get('/', function(req, res) {
      res.render('index.html', { });
    });
    
    app.get('/test', function(req, res) {
      res.render('test.html', { });
    });
    
    app.get('/ball', function(req, res) {
      res.render('ball.html', { });
    });
    
    ///////////////////////////////////////////////////////////////////////////////
    // RUN CONFIGURATION                                                         //
    ///////////////////////////////////////////////////////////////////////////////
    var port = Number(process.env.PORT || 5000);
    app.listen(port, function() {
        console.log("Listening on " + port);
    });
  • variadic unpacking in go

    JesseObrien        
    0 Likes0 Commentsgolang

    func unpack(s []string, vars... *string) {
       for i, str := range s {
          *vars[i] = str
       }
    }
    
  • kirbarn        
    0 Likes0 Commentshtml

    <!doctype html>
    <html lang="en" ng-app="myApp">
    <head>
      <meta charset="utf-8">
      <title>My HTML File</title>
      <script src="lib/angular/angular.js"></script>
    </head>
    <body>
    …
    </body>
    </html>
  • Tonight's project

    JamesVorder        
    0 Likes0 Commentscss

    a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,big,blockquote,body,br,canvas,caption,center,cite,code,col,colgroup,command,
    datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,
    iframe,img,input,ins,kbd,keygen,label,legend,li,link,map,mark,menu,meta,meter,nav,noframes,noscript,object,ol,optgroup,option,output,p,param,pre,progress,q,
    rp,rt,ruby,s,samp,script,section,select,small,source,span,strike,strong,style,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr{
      margin: 0;
    	padding: 0;
    	-moz-box-sizing:border-box;
    	box-sizing:border-box;
    }
    
    /* Elements */
    
    li{
    	list-style: none;
    }
    
    body{
    	background: #272424;
    	color: #3D3838;
    }
    
    a{
    	color: #AB3720;
    	text-decoration: none;
    }
    
    img {
    	display: block;
    	border: none;
    }
    
    /* Parents */
    
    #header{
    	margin-bottom: 20px;
    	color:#272424;
    }
    
    /*#main{
    	background: red;
    }*/
    
    #footer{
    	background: green;
    }
    
    
    /* Columns  Default**************************************************************/
    
    .column_container {
        zoom: 1;
    }
    
    .column_container:before,
    .column_container:after {
        content: "";
        display: table;
    }
    
    .column_container:after {
        clear: both;
    }
    
    .two_column_left, .two_column_right{
    	float: left;
    	width: 50%;
    }
    
    .three_column_left, .three_column_center, .three_column_right{
    	float: left;
    	width: 32%;
    	margin-right: 10px;
    	padding-top: 10px;
    }
    
    .three_column_left{
    	margin-left: 10px;
    }
    
    /* Header */
    
    #header .two_column_left{
    	position: relative;
    	top: 0;
    	left: 0;
    	background: #6E9141;
    	height: 300px;
    	padding-top:100px;
    	box-shadow: 2px 2px 10px #272424;
    }
    
    #header .two_column_left:before{
    	content: "";
    	position: absolute;
    	width: 100%;
    	height: 100%;
    	z-index: -1;
    	top: 10px;
    	left: 10px;
    	background: #6CA4A3;
    }
    
    #header li{
    	display: inline-block;
    	height: 100px;
    }
    
    #header h1{
    	text-align: center;
    	/*margin-top: 50px;*/
    	font-size: 50px;
    }
    
    /* Main */
    
    #main .three_column_left,
    #main .three_column_center,
    #main .three_column_right{
    	/*background: rgb(108,764,163);*/
    }
    
    #main .content{
    	background: #D7DBE3;
    	margin-right: 10px;
    	margin-bottom: 10px;
    	position: relative;
    	top: 0;
    	left: 0;
    	box-shadow: 2px 2px 10px #272424;
    }
    
    #main .content p{
    	padding: 10px 20px 20px 10px;
    	font-size: 16px;
    	line-height: 32px;
    }
    
    .content:before{
    	content: "";
    	position: absolute;
    	width: 100%;
    	height: 100%;
    	z-index: -1;
    	top: 10px;
    	left: 10px;
    	background: #6CA4A3;
    }
    
    #main .three_column_center{
    	margin-top:-100px;
    }
    
    #main .three_column_right img{
    	margin: 0 auto;
    }
    
    /* navigation stuff *************************************************/
    
    #nav{
    	margin-left: 20px;
    }
    
    #nav a{
    	font-size: 25px;
    }
    
    #nav li{
    	display: inline-block;
    	width: 40%;
    	position: relative;
    	top: 0;
    	left: 0;
    	height: 75px;
    	margin:10px 10px 10px 0;
    	background: #D7DBE3;
    	text-align: center;
    	/*to center the links vertically*/
    	padding-top: 25px;
    	box-shadow: 2px 2px 10px #272424;
    }
    
    #nav li:before{
    	content: "";
    	position: absolute;
    	width: 100%;
    	height: 100%;
    	z-index: -1;
    	top: 10px;
    	left: 10px;
    	background: #6CA4A3;
    }
    
    /* screen size specific ***********************************************************************/
    
    @media only screen and (max-width: 1000px){
    	/*main content area*/
    	#main .three_column_left{
    		width: 95%;
    		float: left;
    		margin-left: 10px;
    		margin-right: 10px;
    	}
    
    	#main .three_column_center, .three_column_right{
    		margin-top:0;
    		width: 47%;
    		float: left;
    		margin-left: 10px;
    		margin-right: 0;
    	}
    
    	/*navigation*/
    	#nav li{
    		width: 95%;
    	}
    }
    
    @media only screen and (max-width: 750px){
    	/*header stuff*/
    	#header .two_column_left{
    		width: 98%;
    		float: left;
    	}
    
    	/*navigation*/
    	#header .two_column_right{
    		width: 98%;
    		float: left;
    		padding-top: 10px;
    	}
    
    	#nav li{
    		width: 45%;
    	}
    
    	/*main content area*/
    	#main .three_column_left, .three_column_right{
    		width: 95%;
    		float: left;
    		margin-left: 10px;
    		margin-right: 10px;
    	}
    
    	#main .three_column_center{
    		width: 95%;
    		float: left;
    		margin-left: 10px;
    		margin-right: 10px;
    	}
    }
    
    @media only screen and (max-width: 500px){
    	/*header*/
    	#header .two_column_left{
    		width: 95%;
    	}
    	/*navigation*/
    	#nav{
    		margin-left: 10px;
    	}
    	
    	#nav li{
    		width: 98%;
    	}
    
    	#main .content p{
    	padding: 10px 20px 20px 10px;
    	font-size: 14px;
    	line-height: 28px;
    }
    }