Skip to content

Instantly share code, notes, and snippets.

@jamiees2
jamiees2 / 0_reuse_code.js
Created March 20, 2014 11:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jamiees2
jamiees2 / gist:6fd9805fb58fc0329c21
Created May 18, 2014 20:29
Set a git repository to its ssh version
git remote set-url origin $(echo "git@bitbucket.org:<TEAM>/$(git remote -v | grep -oh "[^/]*\.git" | head -n1)")
upstream blah_cluster {
server ip;
}
server {
server_name blah;
access_log /srv/logs/blah.log;
error_log /srv/logs/blah-error.log;
@jamiees2
jamiees2 / stylecheck.sh
Created January 19, 2015 22:04
client side hjalti shit
#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
echo "Running N'SIQ on" $1
echo "==========================================="
$DIR/nsiqcppstyle/nsiqcppstyle -f $DIR/profiles/nsiq-profile.txt $1
echo ""
echo "==========================================="
echo "N'SIQ finished"
echo "Now running vera++ on" $1
@jamiees2
jamiees2 / det.py
Created June 2, 2015 23:51
A fast LU decomposition algorithm, along with computing the determinant
def matrixMul(A, B):
TB = list(zip(*B))
return [[sum(ea*eb for ea,eb in zip(a,b)) for b in TB] for a in A]
def pivotize(m):
"""Creates the pivoting matrix for m."""
n = len(m)
ID = [[float(i == j) for i in range(n)] for j in range(n)]
r = 0
for j in range(n):
@jamiees2
jamiees2 / eye-test.js
Last active August 29, 2015 14:23
eye-test
setInterval(function(){
window.frames[0].document.querySelectorAll(".thechosenone")[0].style.backgroundColor = 'white';
},1500)
@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: