Skip to content

Instantly share code, notes, and snippets.

@pandora2092
pandora2092 / sequelize-schema-file-generator.js
Created January 16, 2024 19:25 — forked from manuelbieh/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
import * as models from "models";
import Sequelize from "sequelize";
import fs from "fs";
delete models.default;
const sequelize = new Sequelize(
'',
'',
'', {
@pandora2092
pandora2092 / aws-sdk-example.php
Created January 29, 2021 15:03 — forked from harshavardhana/aws-sdk-example.php
AWS SDK PHP example with minio server
<?php
// Include the SDK using the Composer autoloader
date_default_timezone_set('America/Los_Angeles');
require 'vendor/autoload.php';
$s3 = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'us-east-1',
'endpoint' => 'http://localhost:9000'
]);
@pandora2092
pandora2092 / navigation.php
Created December 18, 2020 16:45 — forked from robincornett/navigation.php
updated Walker_Nav_Menu_Dropdown class for strict standards
<?php
/**
* source: http://www.billerickson.net/code/wordpress-menu-as-select-dropdown/
* Use this class to set up a nav menu to use as a dropdown menu.
*/
class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu{
function start_lvl( &$output, $depth = 0, $args = array() ){
@pandora2092
pandora2092 / CSS
Created July 21, 2020 13:18
Button wave
button{
position: relative;
overflow: hidden;
border: none;
cursor: pointer;
color: white;
padding: 15px 40px;
border-radius: 2px;
font-size: 22px;
box-shadow: 2px 2px 4px rgba(0, 0, 0, .4);
/*jslint continue:true*/
/**
* Adapted from {@link http://www.bulgaria-web-developers.com/projects/javascript/serialize/}
* Changes:
* Ensures proper URL encoding of name as well as value
* Preserves element order
* XHTML and JSLint-friendly
* Disallows disabled form elements and reset buttons as per HTML4 [successful controls]{@link http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2}
* (as used in jQuery). Note: This does not serialize <object>
* elements (even those without a declare attribute) or
@pandora2092
pandora2092 / nginx_nodejs.md
Created April 5, 2020 11:56 — forked from tomasevich/nginx_nodejs.md
Сервер в связке Nginx + NodeJs

Сервер в связке Nginx + NodeJs

Данная пошаговая инструкция поможет освоить основы на простом примере

Для справки

Сервер поднимался на Debian 8 c характеристиками:

CPU - 1 ядро x 500 МГц

@pandora2092
pandora2092 / firebase-messaging-sw.js
Created January 29, 2020 14:30 — forked from loicginoux/firebase-messaging-sw.js
Adding FCM to an html page to receive notifications and sending then via FCM ruby gem. (edit: HTTPS needed!)
// [START initialize_firebase_in_sw]
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({
@pandora2092
pandora2092 / javascript.translit.js
Last active August 27, 2020 15:02 — forked from diolavr/javascript.translit.js
JavaScript translater russian to translit
function rus_to_latin ( str ) {
var ru = {
'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',
'е': 'e', 'ё': 'e', 'ж': 'j', 'з': 'z', 'и': 'i',
'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o',
'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u',
'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', 'ш': 'sh',
'щ': 'shch', 'ы': 'y', 'э': 'e', 'ю': 'u', 'я': 'ya'
}, n_str = [];
@pandora2092
pandora2092 / Angular
Created September 12, 2019 10:00
Подтверждение закрытие модального окна
http://qaru.site/questions/335391/angular-2-easy-way-to-make-a-confirmation-dialog
public closeDialog(): void {
this.dialogRef = this.dialog.open(ConfirmComponent, {
disableClose: false
});
this.dialogRef.beforeClosed().subscribe(result => {
if (result) {
this.dialogRefHeaderClose.close();
@pandora2092
pandora2092 / CSS
Created August 29, 2019 11:11
Вертикальное выравнивание через position relative
position relative
top 50%
margin-top -180px
Выравнивание по вертикали.
сдивигаем на 50%, и добавляем отрицательный отструп в половину размера центрируемого объекта