Skip to content

Instantly share code, notes, and snippets.

View StevenLudwig's full-sized avatar
🎯
Focusing

Steve Ludwig StevenLudwig

🎯
Focusing
  • Mexico City, Mexico
  • 16:55 (UTC -06:00)
View GitHub Profile
@StevenLudwig
StevenLudwig / gist:49eb1a6e03bd2239d2b864c293b2e610
Created April 30, 2017 21:24 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@StevenLudwig
StevenLudwig / base.html
Created October 12, 2016 00:27 — forked from johnboiles/base.html
Jinja2 version of Django Rest Framework's rest_framework/templates/base.html file
<!DOCTYPE html>
<html>
<head>
{% block head %}
{% block meta %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="robots" content="NONE,NOARCHIVE" />
{% endblock %}

External configuration in Grails 3


Working on Grails 3 I realized that I no longer can specify external configuration using the standard grails.config.locations property in Config.groovy file.

Reason is obvious! There is no Config.groovy now in Grails 3. Instead we now use application.yml to configure the properties. However, you can't specify the external configuration using this file too!

What the hack?

Now Grails 3 uses Spring's property source concept. To enable external config file to work we need to do something extra now.

@StevenLudwig
StevenLudwig / Estados y Municipios
Created September 23, 2016 22:34 — forked from coffe67/Estados y Municipios
Estados y Municipios Mexico (SQL), La relación es un estado tiene n municipios.
-- Host: localhost:8889
-- Generation Time: Aug 29, 2014 at 05:26 PM
-- Server version: 5.5.34
-- PHP Version: 5.5.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `estados_municipios`
@StevenLudwig
StevenLudwig / html5-data.js
Created May 9, 2016 01:55 — forked from remy/html5-data.js
data-* support
(function () {
var forEach = [].forEach,
regex = /^data-(.+)/,
dashChar = /\-([a-z])/ig,
el = document.createElement('div'),
mutationSupported = false,
match
;
function detectMutation() {
@StevenLudwig
StevenLudwig / DjangoAjax.js
Created April 29, 2016 21:32 — forked from gaspardzul/DjangoAjax.js
Este Gist te permite configurar las peticiones AJAX que haces en proyectos Django utilizando Jquery.
/**
* Este script de javascript permite trabajar transparentemente solicitudes que requieren
* protección del token CSRF por medio de AJAX JQUERY.
* Esto te permitirá hacer solcitudes a web Services de Django por medio de AJAX Jquery.
* Para utilizarlo basta con integrar el archivo DjangoAjax.js en tu directorio de JS y hacer referencia a él en tus templates
* que requieren del uso de AJAX por POST o algún otro que requiera el token CSRF.
* Este script está basado en la documentación oficial de Django https://docs.djangoproject.com
*/
$(function(){
@StevenLudwig
StevenLudwig / Topic.scala
Created March 30, 2016 23:40 — forked from ericacm/Topic.scala
Example Hibernate entity in Scala
/*
* Topic Entity
*/
@Entity
@Table(uniqueConstraints = Array(new UniqueConstraint(columnNames=Array("application_id", "name"))))
@NamedQueries(Array(
new NamedQuery(name="Topic.findAllByApplication", query="from Topic where application=:application"),
new NamedQuery(name="Topic.findByApplicationAndName", query="from Topic where application=:application and name=:name")
))
class Topic {
@StevenLudwig
StevenLudwig / gist:05a6ac099d6a59416eba
Created October 13, 2015 22:02 — forked from osipov/gist:c2a34884a647c29765ed
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.10.4.deb
sudo dpkg -i scala-2.10.4.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.12.4/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
@StevenLudwig
StevenLudwig / gist:f553aa133e1acfd8fb4e
Created October 13, 2015 18:45 — forked from bigsnarfdude/gist:b2eb1cabfdaf7e62a8fc
ubuntu 14.04 install scala 2.11.7 and sbt 13.9
# scala install
wget www.scala-lang.org/files/archive/scala-2.11.7.deb
sudo dpkg -i scala-2.11.7.deb
# sbt installation
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt