Skip to content

Instantly share code, notes, and snippets.

View spion's full-sized avatar
:shipit:

Gorgi Kosev spion

:shipit:
View GitHub Profile
@spion
spion / gist:3827639
Created October 3, 2012 15:39
typescript recursive interface test
interface LinkedListNode {
data:any;
next: LinkedListNode;
}
class MyNode {
data: string;
next: MyNode;
constructor(data: string, next:MyNode) {
this.data = data;
index 625e4b3..f85b8dc 100644
--- a/tmpl/blackout.tmpl.js
+++ b/tmpl/blackout.tmpl.js
@@ -155,7 +155,9 @@
else document.cookie = 'blackoutonce=1';
}
if (opts['serious'] !== true){
- blackout.appendChild(create('p', {paddingTop: '250px', color: '#fff', "font-size":"18px"}, txt(Sop
+ var clickToContinue = create('p', {paddingTop: '250px', color: '#fff', "font-size":"18px"});
+ clickToContinue.innerHTML = SopaBlackout.CONTINUE_TEXT;
@spion
spion / app.js
Created October 18, 2012 16:03
Quick and dirty regularStyle-to-CPS convertor in sweet.js
macro asyncp {
case { await { $body ... } $rest ... } => {
defers = 0;
done = (function() { asyncp { $rest ... } });
asyncp { $body ... }
}
@spion
spion / u-template.js
Created October 26, 2012 11:57
JS micro-templating
module.exports = function compile(str) {
var code = "var p=[],print=function(){p.push.apply(p,arguments);};"
+ "with(obj){p.push('" + str.replace(/[\r\t\n]/g, " ")
.split("<@").join("\t")
.replace(/((^|@>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)@>/g, "',$1,'")
.split("\t").join("');")
.split("@>").join("\np.push('")
.split("\r").join("\\'") + "');}return p.join('');";
return new Function("obj", code);
//XHR finished loading: "http://api.cosm.com/v2/feeds/64655".
{
"creator": "https://cosm.com/users/glisha",
"status": "live",
"tags": ["arduino", "ds18B20", "hackerspace", "скопје", "хаклаб"],
"description": "Temperature sensor network at Skopje hacklab with three DS18b20 and arduino.",
"created": "2012-06-23T23:22:59.135614Z",
"location": {
"disposition": "fixed",
"domain": "physical",
@spion
spion / fibrun.js
Created November 28, 2012 14:18
Convenience function to declare-and-run fibrous functions.
var fibrous = require('fibrous'),
fs = require('fs');
fibrun = function(f) {
fibrous(function(cb) {
f();
cb();
})(function(){});
}
@spion
spion / food.md
Last active October 13, 2015 20:37
Diet basics

This article contains some basic condensed knowledge about food.

Basic metabolism mechanics

Water

Water - your metabolism needs it. Have a full hand-held bottle nearby at all times. Drink liberally - most estimates of recommended amount fall between 3-5 liters per day (a lot more than what you will usually drink).

Infact, forget all other drinks, especially soft drinks and artificial juices. Most of them are sugary and will become fat minutes after you drink them. Replace them all with water.

@spion
spion / features.md
Last active October 6, 2022 21:00
Adding features to a software product

New features and changes workflow guide

This guide describes what steps usually work best when adding new features to a product. The guidelines are not mandatory; simpler features may not need any of these steps. They exist to help battle the hardest new features to add :)

The steps are not necessarily in the correct order - this is the usual order. Going back to an older step to add/change things is okay.

Brainstorming sessions

Goal: collect all that we can come up with for the new feature or change. Everything goes into an unorganized document (wiki page). Possible ways to organize this document is into proposal items (and proposal detail item for each proposal item).

@spion
spion / vegetables.md
Created January 2, 2013 11:52
Vegetable list

List of great vegetables

  • Amaranth or Chinese spinach
  • Artichoke
  • Artichoke hearts
  • Asparagus
  • Baby corn
  • Bamboo shoots
  • Beans (green, wax, Italian)
  • Bean sprouts
@spion
spion / cssforapps.md
Last active December 10, 2015 19:58
Layout CSS for web apps

Mobile layout

Mobile apps usually want a static header/footer around scrolling content. You have multiple options. Two of them suck:

iScroll and other JS-based solutions

Flexible but have random performance characteristics.

On some versions of Android with some kinds of content they're unbearably slow - and this is not because Android doesn't have requestAnimationFrame; depending on the content it can go below 1 frame per second.