Skip to content

Instantly share code, notes, and snippets.

View matagus's full-sized avatar
🐿️
I miss the old Github activity stream

Matías Agustín Méndez matagus

🐿️
I miss the old Github activity stream
View GitHub Profile
@matagus
matagus / favorite.js
Created September 23, 2014 17:46
favorite.js for django-favit with support for dynamic items added at any time
$(document).ready(function() {
$(".endless_container").on("click", ".btn.favorite", function() {
var $obj = $(this);
var target_id = $obj.attr('id').split('_')[1];
$obj.prop('disabled', true);
$.ajax({
url: $obj.attr('href'),
type: 'POST',
data: {target_model: $obj.attr('model'),
target_object_id: target_id},
@matagus
matagus / vimrc
Last active August 29, 2015 14:06
vim config using vim-bundle (vundle)
" disable vi compatibility
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
Bundle 'gmarik/vundle'
// using jQuery
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
require "cjson"
-- Generic decoder for JSON logs. This will extract all JSON
-- keys and add them to the `Fields` variable of the created
-- Heka message.
--
-- Example use:
--
-- [NginxJsonLogDecoder]
-- type = "SandboxDecoder"
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@matagus
matagus / booting-and-flashing.md
Last active August 29, 2015 14:00
Flashing Firefox OS for Geekphone
  • Download the image you want to flash from http://downloads.geeksphone.com/ according to the geekphone model you have (keon, peak or revolution)
  • unzip .zip
  • cd
  • If you look at the content of the directory you'll see it contains adb and fastboot Android platform tools.
  • Start adb server: sudo ./adb start-server
  • Turn on your phone and enable "Remote Debugging" under Developer settings section.
  • Plug your phone to your computer using your USB wire.
  • Check that your computer is listening to your phone: ./adb devices. You'll see something like this:
@matagus
matagus / opml.xml
Created March 13, 2014 10:31
planetdjango.org opml file listing all its feeds
<?xml version="1.0"?>
<opml version="1.1">
<head>
<title>Planet Django</title>
<dateModified>Sat, 08 Mar 2014 20:57:35 +0000</dateModified>
<ownerName>Adomas Paltanavičius</ownerName>
<ownerEmail>adomas.paltanavicius@gmail.com</ownerEmail>
</head>
<body>
@matagus
matagus / rabbitmq.config
Last active January 2, 2018 20:50
a sample rabbitmq config file, tested with RabbitMQ 3.0.2, Erlang R15B01
[
{rabbit, [
{auth_backends, [rabbit_auth_backend_internal]},
{auth_mechanisms, ['PLAIN','AMQPLAIN']},
{backing_queue_module, rabbit_variable_queue},
{cluster_nodes, []},
{collect_statistics, coarse},
{collect_statistics_interval, 5000},
{default_permissions, [<<".*">>,<<".*">>,<<".*">>]},
{default_user, <<"guest">>},
server {
server_name www.sarasa.com sarasa.com;
if ($host != 'sarasa.com' ) {
rewrite ^/(.*)$ http://sarasa.com/$1 permanent;
}
# Serve an empty 1x1 gif _OR_ an error 204 (No Content) for favicon.ico
location = /favicon.ico {
empty_gif;
Spanish
Portuguese
English
Norwegian
Hungarian
Danish
Finish
French
Italian
Dutch