Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View webdesignberlin's full-sized avatar
:octocat:
...

Michael Raguse webdesignberlin

:octocat:
...
View GitHub Profile
@simevidas
simevidas / gist:cd4c5af291dec41a816f
Last active August 29, 2015 14:03
color parsing API
/*
* Tab Atkins's color parsing API proposal
* Source: http://www.w3.org/blog/CSS/2014/07/10/minutes-telecon-219/
*/
var color;
// creating color objects from RGBA components
color = RGBAColor(50, 100, 150, .5);
color = RGBAColor({ r: 50, g: 100, b: 150, a: .5 });
@webdesignberlin
webdesignberlin / indicator.js
Last active August 29, 2015 14:17
Get an Object of all Mediaquery Variables
// Create the mediaquery-indicator element
var indicator = document.createElement('div');
indicator.className = 'mq-indicator';
document.body.appendChild(indicator);
// Read Object like content
var mediaQueriesString = window.getComputedStyle(indicator,'::before').content;
/* replace \ cause firefox escape this string */
mediaQueriesString = mediaQueriesString.replace(/\\/g, '');
/* remove first and last quote */
@nrstott
nrstott / app.js
Created September 21, 2011 15:01
Bogart CouchDB Blog code translated to use MongoDB
var bogart = require('bogart');
var Q = require('promised-io/lib/promise');
var mongoose = require('mongoose');
var PostSchema = new mongoose.Schema({
title: String,
body: String,
comments: [ CommentSchema ]
});
<!doctype html>
<html>
<head>
<title>Tabs Demo!</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
.container {
margin-top: 20px;
}
@Webastronaut
Webastronaut / mixin-prefix.css
Last active January 2, 2016 05:39
Stop writing SASS mixins for every CSS attribute that needs a vendor prefix by using this simple Prefix-Mixin
/**
* Mixin for adding vendor prefixes to CSS attributes; useful for the following CSS attributes
*
* - border-radius
* - box-shadow
* - transition
* - transform
* - background-size
* - box-sizing
* - animate
app.post("/purchase", (req, res) => {
user.findOne(req.body, (err, userData) => {
if (err) return handleError(err);
permissions.findAll(userData, (err2, permissions) => {
if (err2) return handleError(err2);
if (isAllowed(permissions)) {
transaction.process(userData, (err3, confirmNum) => {
if (err3) return handleError(err3);
res.send("Your purchase was successful!");
});
app.post("/purchase", async function (req, res) {
const userData = await user.findOneAsync(req.body);
const permissions = await permissions.findAllAsync(userData);
if (isAllowed(permissions)) {
const confirmNum = await transaction.processAsync(userData);
res.send("Your purchase was successful!")
}
});
@emilbjorklund
emilbjorklund / breakpoints_via_css.html
Created April 24, 2012 16:03
Width detection via sneaky CSS rules
<!DOCTYPE html>
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>Breakpoint detection test</title>
<style type="text/css" media="screen">
@media screen and (min-width: 320px) {
#page:after {
content: 'smallest'; /* represent the current width-bracket */
@marcobarbosa
marcobarbosa / front-end-setup.md
Last active November 29, 2016 06:16
Reference for the steps necessary to code a good front-end project on a Mac.

Front-end coding environment set-up

This guide covers pretty much all that you need to have installed in your Mac for a top notch front-end coding environment.

This guide also assumes that you are going to use yeoman or grunt for your project.

XCode

It is recommended that you have Xcode installed and it's Command Line Tools to give you any command line binary that you might need (such as wget). You can also download it within Xcode itself

@dnaber-de
dnaber-de / dna-tpl-to-admin-bar.php
Last active April 13, 2018 15:05
WordPress plugin to show the current used template file name in the admin bar.
<?php
/**
* Plugin Name: dna Template Name to Admin Bar
* Plugin URI: https://gist.github.com/4690246
* Description: Shows the current used theme template file in the admin bar. (Requires PHP 5.3)
* Author: David Naber
* Author URI: http://dnaber.de/
* Version: 2013.11.09
* License: MIT