Skip to content

Instantly share code, notes, and snippets.

View dfa1234's full-sized avatar

David Faure dfa1234

  • NDA
  • Israel
  • 09:18 (UTC +03:00)
View GitHub Profile
@fcingolani
fcingolani / index.html
Created August 9, 2012 02:16
How to render a full PDF using Mozilla's pdf.js
<html>
<body>
<!-- really dirty! this is just a test drive ;) -->
<script type="text/javascript" src="https://raw.github.com/mozilla/pdf.js/gh-pages/build/pdf.js"></script>
<script type="text/javascript">
function renderPDF(url, canvasContainer, options) {
var options = options || { scale: 1 };
@cletusw
cletusw / get-old-chromium-binary.md
Last active December 7, 2020 18:32
Download an old Chromium binary

(source)

Taking [denilson-sá's answer][2] further...

You need revision numbers to grab downloads. So first lookup the full version string from the following URL, adjusting parameters as needed:

https://omahaproxy.appspot.com/history.json?channel=stable&os=mac

For Chrome version 28 the full version string is 28.0.1500.71. Now go to https://omahaproxy.appspot.com and enter the full version string ("28.0.1500.71") into the Position Lookup box. Copy the Base Position number ("209842" in this case).

@makenova
makenova / pritunlMigration.md
Last active April 20, 2024 21:50
move pritunl between servers

Migrating your pritunl install between servers

This is a small write up about how to migrate your pritunl install between servers. It's not especially detailed because I'm lazy and your migration story will most likely be different. All this can be avoided by using a remote/hosted mongo instance(compose.io, mongolab, etc.) and simply pointing your pritunl instance at that. If you want more details ask, and I'll do my best to answer and update this write-up accordingly. Also, feel free to criticize my grammar and spelling.

@MichalZalecki
MichalZalecki / index.js
Created March 12, 2016 12:24
How to import RxJS 5
// Import all
import Rx from "rxjs/Rx";
Rx.Observable
.interval(200)
.take(9)
.map(x => x + "!!!")
.bufferCount(2)
.subscribe(::console.log);
@NathanWalker
NathanWalker / base.component.ts
Created August 30, 2016 16:04
An Angular 2 custom Component decorator which sets ViewEncapsulation.None to all components that use it.
// angular
import {Component, ViewEncapsulation} from '@angular/core';
declare var Reflect: any;
const _reflect: any = Reflect;
// Usage:
// @BaseComponent({ etc... })
export function BaseComponent(metadata: any = {}) {
@petrofcikmatus
petrofcikmatus / Dockerfile
Last active June 16, 2023 08:08
Automated nginx proxy for Docker containers
FROM php:7.1-apache
RUN apt-get update \
&& apt-get install -y --no-install-recommends git zlib1g-dev libicu-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl gettext zip pdo pdo_mysql \
&& a2enmod rewrite \
&& sed -i 's!/var/www/html!/var/www/web!g' /etc/apache2/sites-available/000-default.conf \
&& mv /var/www/html /var/www/web \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
@nijicha
nijicha / install_nodejs_and_yarn_homebrew.md
Last active June 20, 2024 13:06
Install NVM, Node.js, Yarn via Homebrew
import React from "react";
import {
LayoutChangeEvent,
PanResponder,
PanResponderGestureState
} from "react-native";
import styled from "styled-components";
type StateType = {
barHeight: number | null,

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

import { EventEmitter, NgZone } from "@angular/core";
import { Observable, throttle } from "rxjs";
export class NoopNgZone implements NgZone {
readonly hasPendingMicrotasks = false;
readonly hasPendingMacrotasks = false;
readonly isStable = true;
readonly onUnstable = new EventEmitter<any>();
readonly onError = new EventEmitter<any>();