Skip to content

Instantly share code, notes, and snippets.

View tjoskar's full-sized avatar

Oskar Karlsson tjoskar

View GitHub Profile
@tjoskar
tjoskar / radio.sh
Created October 3, 2020 10:10
Run radiostations
#!/bin/bash
echo ""
echo""
echo " 1 -> NRJ"
echo " 2 -> Studio 107.5"
echo " 3 -> 107.1 Vinyl"
echo " 4 -> The Voice"
echo " 5 -> Mix Megapol Radio City Göteborg"
echo " 6 -> Flashback Radio"
echo " 7 -> Mix MegaPol"
@tjoskar
tjoskar / package.json
Last active April 9, 2019 15:28
microbundle issue
{
"name": "tets",
"version": "1.0.0",
"description": "",
"main": "lib/index.js",
"source": "src/foo.js",
"module": "lib/foo.mjs",
"unpkg": "lib/foo.umd.js",
"dependencies": {},
"devDependencies": {
[
{
"url": "https://www.vegomagasinet.se/basilikagratang/",
"name": "BASILIKAGRATÄNG MED SOLTORKADE TOMATER",
"image": "https://www.vegomagasinet.se/wp-content/uploads/2018/04/basilikagrata%CC%88ng.jpg"
},
{
"url": "https://www.koket.se/per_morberg/varmratter/gronsaker__potatis_och_andra_rotfrukter/per_morbergs_raggmunk_med_flask/",
"name": "Raggmunk",
"image": "https://mittkok.expressen.se/wp-content/uploads/2013/10/raggmunks-700x700.jpg"
@tjoskar
tjoskar / stream-context.directive.ts
Last active August 29, 2021 04:33
How to use observables in angular 2 template
import { Directive, Input, TemplateRef, ViewContainerRef, EmbeddedViewRef, ChangeDetectorRef } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
@Directive({
selector: '[streamContext][streamContextOn]'
})
export class StreamContext {
@Input() streamContextOn: Observable<any>;
templateRef: TemplateRef<any>;
@tjoskar
tjoskar / 1.js
Last active May 22, 2016 14:04
Angular 2 chapter 1 solution
import { Component } from '@angular/core';
@Component({
selector: 'my-input',
template: `
<input [(ngModel)]="username">
<!--
Same as:
<input [value]="username" (keyUp)="username=$event.target.value">
-->
@tjoskar
tjoskar / next-episode.pipe.js
Last active May 22, 2016 10:14
Skeleton code for Chapter 3
import { Pipe } from '@angular/core';
import { Episode } from '../lib/contracts/episode';
@Pipe({
name: 'nextEpisode'
})
class NextEpisodePipe {
transform(episodes: Episode[]) {
const now = Date.now();
@tjoskar
tjoskar / date-string.pipe.js
Last active February 10, 2016 19:57
Skeleton code for angular lab 2
import {Pipe} from 'angular2/core';
@Pipe({
name: 'dateString'
})
class DateStringPipe {
transform(dateString: string, args: string[]) {
const [, year, month, day] = /^(\d\d\d\d)-(\d\d)-(\d\d)$/.exec(dateString) || [,,,,];
}
@tjoskar
tjoskar / angular2-vs-react.js
Last active January 31, 2016 14:00
Angular 2 vs react
const angular = 1 * '🍎';
const react = 1 * '🍐';
angular > react // false
angular < react // false
angular === react // false
@tjoskar
tjoskar / ApiController.cs
Last active October 21, 2015 16:09
PainlessHttp bug #1
namespace Demo.Controllers
{
public static class HttpSingleton
{
private static PainlessHttp.Client.HttpClient instance;
public static PainlessHttp.Client.HttpClient Instance
{
get
@tjoskar
tjoskar / mock-knex.js
Created August 12, 2015 19:39
Mocking knex with mock-knex
'use strict';
var mockKnex = require('mock-knex');
var knex = require('knex')({
client: 'mysql',
connection: {
host: 'localhost',
user: 'user',
password: 'password',
database: 'database',