Skip to content

Instantly share code, notes, and snippets.

View ardcore's full-sized avatar
🏠
<3 rust

Szymon Piłkowski ardcore

🏠
<3 rust
View GitHub Profile
'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 October 13, 2021 20:35
atom.io 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
@ardcore
ardcore / gist:4995572
Created February 20, 2013 13:31
rgb to hex
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("");
}
@ardcore
ardcore / robot.js
Created December 4, 2012 23:08
Test1
//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);
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 August 8, 2011 17:01
detect globals looped
// this code sux.
(function() {
function getKeys(object) {
var keys = [];
for (var key in object) {
if (!key.match(/^_Firebug/)) {
keys.push(key);
}
}
@ardcore
ardcore / gist:1054298
Created June 29, 2011 16:53
yui3 require?
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
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
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";