Skip to content

Instantly share code, notes, and snippets.

@413x1
413x1 / app.module.ts
Last active February 16, 2024 04:59
nest_custom_validation.ts
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { UsersModule } from './users/users.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { typeOrmConfig } from './configs/db';
import { IsUniqueConstraint } from './utils/validators';
@Module({
imports: [
@AndrzejKomarnicki
AndrzejKomarnicki / awsamplifyexpo.js
Last active February 19, 2023 08:51
AWS Amplify and AppSync with Expo (React Native) cheat sheet
AWS Amplify and AppSync with Expo (React Native) cheat sheet and reference guide
[AWS Amplify] https://aws-amplify.github.io
[Expo] https://expo.io
// In order to run the Android emulator with Expo you will need Android Studio with Android Virtual Device Manager
// In order to run the iOS simulator with Expo you'll need Xcode
INITIALIZE PROJECT
@pixeline
pixeline / php_upgrade_to_71.sh
Last active March 16, 2023 16:49
Update Mac Os X's php version to php 7.1 using homebrew. Includes curl and mcrypt
# 1. Install brew --> http://brew.sh/
# 2. run the following commands in your Terminal
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install --with-openssl curl
brew install --with-homebrew-curl --with-apache php71
brew install php71-mcrypt php71-imagick
# 3. Follow these instructions to make Apache and php-cli use the newer php executable and make the change persist after reboot.
brew info php71
@pablodenadai
pablodenadai / RouteChangeStart.js
Last active May 23, 2019 13:28
AngularJS: On route change start - Check if user has permission to proceed or redirect it to the Sign In page.
app.run(function ($rootScope, $location, AuthenticationModel) {
// Register listener to watch route changes.
$rootScope.$on('$routeChangeStart', function (event, next, current) {
if (!AuthenticationModel.isSignedIn() && next.requireAuthentication === true) {
$location.path('/signin');
}
});
});
@dmozzy
dmozzy / CalcDistance.js
Created April 16, 2012 13:00
Calculate Distance using google.maps.geometry.spherical.computeDistanceBetween
<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry" type="text/javascript"></script>
<script type="text/javascript">
function calcDistance (fromLat, fromLng, toLat, toLng) {
return google.maps.geometry.spherical.computeDistanceBetween(
new google.maps.LatLng(fromLat, fromLng), new google.maps.LatLng(toLat, toLng));
}
</script>
@nateps
nateps / gist:1172490
Created August 26, 2011 01:38
Hide the address bar in a fullscreen iPhone or Android web app
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>Test fullscreen</title>
<style>
html, body {
margin: 0;
padding: 0;