View anonymous.java
ParseUser.enableAutomaticUser();
ParseUser.getCurrentUser().saveInBackground();
View AbsolutePosition
var data = {};
$('body').mousedown(function (event) {
data.element = event.toElement;
data.top = parseInt($(data.element).css('top'), 10);
data.bottom = parseInt($(data.element).css('bottom'), 10);
data.right = parseInt($(data.element).css('right'), 10);
data.left = parseInt($(data.element).css('left'), 10);
data.vField = isNaN(data.top) ? 'bottom' : 'top';
data.vValue = $(data.element).css(data.vField);
View Useful linux commands
# Enable proxy
sudo a2enmod proxy_http
# Start mongodb daemon
mongod --fork --logpath /data/db/mongod.log
# Stop mongodb daemon
mongod --shutdown
# Start nodejs daemon
View gist:6096598
$ git checkout --orphan new-master master
$ git commit -m "Initial commit for new root"
$ git branch -D master
$ git branch --move new-master master
View interface.ts
interface Shape {
name: string;
width: number;
height: number;
color?: string;
}
function area(shape : Shape) {
var area = shape.width * shape.height;
return "I'm " + shape.name + " with area " + area + " cm squared";
View svgGrid
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="smallGrid" width="8" height="8" patternUnits="userSpaceOnUse">
<path d="M 8 0 L 0 0 0 8" fill="none" stroke="#333" stroke-opacity="0.5" stroke-width="0.5"/>
</pattern>
<pattern id="grid" width="80" height="80" patternUnits="userSpaceOnUse">
<rect width="80" height="80" stroke="gray" stroke-width="1" stroke-opacity="0.5" fill="url(#smallGrid)"/>
<path d="M 80 0 L 0 0 0 80" fill="none" stroke="gray" stroke-width="2"/>
</pattern>
</defs>
View gist:3170509
NSLog(@"log: %@ ", myString);
NSLog(@"log: %f ", myFloat);
NSLog(@"log: %i ", myInt);