Skip to content

Instantly share code, notes, and snippets.

View macagua's full-sized avatar
🏠
Working from home

Leonardo J. Caballero G. macagua

🏠
Working from home
View GitHub Profile
@eveningkid
eveningkid / how-to-use-react-intl.md
Created July 28, 2017 16:33
How To Use React-Intl: internationalize your React app

How To Use React-Intl: internationalize your React app

This short tutorial assumes you know about ES6 syntax.

Get started

yarn add react-intl or npm i --save react-intl.

Create a messages file

This file should contain every message for your app.
It has an object of (locale, messages) couples:

@pigeonflight
pigeonflight / README.rst
Last active July 27, 2017 20:56
Use patternslib inject and auto-submit to quickly build a standalone search form in Plone

Setup

  • This requires Plone 5.1 with plone.patternslib and rapido.plone installed

The files should be located in your theme under the rapido folder of your theme. The tree might look like this:

rapido
    views
        blocks
            searchdemo.pt
@thomasdarimont
thomasdarimont / app.py
Last active May 6, 2025 12:41
Simple python example using flask, flask_oidc and keycloak
import json
import logging
from flask import Flask, g
from flask_oidc import OpenIDConnect
import requests
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__)
@ThiefMaster
ThiefMaster / indico_awesome_themes***__init__.py
Last active January 17, 2023 16:26
the `***` in the filenames are placeholders for `/` (which are not possible in gists)
# empty
@thet
thet / upgrades.py
Created June 12, 2017 13:53
Plone / Zope Component Architecture: Unregister all broken persistent utilities
# -*- coding: utf-8 -*-
from zope.component.hooks import getSite
import logging
log = logging.getLogger(__name__)
def unregister_broken_persistent_components(context):
portal = getSite()
sm = portal.getSiteManager()
@dperaltab
dperaltab / purchase.py
Created June 8, 2017 20:16
Method has_group odoo
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
@api.one
def _get_verify_user_group(self):
self.verify_user_group = False
if self.env['res.users'].has_group('purchase.group_purchase_manager'):
self.verify_user_group = True
def _default_user_group(self):
# See official docs at https://dash.plotly.com
# pip install dash pandas
from dash import Dash, dcc, html, Input, Output
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv')
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# get top requests by URL
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 8, 2025 16:02
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@apisandipas
apisandipas / share-urls.md
Last active March 31, 2025 07:50 — forked from chrisl8888/drupal-views-share-global-text-field
Share url's for Facebook, Twitter, Pinterest and Linkedin with just get variables

Creating share buttons with just URL's

Twitter

http://twitter.com/share?text=<TITLE>&url=<URL>

E.g. http://twitter.com/share?text=This+is+google+a+search+engine&url=https%3A%2F%2Fwww.google.com

Facebook

http://www.facebook.com/sharer.php?u=&amp;p[title]=