Skip to content

Instantly share code, notes, and snippets.

View andion's full-sized avatar
🐶

Lucas Andión Montáns andion

🐶
View GitHub Profile
@JaimeObregon
JaimeObregon / observatorios.txt
Last active March 19, 2024 21:35
Pero, ¿cuántos observatorios financiados con dinero público hay en España?
Observatori Municipal de l'Habitatge d'Alcoi
Observatorio Autonómico dos Ríos de Galicia
Observatorio da Sociedade da Información e a Modernización de Galicia
Observatorio da Violencia no Contorno Laboral
Observatorio de Administración Electrónica
Observatorio de Igualdad de Oportunidades entre Mujeres y Hombres
Observatorio de la Cadena Alimentaria
Observatorio de la Ciencia Ciudadana
Observatorio de la Gestión Empresarial en Biodiversidad
Observatorio de la Infancia de España
@alana314
alana314 / testheadphones.sh
Created March 21, 2019 17:59
Test if headphones are plugged in -- OS X shell script
#!/bin/bash
if system_profiler SPAudioDataType | grep --quiet Headphones; then
echo plugged in
else
echo not plugged in
fi
@davidbarral
davidbarral / npmenv.completions.fish
Last active November 22, 2017 10:36
Poor man npmenv solution for fish (Use multiple .npmrc profiles)
# Completions for npmenv.fish
function __fish_npmenv_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = 'npmenv' ]
return 0
end
return 1
end
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
@gaearon
gaearon / slim-redux.js
Last active May 5, 2024 15:14
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@pixeltrix
pixeltrix / time_vs_datatime.md
Last active February 18, 2024 19:20
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
@t2
t2 / birthday_liker.rb
Last active September 23, 2016 14:10
Like and Comment on every 'Happy Birthday' post on your Facebook feed at once.
require 'date'
require 'koala'
class BirthdayLiker
FACEBOOK_TOKEN = 'your_oauth_key'
BIRTHDAY_WORDS = %w(birthday bday birfday birth born)
THANKS_OPTIONS = ['Thank you!', 'Thanks!', 'Appreciate it!']
DATE_TIME_FORMAT = '%Y-%m-%d'
def initialize(birthdate, opts={})
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@lyschoening
lyschoening / angular.resources.coffee
Last active December 26, 2015 05:39
Nested Resources in Angular JS. Allows for embedding resources inside the JSON response of other collections as well as for cross-referencing between resources by their URI. See example file for usage (second file). Makes use of Object.defineProperty which requires IE8+
$resourceMinErr = angular.$$minErr('$resource')
angular.module('resources', [])
.provider 'Resource', () ->
provider = @
provider.prefix = '/api/v1'
provider.uriField = 'resource_uri'
class ResourceBase
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.