Skip to content

Instantly share code, notes, and snippets.

@juliusdejon
juliusdejon / settings.json
Created August 25, 2023 05:37
Mac Air vscode settings
{
"workbench.iconTheme": "vscode-icons",
"workbench.colorTheme": "Noctis Minimus",
"editor.wordWrap": "on",
"editor.fontLigatures": true,
"editor.fontSize": 15,
"editor.fontWeight": "400", // Regular,
"editor.tabSize": 2,
"editor.letterSpacing": 0.5,
"editor.cursorStyle": "line",
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/*!
* Copyright 2016 Yahoo Inc.
* Licensed under the terms of the MIT license. Please see LICENSE file in the project root for terms.
* @license
*/
var merge = require('merge');
/**
@juliusdejon
juliusdejon / service-worker.js
Created January 16, 2023 05:37
Service Worker Test
/* eslint-disable no-restricted-globals */
// This service worker can be customized!
// See https://developers.google.com/web/tools/workbox/modules
// for the list of available Workbox modules, or add any other
// code you'd like.
// You can also remove this file if you'd prefer not to use a
// service worker, and the Workbox build step will be skipped.
import { clientsClaim } from 'workbox-core';
@juliusdejon
juliusdejon / s3ListObjects.js
Created June 19, 2020 12:56
Consuming List Objects of s3, can be run on node by calling it `node s3ListObjects.js`
const aws = require('aws-sdk');
require('dotenv').config();
const s3 = new aws.S3({
signatureVersion: process.env.S3_SIGNATURE_VERSION,
region: process.env.S3_REGION
});
const params = {
/**
* Merge Search fields to form a query.
* @param {Array, String}
* @returns {Object}
*/
export function merge_searchable_fields(searchable_fields, q) {
let query = {};
@juliusdejon
juliusdejon / wordpress-apache.sh
Last active April 19, 2020 12:09
Wordpress Apache
#!/bin/bash
yum install httpd php php-mysql -y
cd /var/www/html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cp -r wordpress/* /var/www/html/
rm -rf wordpress
rm -rf latest.tar.gz
chmod -R 755 wp-content
chown -R apache:apache wp-content
/**
* Pagination settings.
*
* @param {Object} pagination: {page, limit}
* @returns {Object}
*/
export function paginate(pagination) {
const { page = 1, limit = 10 } = pagination;
const offset = (page - 1) * limit;
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"workbench.colorTheme": "Shades of Purple",
"editor.wordWrap": "on",
"editor.fontLigatures": true,
"editor.fontSize": 15,
"editor.fontWeight": "400", // Regular,
"editor.tabSize": 2,
"editor.letterSpacing": 0.5,
@juliusdejon
juliusdejon / Rakefile
Created December 4, 2018 02:18 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)