Skip to content

Instantly share code, notes, and snippets.

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

Alberto Miedes Garcés amiedes

🏠
Working from home
View GitHub Profile
@amiedes
amiedes / partidas_id_1_mataro.json
Created October 25, 2019 14:37
Partidas con id 1
[
{
"organization_id": "8121",
"ine_code": 8121,
"province_id": 8,
"autonomy_id": 9,
"year": 2017,
"population": 50000,
"amount": 50238240.85,
"code": "1",
@amiedes
amiedes / test.json
Created July 2, 2019 10:48
JSON api
[
{
"value": "asdfasdfa",
"raw_value": {
"ca": "sfasdfasdf",
"es": "asdfasdfa"
},
"custom_field_type": "localized_string",
"custom_field_name_translations": {
"ca": "amiedes - Texto traducido",
@amiedes
amiedes / atom_fragment.atom
Created April 26, 2019 17:31
atom fragment
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:cbc-place-ext="urn:dgpe:names:draft:codice-place-ext:schema:xsd:CommonBasicComponents-2"
xmlns:cac-place-ext="urn:dgpe:names:draft:codice-place-ext:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:dgpe:names:draft:codice:schema:xsd:CommonBasicComponents-2"
xmlns:cac="urn:dgpe:names:draft:codice:schema:xsd:CommonAggregateComponents-2"
xmlns:ns1="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
<author>
<name>Plataforma de Contratación del Sector Público</name>
<uri>https://contrataciondelestado.es</uri>
@amiedes
amiedes / regular_tender_notice.json
Created April 4, 2019 14:25
Regular Tender File
{
"CallForTenders": {
"xmlns": "urn:dgpe:names:draft:codice:schema:xsd:CallforTenders-2",
"xmlns:ext": "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2",
"xmlns:cbc_place_ext": "urn:dgpe:names:draft:codice-place-ext:schema:xsd:CommonBasicComponents-2",
"xmlns:cac_place_ext": "urn:dgpe:names:draft:codice-place-ext:schema:xsd:CommonAggregateComponents-2",
"xmlns:cbc": "urn:dgpe:names:draft:codice:schema:xsd:CommonBasicComponents-2",
"xmlns:cac": "urn:dgpe:names:draft:codice:schema:xsd:CommonAggregateComponents-2",
"UBLVersionID": "2.1",
"CustomizationID": "CODICE 2.04",
@amiedes
amiedes / queries.sql
Created February 13, 2019 11:59
Decidim metrics queries
/* This query is generated by the development_app and it's OK */
SELECT Count(*) AS count_all,
decidim_categorizations.decidim_category_id AS
decidim_categorizations_decidim_category_id,
"participatory_space_type" AS participatory_space_type,
"participatory_space_id" AS participatory_space_id,
decidim_components.id AS decidim_components_id
FROM "decidim_accountability_results"
INNER JOIN "decidim_components"
@amiedes
amiedes / stats.txt
Created February 11, 2019 13:19
Decidim Stats
bundle exec rake decidim:metrics:all["2017-12-23"]
bundle exec rake decidim:metrics:all["2017-12-24"]
bundle exec rake decidim:metrics:all["2017-12-25"]
bundle exec rake decidim:metrics:all["2017-12-26"]
bundle exec rake decidim:metrics:all["2017-12-27"]
bundle exec rake decidim:metrics:all["2017-12-28"]
bundle exec rake decidim:metrics:all["2017-12-29"]
bundle exec rake decidim:metrics:all["2017-12-30"]
bundle exec rake decidim:metrics:all["2017-12-31"]
bundle exec rake decidim:metrics:all["2018-01-01"]
@amiedes
amiedes / dataset_schema.json
Last active November 26, 2018 15:12
ckanext-fluent schema
{
"scheming_version": 1,
"dataset_type": "dataset",
"about": "A reimplementation of the default CKAN dataset schema",
"about_url": "http://github.com/ckan/ckanext-scheming",
"dataset_fields": [
{
"field_name": "title",
"label": "Title Wadus",
"preset": "title",
@amiedes
amiedes / index.html
Created October 19, 2018 15:20
Minimal page with Google Translate
<!DOCTYPE html>
<html>
<head>
<script src="http://governobert.gencat.cat/web/resources/fwkResponsive/fpca_capcalera/js/fpca_capcalera.js" type="text/javascript"></script>
<script type="text/javascript" src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</head>
@amiedes
amiedes / custom_layout_example.html
Created October 15, 2018 12:31
Custom Layout Example
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- GENCAT META -->
<!---->
<title>Funció pública. Govern obert</title>
@amiedes
amiedes / show_poll.rb
Created February 28, 2018 19:29
refactor method
def next_poll(current_site, current_user, poll_id = nil)
poll = GobiertoParticipation::Poll.by_site(current_site).find(poll_id) if poll_id
answerable_polls = GobiertoParticipation::Poll.by_site(current_site).answerable.order(ends_at: :asc)
answerable_polls_by_user = answerable_polls.detect { |p| p.answerable_by?(current_user) } if current_user
if current_user
if poll && poll.answerable_by?(current_user)
poll
elsif answerable_polls_by_user
answerable_polls_by_user