Skip to content

Instantly share code, notes, and snippets.

View oliveiracdz's full-sized avatar

Daniel Oliveira oliveiracdz

View GitHub Profile
@austintackaberry
austintackaberry / modal.tsx
Created February 19, 2023 22:54
Plasmo Chakra UI Modal
import Calendar from "~components/Calendar"
import { useEffect, useRef, useState } from "react"
import cssTextFcDaygrid from "data-text:@fullcalendar/daygrid/main.css"
import cssTextFcCommon from "data-text:@fullcalendar/common/main.css"
import cssTextFcTimegrid from "data-text:@fullcalendar/timegrid/main.css"
import cssTextGlobals from "data-text:~styles/globals.css"
import {
ChakraProvider,
Modal,
ModalBody,
@brysonreece
brysonreece / tailwind.config.js
Created February 22, 2020 07:30
Tailwind Social Colors
// colors from materialui.co/socialcolors
module.exports = {
theme: {
colors: {
'facebook': '#3b5999',
'messenger': '#0084ff',
'twitter': '#55acee',
'linkedin': '#0077b5',
'skype': '#00aff0',
@Checksum
Checksum / websocket_proxy.js
Last active June 1, 2024 23:42
Intercepting WebSockets in the browser using JavaScript
const WebSocketProxy = new Proxy(window.WebSocket, {
construct(target, args) {
console.log("Proxying WebSocket connection", ...args);
const ws = new target(...args);
// Configurable hooks
ws.hooks = {
beforeSend: () => null,
beforeReceive: () => null
};
@jjxtra
jjxtra / HttpContext_RemoteIPAddress.cs
Last active June 3, 2024 04:20
C# / .NET core: Get Remote IP Address with Proxy / CDN Support
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace HttpContext_RemoteIPAddress
@mpowaga
mpowaga / docker-compose.yml
Created February 21, 2018 23:28
Mongo Replica Set with Docker Compose
version: "3"
services:
master:
image: mongo
links:
- slave
networks:
- mongo-cluster
volumes:
- ./init-repl-set.sh:/docker-entrypoint-initdb.d/init-repl-set.sh
@bolorundurowb
bolorundurowb / circle.yml
Last active February 28, 2022 12:29
A .NET/Dot Net Core 2.0 Circle CI configuration file (Uses CircleCI 1.0)
dependencies:
pre:
- curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
- sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
- sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
- sudo apt-get update
- sudo apt-get install dotnet-sdk-2.0.2
override:
- dotnet restore
test:
@kcmr
kcmr / browsersync.conf.js
Created August 6, 2017 00:08
Browser Sync for a Polymer Web Component
const bs = require('browser-sync').create();
const componentPath = `/components/${__dirname.split('/').pop()}`;
bs.init({
files: [ '**/*.{html,js,css}' ],
open: false,
ghostMode: false,
startPath: `${componentPath}/demo/index.html`,
serveStatic: [{
route: componentPath,
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@javisperez
javisperez / interceptors.js
Last active December 4, 2022 16:47
Axios interceptor for cache with js-cache
// Usually I use this in my app's config file, in case I need to disable all cache from the app
// Cache is from `js-cache`, something like `import Cache from 'js-cache';`
const cacheable = true,
cache = new Cache();
// On request, return the cached version, if any
axios.interceptors.request.use(request => {
// Only cache GET requests
if (request.method === 'get' && cacheable) {
@Tuizi
Tuizi / test-helper.spec.ts
Last active March 19, 2021 19:47
MockStore for Angular ngrx/store unit tests
import { Action, ActionReducer, Store } from '@ngrx/store';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { map } from 'rxjs/operator/map';
import { Observer } from 'rxjs/Observer';
// TODO: How to initialize those variables?
const dispatcherMock: Observer<Action>,
reducerMock: Observer<ActionReducer<any>>,
stateMock: Observable<any>;