This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hexagon(x,y,w,h){ | |
return paper.path( | |
'M' + (x+12) + ',' + y | |
+ 'L' + (x+12+w) + ',' + y | |
+ 'L' + (x+24+w) + ',' + (y+(h/2)) | |
+ 'L' + (x+12+w) + ',' + (y+h) | |
+ 'L' + (x+12) + ',' + (y+h) | |
+ 'L' + x + ',' + (y+(h/2)) | |
+ 'L' + (x+12) + ',' + y | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.columns_6{ | |
@page-width: 960px; | |
@columns: 6; | |
@gutter: 30px; | |
overflow: hidden; | |
[class*='grid_']{ | |
display: block; | |
float: left; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Files .htaccess> | |
order allow,deny | |
deny from all | |
</Files> | |
RewriteEngine on | |
# Don't use rewrite if its a real file or folder | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myclass() | |
{ | |
// property | |
this.name = 'John'; | |
// method | |
this.greet = function() | |
{ | |
console.log('Hello ' + this.name); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var font = prompt('What font?'), font_encoded = font.replace(' ','+');document.head.innerHTML += '<link rel="stylesheet" href="http://fonts.googleapis.com/css?family='+font_encoded+'">';document.body.innerHTML += '<style>*{font-family: "'+font+'" !important;}</style>';})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// format | |
$db->method( $arg type, [$optional_arg type1|type2 default_val]) | |
// methods | |
$db->select( $fields string ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('socket', function ($rootScope) { | |
var socket = io.connect(); | |
return { | |
on: function (eventName, callback) { | |
socket.on(eventName, function () { | |
var args = arguments; | |
$rootScope.$apply(function () { | |
callback.apply(socket, args); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Annoying --> | |
<label for="dothething">Do the thing?</label> | |
<input type="checkbox" id="dothething" /> | |
<!-- Cool --> | |
<label for="dothething"> | |
<input type="checkbox" id="dothething"> Do the thing? | |
</label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function append(arr, string){ | |
// if the string does exist in the array .. | |
if(arr.indexOf(string) != -1){ | |
var n = 2; | |
var fin = false; | |
// .. loop indefinitely until we decide we have found a usable number. | |
while(!fin){ | |
// if the string + the number doesn't exist | |
if(arr.indexOf(string+' ('+n+')') == -1){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function merge(original, updates){ | |
for(var key in updates){ | |
if(updates[key] instanceof Object && !(updates[key] instanceof Array)){ | |
if(!original[key]) original[key] = {}; | |
original[key] = merge (original[key], updates[key]); | |
}else{ | |
original[key] = updates[key]; | |
} |