Skip to content

Instantly share code, notes, and snippets.

d-adamkiewicz

Block or report user

Report or block d-adamkiewicz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@d-adamkiewicz
d-adamkiewicz / index.html
Last active Aug 29, 2015
Simple back-forward text data widget example (pure JS, IE8)
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Simple widget</title>
<meta charset="utf-8" />
<style type="text/css">
</style>
</head>
<body>
<button id="back">&lt;&lt;</button>
@d-adamkiewicz
d-adamkiewicz / gist:9d9d149b959b5d5f2820
Last active Aug 29, 2015
YUI3.16.0/getStyle('background-image') bug - IE8/Firefox 29.0.1
View gist:9d9d149b959b5d5f2820
<!DOCTYPE html>
<html>
<head>
<title>YUI3.16.0/getStyle('background-image') bug - IE8/Firefox 29.0.1</title>
<meta charset="utf-8" />
<style type="text/css">
.pick div {
background-image: url(rect.png);
width: 41px;
height: 41px;
@d-adamkiewicz
d-adamkiewicz / event.html
Last active Aug 29, 2015
YUI3 event handling simple example
View event.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>YUI Event example</title>
<script src="http://yui.yahooapis.com/3.15.0/build/yui/yui-min.js"></script>
<style typr="text/css">
#clickable {
cursor: pointer;
background: #cdcdcd;
@d-adamkiewicz
d-adamkiewicz / app.js
Created Mar 11, 2014
express3-handlebars "render" and "loadTemplate" example
View app.js
var exphbs = require('express3-handlebars'),
hbs = exphbs.create();
var context = {data: 'Some girls wander by mistake'};
hbs.loadTemplate('test.hbs', function(err, compile) {
if (err) {
return console.error(err);
}
var compiled = compile(context);
console.log(compiled);
@d-adamkiewicz
d-adamkiewicz / application.json
Last active Aug 29, 2015
Sending data via form/js in Mojito (it works)
View application.json
[
{
"settings": [ "master" ],
"appPort": "8666",
"yui": {
"config": {
"filter": "raw"
}
},
"specs": {
@d-adamkiewicz
d-adamkiewicz / app.js
Created Jan 23, 2014
express and express-yui example
View app.js
var express = require('express'),
exphbs = require('express3-handlebars'),
expyui = require('express-yui'),
app = express();
expyui.extend(app);
// register file extension
app.engine('hbs', exphbs());
app.set('view engine', 'hbs');
@d-adamkiewicz
d-adamkiewicz / JSV_checking_JSON.js
Created Aug 15, 2012
JSV: checking JSON against array schema example
View JSV_checking_JSON.js
var JSV = require('jsv').JSV;
var json, schema;
var env = JSV.createEnvironment();
var report = env.validate(
json = [{a:1}, {b:1}],
schema = {type:'array',items:{type:'object', properties:{a:{type:'number'}}, additionalProperties: false}}
);
console.log(JSON.stringify(json, null, 4) + JSON.stringify(schema, null, 4));
if (report.errors.length === 0) {
console.log("success");
@d-adamkiewicz
d-adamkiewicz / foreachseries_mongodb.js
Created Apr 29, 2012
Using async/forEachSeries() to collect data from several mongodb collections and then call callback on it
View foreachseries_mongodb.js
var async = require('async');
var mongo = require('mongodb');
var Db = mongo.Db,
Server = mongo.Server,
Connection = mongo.Connection;
var db = new Db('local', new Server('127.0.0.1', Connection.DEFAULT_PORT, {}));
var collections = ['names', 'fruits'];
var retData = {};
View nodejs-yui3_append_and_one.js
#!/usr/bin/env node
var sys = require('sys'),
YUI = require('yui3').YUI;
YUI().use('node',function(Y){
Y.one('body').append('<div id="ala">ala ma kota</div>');
var ala = Y.one('#ala');
Y.log(ala);
document = Y.Browser.document;
ala = document.getElementById('ala');
You can’t perform that action at this time.