Skip to content

Instantly share code, notes, and snippets.

View jpalala's full-sized avatar
🎯
Focusing

Jose Palala jpalala

🎯
Focusing
View GitHub Profile
From: Ian Lance Taylor
After many discussions and reading many comments, we plan to move
forward with some changes and clarifications to the generics design
draft.
1.
We’re going to settle on square brackets for the generics syntax.
We’re going to drop the “type” keyword before type parameters, as
@quinnjr
quinnjr / README.md
Last active August 22, 2024 09:33
How to easily add environment variables to an Angular application

How to easily add environment variables to an Angular application

This guide assumes that you already have an angular application set up by ng create and are using Angular CLI for compilation.

Other guides that I've read rely upon re-writing your environments/environment.ts|environment.prod.ts files with each compilation. I find this to be completely unnecessary when angular's internal use of webpack can just be extended to include environment variables.

1. Add @angular-builders/custom-webpack to your dev-dependencies

@simonerni
simonerni / csrf-protection-cloudflare-worker.js
Created July 7, 2018 14:52
Protect any origin from CSRF by checking if the Origin/Referer header match the Host header for "unsafe" methods.
/**
* GET and HEAD requests are by definition idempotent and should be handled by the origin as such. Thus, we can safely pass them on without further origin / referer checks.
*/
const safeMethods = ['GET','HEAD'];
const allowedMethods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE'];
addEventListener('fetch', event => {
event.respondWith(verifyAndFetch(event.request))
})
@smks
smks / mason.js
Last active June 10, 2020 18:30
This is a sample commander CLI application used in Medium Article - How I automated my Job with Node JS
#! /usr/bin/env node
const mason = require('commander');
const { version } = require('./package.json');
const console = require('console');
// commands
const create = require('./commands/create');
const setup = require('./commands/setup');
FROM node
RUN mkdir -p /usr/src/app
COPY index.js /usr/src/app
EXPOSE 8080
CMD [ "node", "/usr/src/app/index" ]
anonymous
anonymous / index.html
Created December 13, 2017 15:18
Justified container into center like in twitter
<div id="app">
<v-toolbar class="green">
<v-toolbar-title>Example vuetify template</v-toolbar-title>
</v-toolbar>
<v-app>
<v-content>
<v-container fluid grid-list-xl>
<v-layout row justify-center>
#!/bin/bash
#
# [Quick LEMP Stack Installation Script]
#
# GitLab: https://gitlab.com/devops212/lempqc
# Modief by wiros4bleng
#
bold=$(tput bold)
normal=$(tput sgr0)
cat <<!
@ibraheem4
ibraheem4 / postgres-brew.md
Last active February 11, 2025 10:40 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@paulredmond
paulredmond / Dockerfile
Created October 12, 2017 03:58
A Dockerfile for a Laravel PHP Application with Caddy Server
FROM php:7.1-fpm
LABEL maintainer="Paul Redmond <[email protected]>"
# Install application dependencies
RUN curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://caddyserver.com/download/linux/amd64?plugins=http.expires,http.realip&license=personal" \
| tar --no-same-owner -C /usr/bin/ -xz caddy \
&& chmod 0755 /usr/bin/caddy \
&& /usr/bin/caddy -version \