Skip to content

Instantly share code, notes, and snippets.

View manekinekko's full-sized avatar
:octocat:
Check me out on BlueSky @wassim.dev

Wassim Chegham manekinekko

:octocat:
Check me out on BlueSky @wassim.dev
View GitHub Profile
@manekinekko
manekinekko / open-in-cloud-shell.md
Last active September 2, 2025 03:02
gcloud.tips: use the Google Cloud Shell to clone and edit a github repository

Open a github repository in the Cloud Shell

The Google Cloud Shell gives you a handy and quick Shell access to your Cloud instance. One thing you may not know is that you can use the Cloud Shell to clone and edit a Github project. Let's see how.

The trick here is to just call the following URL: https://console.cloud.google.com/cloudshell/open with the following parameters:

  1. git_repo: this is the URL to your github repository
  2. open_in_editor: this would be the file you want to open in the editor
  3. page=editor: this tells the cloud shell to open the code editor
@manekinekko
manekinekko / add-custom-domain-to-appengine-app.md
Last active December 4, 2017 19:39
gcloud.tips: add a custom domain to an appengine project

Add a custom domain to an App Engine application

When creating an App Engine app, you may want to use a custom domain name, instead of the generate one at https://[YOUR_PROJECT_ID].appspot.com. Here is how:

  1. Buy your domain name at your favorite registar (e.g. domains.google or namesilo.com),
  2. Head to https://console.cloud.google.com/appengine/settings/domains/add?project=[YOUR_PROJECT_ID],
  3. Update the DNS records of your custom domain as described in the form,
  4. By default, you'll get a free, Google-managed, auto-renewing SSL certificate!
  5. Enjoy.
@manekinekko
manekinekko / deploy-cloud-function-from-repo.md
Last active August 24, 2023 16:39
gcloud.tips: deploy cloud function from a Google Cloud Repository

Deploy a Cloud Function from a repository

Google Cloud Functions allows you to deploy small logical units of code (i.e. functions). While it is already possible to deploy these functions from a Google Cloud Storage bucket or directly from the inline editor (e.g. for prototyping purposes), did you know that you can take advantage of the Google Cloud Repository to host the Cloud Functions source code and automate these deployments? You could for instance trigger a new deploy after each git push. Let's see how.

We'll assume you already have a working Google Cloud Repository (how to setup a Cloud Repository) with the following configuration:

  • projectID: project-123
  • repository name: default
  • default branch: master
  • function name: function-123
@manekinekko
manekinekko / actions-on-google-handle-permissions.js
Last active July 11, 2019 20:21
handling permissions in DialogFlow and Actions On Google
'use strict';
const functions = require('firebase-functions');
const DialogflowApp = require('actions-on-google').DialogflowApp;
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const requestPermission = (app) => {
app.askForPermission('To locate you', app.SupportedPermissions.DEVICE_PRECISE_LOCATION);
};
@manekinekko
manekinekko / angular.ts
Last active July 27, 2017 14:12
A TODO component in: Angular, React and Vue
import { Component, Output, Input, EventEmitter } from '@angular/core';
@Component({
selector: 'todo-item',
styleUrls: ['./style.css'],
template: `
<li>
<div>
<div>
<img [src]="item.details.image" [alt]="item.details.name" />
</div>
@manekinekko
manekinekko / privacy-policy.html
Last active July 25, 2017 22:36
Generic Privacy Policy
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<body>
<h2>Privacy Policy</h2>
<p>Wassim Chegham built [[ APPLICATION_NAME ]] as a open source app. This SERVICE is provided by Wassim Chegham at no cost and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding my policies with the collection, use, and
disclosure of Personal Information if anyone decided to use my Service.</p>
// this code sample is just for fun
// WARNING: don't write this ugly code in production
(async (a) => {
for await (const o of (async function* () {yield* await a })()) {
console.log(o);
}
})(Promise.all([1,2,3]));
<section>
{% if title %}
<h2>{{ title }}</h2>
{% endif %}
{{ content_1 }}
{% if content_2 %}
{{ content_2 }}
{% endif %}
@manekinekko
manekinekko / check-permutation.js
Last active March 12, 2017 23:26
Check if "s1" is a permutation of "s2"
function checkPermutationWithSort(s1, s2) {
if (s1.length > 0 && s1.length === s2.length) {
return Array.from(s1).sort().join('') === Array.from(s2).sort().join('');
}
return false;
}
function checkPermutationWithDatastructure(s1, s2) {
const m = {};
for(let x=0; x<s1.length; x++) {
@manekinekko
manekinekko / 🤘.js
Created February 23, 2017 14:07
Dependency Injector Library
/**
* Dependency Injector module.
* @type {Class}
* @author Wassim Chegham
*/
class DI {
dependencies = {};
modules = {};
factory(ctor, deps) {
return new ctor.apply(ctor, deps);