Skip to content

Instantly share code, notes, and snippets.

View hofiorg's full-sized avatar

Christian Hofmann hofiorg

View GitHub Profile
@hofiorg
hofiorg / polymer_header.html
Last active August 29, 2015 14:05
polymer - core-scroll-header-panel
<!DOCTYPE html>
<html>
<head>
<title>TITLE</title>
<link href="http://fonts.googleapis.com/css?family=RobotoDraft:300,400,500|Source+Code+Pro:400,500,700" rel="stylesheet">
<script src="../bower_components/platform/platform.js"></script>
@hofiorg
hofiorg / replace_all.js
Last active August 29, 2015 14:05
javascript - replaceAll
function replaceAll(find, replace, str) {
return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
@hofiorg
hofiorg / http_get.js
Created August 11, 2014 13:59
javascript - httpGet
function httpGet(url) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", url, false );
xmlHttp.send( null );
return xmlHttp.responseText;
}
@hofiorg
hofiorg / where.dart
Created August 12, 2014 09:35
dart - iterate a collection with where
main() {
List mycollection = ['a', 'ab', 'abc', 'abcd', 'abcde'];
mycollection.where((c) => c.contains('d'))
.forEach((c) => print(c));
}
@hofiorg
hofiorg / round_image.html
Created August 12, 2014 13:18
html - displays image in a circle
<img src="bild.jpg" style="-webkit-border-radius: 50%;border-radius: 50%"/>
@hofiorg
hofiorg / process_start.dart
Created August 13, 2014 08:05
dart - start system process (windows)
import 'dart:io';
void main() {
Process.start('cmd /c start c:/Windows/System32/notepad.exe', [], workingDirectory: 'c:/Windows/System32/');
}
@hofiorg
hofiorg / github_gist.html
Last active August 29, 2015 14:05
webcomponents - display code snippet (gist) on your website
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/platform/platform.js"></script>
<script src="bower_components/polymer/polymer.js"></script>
<link rel="import" href="bower_components/github-gist/github-gist.html">
</head>
<body>
<github-gist gistid="30cd29e38ff2f01af7b4"></github-gist>
@hofiorg
hofiorg / paper_icon_button.html
Last active August 29, 2015 14:05
polymer - usage paper-icon-button
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/platform/platform.js"></script>
<link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="bower_components/core-icons/social-icons.html">
<style shim-shadowdom>
paper-icon-button.twitter {
@hofiorg
hofiorg / monokai.css
Last active August 5, 2017 20:16
monokai theme css for github-gist
.gist
{
color: #000;
}
.gist .render-container .render-viewer-error,
.gist .render-container .render-viewer-fatal,
.gist .render-container .octospinner
{
display: none;
}
@hofiorg
hofiorg / polymer-github-card.html
Last active August 29, 2015 14:06
webcomponents - polymer-github-card
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/platform/platform.js"></script>
<link rel="import" href="bower_components/polymer-github-card/dist/polymer-github-card.html">
</head>
<body>
<div>
<polymer-github-card user="hofiorg"></polymer-github-card>