A business card concept I created for a little challenge over at http://reddit.com/r/web_design!
A Pen by Eduard Kosicky on CodePen.
// Before April 2017 run this with flags: | |
// node --harmony-async-await ./async-test.js | |
function sayHi (name) { | |
if (name == null) throw Error('Missing name') | |
return `Hi ${name}.` | |
} | |
function sayWhatsUpAsync (msg, timeoutMs) { | |
console.log(`Will return in ${timeoutMs / 1000}s`) |
"use strict"; | |
var utils = require('loader-utils'); | |
module.exports = function (content) { | |
var opt = utils.parseQuery(this.query); | |
return opt.data ? opt.data + content : content; | |
}; |
"use strict"; | |
function jsonToSassVars (obj, indent) { | |
// Make object root properties into sass variables | |
var sass = ""; | |
for (var key in obj) { | |
sass += "$" + key + ":" + JSON.stringify(obj[key], null, indent) + ";\n"; | |
} | |
// Store string values (so they remain unaffected) |
var camelCase = require('lodash.camelcase'); | |
const {Map, Record, List} = require('immutable'); | |
class Todo extends Record({ description: null, completed: false }) { | |
toggle() { | |
return this.set('completed', !this.completed); | |
} | |
} | |
const InitialTodoApp = Record({ |
/** | |
* prepareTransition | |
* | |
* jQuery Plugin for ensuring transitions with display:none or visibility:hidden | |
* are in the right state until the end of the transition | |
* | |
* By John W. Long (http://wiseheartdesign.com) | |
* April 18, 2013 | |
* | |
* Based on the prepareTransition plugin by Jonathan Snook (http://snook.ca). This version |
// convert 0..255 R,G,B values to binary string | |
RGBToBin = function(r,g,b){ | |
var bin = r << 16 | g << 8 | b; | |
return (function(h){ | |
return new Array(25-h.length).join("0")+h | |
})(bin.toString(2)) | |
} | |
// convert 0..255 R,G,B values to a hexidecimal color string | |
RGBToHex = function(r,g,b){ |
A business card concept I created for a little challenge over at http://reddit.com/r/web_design!
A Pen by Eduard Kosicky on CodePen.
function get_avatar_from_service(service, userid, size) { | |
// this return the url that redirects to the according user image/avatar/profile picture | |
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback | |
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px ) | |
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word ) | |
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px ) | |
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word ) | |
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px ) | |
// everything else will go to the fallback | |
// google and gravatar scale the avatar to any site, others will guided to the next best version |