Skip to content

Instantly share code, notes, and snippets.

View zwacky's full-sized avatar

Simon zwacky

View GitHub Profile
@zwacky
zwacky / string-vs-String.ts
Created October 21, 2016 22:34
TypeScript: string (primitive type) vs String (object type)
let objectType: String = 'first string';
let primitiveType: string = 'second string';
objectType = primitiveType; // √
primitiveType = objectType; // compiler error
@zwacky
zwacky / Nice Fonts
Created October 7, 2016 13:11
Nice fonts I came across the last years
- QuicksandBook
- QuicksandLight
- BLOKK
- Lobster
- DroidSerif
- PT Sans
- Freight Sans Pro
- Lane
- Source Sans Pro
- Robotolight
/**
* e.g. retrieving field values from a form.
*/
function getDateFromForm() {
const props = ['year', 'month', 'day', 'hour', 'minutes', 'sec', 'milisec'];
return props.map((prop) => {
return document.querySelector(`#${prop}`).text;
});
}
@zwacky
zwacky / spread-example.js
Last active January 20, 2016 15:13
ES6 spread to the rescue
// get all items of all players
/* WITHOUT ES6 spread operator */
const items = [];
players.forEach((player) => {
player.forEach((item) => {
items.push(item);
});
});
@zwacky
zwacky / isoCurrency.filter.js
Created November 25, 2014 14:53
isoCurrency Filter
angular.module('app')
.filter('isoCurrency', function($filter) {
var currencies = {
"ALL":{"text":"Lek"},
"AFN":{"text":"؋"},
"ARS":{"text":"$"},
"AWG":{"text":"ƒ"},
"AUD":{"text":"$"},
"AZN":{"text":"ман"},
@zwacky
zwacky / clear-cache.sh
Created October 22, 2014 14:50
clear cache on apache mod_pagespeed
touch /var/cache/mod_pagespeed/cache.flush
/* declaration */
@size-tn: ~"(max-width: 479px)";
@size-xs: ~"(min-width: 480px) and (max-width: 767px)";
@size-sm: ~"(min-width: 768px) and (max-width: 991px)";
@size-md: ~"(min-width: 992px) and (max-width: 1199px)";
@size-lg: ~"(min-width: 1200px)";
/* example usage */
footer {
@media @size-xs {
/* TINY DEVICES (tn) */
@media (max-width: 479px) {
}
/* EXTRA SMALL DEVICES (phones) */
@media (max-width: 767px) {
}
@zwacky
zwacky / package.json
Created September 20, 2014 16:47
general-gulp-file
{
"name": "general-gulp-file",
"version": "0.1.0",
"devDependencies": {
"gulp": "*",
"gulp-load-plugins": "*",
"multipipe": "*",
"gulp-less": "*",
"gulp-concat": "*",
"gulp-uglify": "*",
@zwacky
zwacky / gulpfile.js
Last active June 5, 2020 22:57
Example gulpfile.js to get it going with LESS and AngularJS
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var rimraf = require('rimraf');
var paths = {
less: ['./less/*.less'],
js: ['./js/app/*.js', './js/app/**/*.js'],
jsView: ['./js/app/views/*.html'],
dist: {
css: './public/css/',