Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
<3 rust

Szymon Piłkowski ardcore

🏠
<3 rust
View GitHub Profile
View es6-tagged-template-fun.js
'use strict';
let assert = (condition) => {
if (!condition) throw new Error('assertion error')
}
let sum = (_,a,b) => a+b
let mul = (_,a,b) => a*b
let sub = (_,a,b) => a-b
let div = (_,a,b) => a/b
@ardcore
ardcore / atom-events
Last active Oct 13, 2021
atom.io events
View atom-events
application:open-your-keymap
application:open-your-stylesheet
autocomplete:attach
autoflow:reflow-paragraph
bookmarks:clear-bookmarks
bookmarks:jump-to-next-bookmark
bookmarks:jump-to-previous-bookmark
bookmarks:toggle-bookmark
bookmarks:view-all
check:correct-misspelling
View gist:4995572
function rgbToHex(r, g, b) {
var ret;
return [ r, g, b ].map( function(val) {
ret = val.toString(16);
return ret.length == 1 ? "0" + ret : ret;
}).join("");
}
View robot.js
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
View gist:2757662
function resolveCollisions() {
var collision = world.m_contactList;
if (!collision) return;
var obj1 = collision.GetShape1();
var obj2 = collision.GetShape2();
if ( (obj1.m_body.m_shapeList.renderType == "player" && obj2.m_body.m_shapeList.renderType == "exit") ||
@ardcore
ardcore / dglob.js
Created Aug 8, 2011
detect globals looped
View dglob.js
// this code sux.
(function() {
function getKeys(object) {
var keys = [];
for (var key in object) {
if (!key.match(/^_Firebug/)) {
keys.push(key);
}
}
View gist:1054298
pilkowski@dev:~$ npm ls | grep yui3
└─┬ yui3@0.6.2
└── yui3-core@3.3.0
pilkowski@dev:~$ node -v
v0.4.8
pilkowski@dev:~$ npm -v
1.0.13
pilkowski@dev:~$ node
> var y = require('yui3')
> !!y
View circle-vs-circle.js
var sth1 = {}, sth2 = {};
sth1.x = 10; // x pos
sth1.y = 10; // y pos
sth1.r = 10; // radius
sth2.x = 15; // x pos
sth2.y = 15; // y pos
sth2.r = 10; // radius
View gist:174547
var MyClass;
(function() {
MyClass = function() {
this.val = 2;
}
MyClass.prototype.publicFunction = function() {
return privateFunction.call(this);
}
privateFunction = function() {
return this.val + " is the value of val";