Skip to content

Instantly share code, notes, and snippets.

Fabio Cigliano lidio601

Block or report user

Report or block lidio601

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lidio601
lidio601 / loadScript.js
Last active Jan 18, 2020
Load custom script into DOM (with Promise)
View loadScript.js
/**
* Dinamically load script into DOM
* @see https://gist.github.com/lidio601/81974ecf4564dbf257f80a969dcbdd5c
*
* Example usage:
* {code}
require('./loadScript');
console.log('starting');
@lidio601
lidio601 / block-signup.md
Created Jan 14, 2020
Google Cloud function to automatically disable new users
View block-signup.md

Firebase Authentication

Via this Cloud Function you can automatically disable new users.

To deploy this, replace with yours and deploy via command line with:

gcloud functions deploy block-signup --runtime nodejs10 --trigger-event providers/firebase.auth/eventTypes/user.create --trigger-resource <PROJECT-ID>
View logger.js
/* eslint-disable no-console */
import _ from "lodash";
const DEBUG = !process.env.NODE_ENV || process.env.NODE_ENV === "development";
class ConfigHolder {
constructor(initialValue) {
this.value = initialValue;
}
@lidio601
lidio601 / solution.c
Created Nov 28, 2019
C test to check if a number is prime
View solution.c
#include <stdbool.h>
#ifndef Solution_INCLUDED
#define Solution_INCLUDED
bool IsPrime(int input);
#endif
@lidio601
lidio601 / react_native_starter.sh
Last active Oct 2, 2019
React Native app starter kit
View react_native_starter.sh
# ensure right cli is installed
npm uninstall -g react-native-cli
npm i -g @react-native-community/cli
# create app from template
APPNAME=myapp
npx react-native init ${APPNAME} --template react-native-template-typescript
cd ${APPNAME}
@lidio601
lidio601 / AppDelegate.m
Last active Jul 31, 2019
React Native - native module started kit (iOs)
View AppDelegate.m
// ...
#import "FooModule.h"
// ...
@interface AppDelegate ()
// ...
@property (nonatomic, strong) FooModule *fooModule;
// ...
@end
View fibonacci.js
function fibonacci (n) {
if (n < 1) return 0;
var a = [1, 1];
var sum = 1;
while (n-- > 2) {
sum += a[0];
a = a.slice(1).concat(sum);
}
return sum;
}
View update.20181121.log
This file has been truncated, but you can view the full file.
23:19:37 stopping lamassu-server
lamassu-server: stopped
lamassu-admin-server: stopped
23:19:37 archiving old lamassu-server installation located in /usr/lib/node_modules/lamassu-server
tar: Removing leading `/' from member names
removed '/usr/lib/node_modules/lamassu-server/todo.txt'
removed '/usr/lib/node_modules/lamassu-server/.jshintrc'
removed '/usr/lib/node_modules/lamassu-server/currencies.json'
removed '/usr/lib/node_modules/lamassu-server/data-notes.txt'
View update.20181121.log
04:11:06 stopping lamassu-server
lamassu-server: ERROR (not running)
lamassu-admin-server: ERROR (not running)
04:11:06 unlinking old /usr/local/bin/lamassu* executables
04:11:06 updating node
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
+ n@2.1.12
updated 1 package in 0.336s
04:11:08 version installed v10.13.0
04:11:08 updating lamassu-server#master
View install.log
02:50:15 Enabling swap file for install only...
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=6d85a17f-26ae-4535-8444-ed542394032c
02:50:15 Updating system...
## Installing the NodeSource Node.js 8.x LTS Carbon repo...
## Populating apt-get cache...
You can’t perform that action at this time.