Skip to content

Instantly share code, notes, and snippets.

@jamiees2
jamiees2 / Enquire
Created March 9, 2013 22:09
A simple media query snippet for enquire.js
enquire.register("screen and (max-width:803px)",{
match: function(){
//code to do when the media query matches
},
unmatch: function(){
//code do do when the media query does not match
}
});
private void CreateButtons()
{
int y = 50;//y-hnit takkans
int x = 0;//x-hnit takkans
int width = 35;//Breidd takkans
int height = 35;//Hæð takkans
int xMargin = 3;//x - Margin takkans
int yMargin = 3;//y - Margin takkans
@jamiees2
jamiees2 / dabblet.css
Created April 27, 2013 19:41
Circular Tooltip (SO)
/**
* Circular Tooltip (SO)
* http://stackoverflow.com/q/13132864/1397351
*/
* { margin: 0; padding: 0; }
body {
overflow: hidden;
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg);
}
/* generic styles for button & circular menu */
#!/bin/python
# Head ends here
def displayPathtoPrincess(n,grid):
#Find where you are, and where the princess is
princessX, princessY = findInArray('p',n,grid)
princeX, princeY = findInArray('m',n,grid)
if princessY > princeY:
print '\n'.join(["DOWN"] * (princessY-princeY))
elif princeY > princessY:
#!/bin/python
# Head ends here
def nextMove(n,y,x,grid):
princessX, princessY = findInArray('p',n,grid)
if princessY > y:
return "DOWN"
elif y > princessY:
return "UP"
if x > princessX:
return "LEFT"
#!/usr/bin/python
dirts = []
finished = False
selected = -1
def find_all_dirts(board):
global dirts
n = len(board)
m = len(board[0])
for x in range(n):
#!/usr/bin/python
# Head ends here
dirts = []
unfound = []
full_board = None
selected = None
def update_board(board):
global full_board, unfound, dirts, update_count
if full_board == None:
complement_memo = {}
def complement(ar):
a, b = ar
total = 0
for i in xrange(a,b+1):
if not i in complement_memo:
complement_memo[i] = count(i)
total += complement_memo[i]
print total
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int count(unsigned int u)
{
unsigned int uCount;
@jamiees2
jamiees2 / dfs.py
Last active December 17, 2015 01:10
#!/usr/bin/python
#class Node:
# def __init__(self,point,parent=None):
# self.point = point
# self.parent = parent
# Head ends here
explored = []
def nextMove( x, y, pacman_x, pacman_y, food_x, food_y, grid):