Skip to content

Instantly share code, notes, and snippets.

View materkel's full-sized avatar
🕺

Matthias Merkel materkel

🕺
View GitHub Profile
If you want to disable zoom on mobile use the following meta tag:
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
This will archieve the following:
- user can not zoom in or zoom out
- the page will always have a scale factor of 1
- as an added "bonus" this will get rid of the browser bounce, when the user reaches the end of the page while scrolling.
Use this technique with caution, because the accessibility of your page will suffer drastically.
No zooming means that your page might not be visible on some devices and that users have difficulty with accessing your website.

Emscripten as a linker for Zig and C

This shows how to build a nontrivial program using Zig+Emscripten or C+Emscripten. In both cases Emscripten is only used as a linker, that is the frontend is either zig or clang.

"Nontrivial" here means the program uses interesting Emscripten features:

  • Asyncify
  • Full GLES3 support
  • GLFW3 support
@dirkjonker
dirkjonker / nginx.conf
Last active December 5, 2022 11:10
NGINX JSON log configuration for Google Cloud / StackDriver log format
# this outputs JSON formatted logs which are easy to parse for any logging agent (such as fluentd)
# the format conforms to Google Cloud Logging so logs are nicely structured in the logs viewer
# see also: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#httprequest
# put the following lines in your nginx config
# /etc/nginx/nginx.conf
log_format json_combined escape=json
'{'
'"time":"$msec",'
@dam1
dam1 / resumableUpload.js
Created January 8, 2018 13:44
Resumable Upload Google Drive Api - Node Js
var fs = require('fs');
var request = require('request');
var EventEmitter = require('events').EventEmitter;
var mime = require('mime');
var util = require('util');
function resumableUpload() {
this.byteCount = 0; //init variables
this.tokens = {};
this.filepath = '';
@virolea
virolea / upload.js
Last active October 10, 2024 15:11
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@rhamedy
rhamedy / fileUploadsWithBusboy.js
Last active September 15, 2024 08:22
Upload files with busboy module nodejs and expressjs
//you do not necessary need all of the following, i copy/pasted a piece from
//one of my projects.
var express = require('express');
var fs = require('fs');
var Busboy = require('busboy');
var mime = require('mime');
var https = require('https');
var querystring = require('querystring');
var router = express.Router();
@swaldman
swaldman / GethAsAService.md
Last active October 9, 2022 02:18
Setting up geth as a service under systemd (Updated for Fedora 27)

Setting up geth as a service under systemd Fedora 27

Prerequisite: dnf install golang

  1. Create user geth with useradd
  2. As user geth fast sync the blockchain, geth --fast --cache 1024
  3. Manually run geth --rpc as user geth and watch to see that the blockchain continues to sync properly
  4. Install the geth.service file (also in this gist) in /usr/lib/systemd/system/
  5. Make a symlink from /etc/systemd/system/multi-user.target.wants/geth.service to /usr/lib/systemd/system/geth.service
  6. systemctl enable geth followed by systemctl start geth
import { Component, Input, AfterViewInit } from '@angular/core';
import { NgModel, DefaultValueAccessor, NgControl } from '@angular/forms';
import { Http, Headers, RequestOptions } from '@angular/http';
@Component({
selector: 'app-file-uploader',
template: '<input type="file" (change)="updated($event);">',
providers: [NgModel, DefaultValueAccessor]
})
export class FileUploaderComponent implements AfterViewInit {
@wkwiatek
wkwiatek / app-1.spec.ts
Last active December 17, 2021 01:52
Angular 2 test snippets for Angular final version. Codebase for https://developers.livechatinc.com/blog/category/programming/angular-2/
// App
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: '<span>{{ sayHello() }}</span>',
})
export class App {
public name: string = 'John';
@btroncone
btroncone / ngrxintro.md
Last active November 5, 2024 12:20
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents