• 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;
    }
    }
  • srcset

    drewschrauf        
    0 Likes0 Commentshtml

    <img src="face.jpeg"
        srcset="face-low.jpeg 600w 200h 1x,
                face-high.jpeg 600w 200h 2x,
                face-icon.png 200w 200h">
  • code1

    liqwidice        
    0 Likes0 Commentsjava

    package ca.liqwidice.mirror.state;
    
    import java.awt.Font;
    import java.io.BufferedReader;
    
    import org.lwjgl.input.Mouse;
    import org.newdawn.slick.GameContainer;
    import org.newdawn.slick.Graphics;
    import org.newdawn.slick.Image;
    import org.newdawn.slick.Input;
    import org.newdawn.slick.SlickException;
    import org.newdawn.slick.Sound;
    import org.newdawn.slick.TrueTypeFont;
    import org.newdawn.slick.state.BasicGameState;
    import org.newdawn.slick.state.StateBasedGame;
    
    import ca.liqwidice.mirror.Button;
    import ca.liqwidice.mirror.Game;
    import ca.liqwidice.mirror.Level;
    import ca.liqwidice.mirror.Squares;
    
    public class GameState extends BasicGameState {
      
      Button btnMainMenu;
    	Button btnReset;
    	Button btnLevelSelect;
    	Button btnQuit;
    	
    	BufferedReader levelReader;
    	
    	public static TrueTypeFont font;
    	public static TrueTypeFont titleFont;
    	
    	/** Current Level (Modified by the player) */
    	public static Level curLev;
    	
    	@Override 
    	public void init(GameContainer container, StateBasedGame sbg) throws SlickException {
    		Game.imgBlank = new Image("res/blank.png");
    		Game.imgMirrorNW = new Image("res/mirrorNW.png");
    		Game.imgMirrorNE = Game.imgMirrorNW.copy();
    		Game.imgMirrorNE.rotate(90F);
    		Game.imgPointerE = new Image("res/laser_pointerE.png");
    		Game.imgPointerN = Game.imgPointerE.copy();
    		Game.imgPointerN.rotate(270F);
    		Game.imgPointerS = Game.imgPointerE.copy();
    		Game.imgPointerS.rotate(90F);
    		Game.imgPointerW = Game.imgPointerE.copy();
    		Game.imgPointerW.rotate(180F);
    		Game.imgReceptor = new Image("res/receptor.png");
    		Game.imgLaser_redNS = new Image("res/laser_red.png");
    		Game.imgLaser_redNS_s = Game.imgLaser_redNS.getSubImage(0, 0, 7, 25);
    		Game.imgLaser_redEW = Game.imgLaser_redNS.copy();
    		Game.imgLaser_redEW.rotate(90F);
    		Game.imgLaser_redEW_s = Game.imgLaser_redNS.getSubImage(0, 0, 7, 25);
    		Game.imgLaser_redEW_s.rotate(90f);
    		
    		//Game.imgLaser_greenNS = new Image("res/laser_green.png");
    		//Game.imgLaser_greenEW = Game.imgLaser_greenNS.copy();
    		//Game.imgLaser_greenEW.rotate(90F);
    		//Game.laser_blueNS = new Image("res/laser_blue.png");
    		//Game.laser_blueEW = Game.laser_blueNS.copy();
    		//Game.laser_blueEW.rotate(90F);
    		
    		Game.imgBuffer = new Image("res/buffer.png");
    		Game.imgLouder = new Image("res/louder.png");
    		Game.imgQuieter = new Image("res/quieter.png");
    		
    		Game.sndSelect = new Sound("res/select.wav");
    		
    		font = new TrueTypeFont(new Font("System", Font.PLAIN, 21), true);
    		titleFont = new TrueTypeFont(new Font("System", Font.BOLD, 36), true);
    		curLev = new Level(1);
    		
    		btnMainMenu = new Button(10, 35, 125, 40);
    		btnLevelSelect = new Button(10, 90, 135, 40);
    		btnReset = new Button(10, 145, 80, 40);
    		btnQuit = new Button(10, 200, 65, 40);
    	}
    	
    	@SuppressWarnings("incomplete-switch")
    	@Override
    	public void update(GameContainer container, StateBasedGame sbg, int delta) throws SlickException {
    		Input input = container.getInput();
    		
    		int mouseX = input.getMouseX();
    		int mouseY = input.getMouseY();
    		
    		if (input.isKeyPressed(Input.KEY_ESCAPE)) {
    			if (input.isKeyDown(Input.KEY_ESCAPE)) {
    				Game.sndSelect.play(Game.pitch, Game.volume);
    				sbg.enterState(States.MENUSTATE.ordinal());
    			}
    		}
    		
    		//Click check in game grid
    		if (Mouse.isButtonDown(0) && !Game.clicked) //Mouse is clicked 
    			if (Game.mouseInBounds(mouseX, mouseY, new Button(216, 0, Game.WIDTH - 216, Game.HEIGHT))) { //Mouse is somewhere in grid
    				int row, column;
    				if (((row = getRow(mouseY, curLev)) != -1) && ((column = getCollumn(mouseY, curLev)) != -1)) {           //We know what row / column the click is in
    					switch (curLev.squares[row][column]) {
    					case NWMIRROR:
    					case NWMIRROR_A:
    						curLev.squares[0][0] = Squares.NEMIRROR; //rotate
    						break;
    					case NEMIRROR:
    					case NEMIRROR_A:
    						curLev.squares[0][0] = Squares.NWMIRROR; //rotate
    						break;
    					}
    					updateRow(row, 0, true);
    				}
    			}
    		
    		//Update game grid
    		for (int x = 0; x < curLev.squares[0].length; x++) {
    			for (int y = 0; y < curLev.squares.length; y++) {
    				//check if square is a laser pointer or laser
    				switch (curLev.squares[x][y]) {
    				case NPOINTER:
    					//check column up
    					updateCol(y, x, false);
    					break;
    				case EPOINTER:
    					//check row to the right
    					updateRow(x, y, true);
    					break;
    				case SPOINTER:
    					//check column down
    					updateCol(y, x, true);
    					break;
    				case WPOINTER:
    					//check row to the  left
    					updateRow(x, y, false);
    					break;
    				}
    			}
    		}
    		
    		//btnMainMenu
    		if (Game.mouseInBounds(mouseX, mouseY, btnMainMenu)) {
    			if (Mouse.isButtonDown(0) && !Game.clicked) { //Mouse is clicking
    				Game.sndSelect.play(Game.pitch, Game.volume);
    				sbg.enterState(States.MAINMENUSTATE.ordinal());
    			}
    			btnMainMenu.hover = true; //Mouse in bounds but not down (Hovering)
    		} else btnMainMenu.hover = false;
    		
    		//btnReset
    		if (Game.mouseInBounds(mouseX, mouseY, btnReset)) {
    			if (Mouse.isButtonDown(0) && !Game.clicked) {
    				Game.sndSelect.play(0.6f, Game.volume);
    				try {
    					Thread.sleep(80);
    				} catch (InterruptedException e) { //Fancy warning sounds
    					e.printStackTrace();
    				}
    				Game.sndSelect.play(0.9f, Game.volume);
    				curLev = new Level(curLev.currrentLevel);
    			}
    			btnReset.hover = true;
    		} else btnReset.hover = false;
    		
    		//btnLevelSelect
    		if (Game.mouseInBounds(mouseX, mouseY, btnLevelSelect)) {
    			if (Mouse.isButtonDown(0) && !Game.clicked) {
    				Game.sndSelect.play(Game.pitch, Game.volume);
    				sbg.enterState(States.LEVELSELECTSTATE.ordinal());
    			}
    			btnLevelSelect.hover = true;
    		} else btnLevelSelect.hover = false;
    		
    		//btnQuit
    		if (Game.mouseInBounds(mouseX, mouseY, btnQuit)) {
    			if (Mouse.isButtonDown(0) && !Game.clicked) {
    				Game.sndSelect.play(Game.pitch, Game.volume);
    				sbg.enterState(States.CONFIRMQUITSTATE.ordinal());
    			}
    			btnQuit.hover = true;
    		} else btnQuit.hover = false;
    		
    		//if laser is hitting receptor: next level? You Win! screen? currentLevel++;
    		
    		Game.clicked = Mouse.isButtonDown(0); //Must be last line of method
    	}
    	
    	/** @param row 0 = top row
    	 * @param start starting location
    	 * @param dir true = right, false = left */
    	@SuppressWarnings("incomplete-switch")
    	public void updateRow(int row, int start, boolean dir) {
    		//1. Either start at the next square, or the previous
    		//2. Either loop until i = 0, or i = the row's length
    		//3. Either increment or decrement i
    		for (int i = start + (dir ? 1 : -1); dir ? i > 0 : i < curLev.squares[row].length; i += (dir ? (1) : (-1))) { //start at next square and go right 'till you hit the right side 
    			switch (curLev.squares[row][i]) {
    			case BLANK:
    				curLev.squares[row][i] = Squares.LASER_RED_EW;
    			case NEMIRROR:
    				curLev.squares[row][i] = Squares.LASER_RED_EW;
    				break;
    			case NEMIRROR_A:
    				curLev.squares[row][i] = Squares.LASER_RED_EW;
    				break;
    			case NWMIRROR:
    				curLev.squares[row][i] = Squares.LASER_RED_EW;
    				break;
    			case NWMIRROR_A:
    				curLev.squares[row][i] = Squares.LASER_RED_EW;
    				break;
    			case RECEPTOR:
    				curLev.squares[row][i] = Squares.LASER_RED_EW;
    				break;
    			}
    		}
    	}
    	
    	/** @param row 0 = top row
    	 * @param start starting location
    	 * @param dir true = down, false = up */
    	@SuppressWarnings("incomplete-switch")
    	public void updateCol(int col, int start, boolean dir) {
    		if (dir) {
    			for (int i = start + 1; i < curLev.squares[col].length; i++) { //start at square below and go down 'till you hit the bottom
    				switch (curLev.squares[i][start]) {
    				case BLANK:
    					curLev.squares[i][start] = Squares.LASER_RED_NS;
    					break;
    				case NEMIRROR:
    				case NEMIRROR_A:
    					updateRow(i, start, !dir);
    					break;
    				case NWMIRROR:
    				case NWMIRROR_A:
    					updateRow(i, start, dir);
    					break;
    				case RECEPTOR:
    					
    					break;
    				}
    				
    				//if mirror -> update row
    			}
    		} else {
    			for (int i = start - 1; i > 0; i--) { //start at square above and go up 'till you hit the top
    			
    				//if mirror -> update row
    			}
    		}
    		
    	}
    	
    	@SuppressWarnings("incomplete-switch")
    	@Override
    	public void render(GameContainer container, StateBasedGame sbg, Graphics g) throws SlickException {
    		//Sidebar Graphic
    		Game.imgBuffer.draw(); //(0, 0)
    		
    		//Game Grid
    		int buffer = Game.imgBuffer.getWidth();
    		for (int y = 0; y < curLev.squares.length; y++) {        //Rows
    			for (int x = 0; x < curLev.squares[0].length; x++) {    //Columns
    				Game.imgBlank.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH); //Fill grid with blanks
    				
    				switch (curLev.squares[x][y]) {
    				case BLANK:
    					//0's are just place holders (Blanks)
    					break;
    				case NPOINTER:
    					Game.imgPointerN.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					Game.imgLaser_redNS_s.draw(x * Game.TILE_WIDTH + buffer + 50, y * Game.TILE_WIDTH + (Game.TILE_WIDTH / 2) - 62);
    					break;
    				case EPOINTER:
    					Game.imgPointerE.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					Game.imgLaser_redEW_s.draw(x * Game.TILE_WIDTH + buffer + 100, y * Game.TILE_WIDTH + (Game.TILE_WIDTH / 2) - 12);
    					break;
    				case SPOINTER:
    					Game.imgPointerS.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					Game.imgLaser_redNS_s.draw(x * Game.TILE_WIDTH + buffer + 50, y * Game.TILE_WIDTH + (Game.TILE_WIDTH / 2) + 37);
    					break;
    				case WPOINTER:
    					Game.imgPointerW.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					Game.imgLaser_redEW_s.draw(x * Game.TILE_WIDTH + buffer + 1, y * Game.TILE_WIDTH + (Game.TILE_WIDTH / 2) - 12);
    					break;
    				case NWMIRROR:
    					Game.imgMirrorNW.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					break;
    				case NWMIRROR_A:
    					Game.imgMirrorNW.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					Game.imgLaser_redNS_s.draw(x * Game.TILE_WIDTH + buffer + 50, y * Game.TILE_WIDTH + (Game.TILE_WIDTH / 2) - 62);
    					Game.imgLaser_redEW_s.draw(x * Game.TILE_WIDTH + buffer + 1, y * Game.TILE_WIDTH + (Game.TILE_WIDTH / 2) - 12);
    					break;
    				case NEMIRROR:
    					Game.imgMirrorNE.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					break;
    				case NEMIRROR_A:
    					Game.imgMirrorNE.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					Game.imgLaser_redNS_s.draw(x * Game.TILE_WIDTH + buffer + 50, y * Game.TILE_WIDTH + (Game.TILE_WIDTH / 2) - 62);
    					Game.imgLaser_redEW_s.draw(x * Game.TILE_WIDTH + buffer + 1, y * Game.TILE_WIDTH + (Game.TILE_WIDTH / 2) - 12);
    					break;
    				case RECEPTOR:
    					Game.imgReceptor.draw(x * Game.TILE_WIDTH + buffer, y * Game.TILE_WIDTH);
    					break;
    				case LASER_RED_NS:
    					Game.imgLaser_redNS.draw(x * Game.TILE_WIDTH + buffer + (Game.TILE_WIDTH / 2), y * Game.TILE_WIDTH);
    					break;
    				case LASER_RED_EW:
    					Game.imgLaser_redEW.draw(x * Game.TILE_WIDTH + buffer + (Game.TILE_WIDTH / 2) - 2, y * Game.TILE_WIDTH);
    					break;
    				//				case LASER_BLUE_EW:
    				//Unimplemented
    				//Game.laser_blueEW.draw(j * Game.TILE_WIDTH + buffer + (Game.TILE_WIDTH / 2) - 2, i * Game.TILE_WIDTH);
    				//					break;
    				//				case LASER_BLUE_NS:
    				//Unimplemented
    				//Game.laser_blueNS.draw(j * Game.TILE_WIDTH + buffer + (Game.TILE_WIDTH / 2), i * Game.TILE_WIDTH);
    				//					break;
    				//				case LASER_GREEN_EW:
    				//Unimplemented
    				//Game.imgLaser_greenEW.draw(j * Game.TILE_WIDTH + buffer + (Game.TILE_WIDTH / 2) - 2, i * Game.TILE_WIDTH);
    				//					break;
    				//				case LASER_GREEN_NS:
    				//Unimplemented
    				//Game.imgLaser_greenNS.draw(j * Game.TILE_WIDTH + buffer + (Game.TILE_WIDTH / 2), i * Game.TILE_WIDTH);
    				//					break;
    				}
    			}
    			g.setFont(GameState.font);
    			
    			Game.drawButton(g, btnMainMenu, "Main Menu", 10, 5);
    			Game.drawButton(g, btnReset, "Reset", 10, 5);
    			Game.drawButton(g, btnLevelSelect, "Level Select", 10, 5);
    			Game.drawButton(g, btnQuit, "Quit", 10, 5);
    		}
    	}
    	
    	/** @returns game grid row (0 being uppermost) or -1 for out of bounds */
    	private int getRow(int y, Level level) {
    		if (y > Game.HEIGHT || y < 0) return -1;
    		
    		int imgHeight = Game.imgBlank.getHeight();
    		
    		for (int i = 0; i < level.squares[0].length; i++)
    			//For every square in the row (# of squares in array)
    			if (y <= imgHeight * (i + 1)) return i;
    		return -1;
    	}
    	
    	/** @returns game grid column (0 being leftmost) or -1 for out of bounds */
    	private int getCollumn(int x, Level level) {
    		if (x > Game.WIDTH || x < 0) return -1;
    		
    		int buffer = Game.imgBuffer.getWidth(); //left side where there is no grid
    		int imgWidth = Game.imgBlank.getWidth();
    		
    		if (x <= buffer) return -1; //mouse is in the buffer area
    			
    		for (int i = 0; i < level.squares.length; i++)
    			//For every square in the column (# of arrays)
    			if (x <= buffer + (imgWidth * (i + 1))) return i;
    		return -1;
    	}
    	
    	@Override
    	public int getID() {
    		return States.GAMESTATE.ordinal();
    	}
    }
    
  • HijriDate

    Rhyfmedia        
    0 Likes0 Commentsjavascript

    function Hijri(year, month, day)
    {
      this.year = year;
      this.month = month;
      this.day = day;
      this.toFixed = hijriToFixed;
      this.toString = hijriToString;
    }
  • angular.js

    ijmacdowell        
    0 Likes0 Commentsjavascript

    <html ng-app>
     <!-- Body tag augmented with ngController directive  -->
     <body ng-controller="MyController">
       <input ng-model="foo" value="bar">
       <!-- Button tag with ng-click directive, and
              string expression 'buttonText'
              wrapped in "{{ }}" markup -->
       <button ng-click="changeFoo()">{{buttonText}}</button>
       <script src="angular.js">
     </body>
    </html>