Skip to content

Instantly share code, notes, and snippets.

View leopic's full-sized avatar

Leo Picado leopic

View GitHub Profile
@farandal
farandal / gist:6144701
Created August 3, 2013 01:34
Translated default messages for the jQuery validation plugin. Spanish
/*
* Translated default messages for the jQuery validation plugin.
* Locale: ES
*/
jQuery.extend(jQuery.validator.messages, {
required: "Este campo es obligatorio.",
remote: "Por favor, rellena este campo.",
email: "Por favor, escribe una dirección de correo válida",
@albemuth
albemuth / inUrl.js
Last active December 23, 2015 18:49 — forked from leopic/inUrl.js
_.mixin({
inUrlDry: function(singleParam) {
//en vez de usar un arreglo para manegar los keys, vals se crea un map, así
//se puede accesar directamente en vez de tener que buscar con index of,
//esa parte pasa de O(n) a O(1) primero se hace un arreglo que tiene una
//estructura así: [[param, {decodedValue: 'val', rawValue: 'val'}]...] y el
//metodo _.object pasa de eso a
//{param: {decodedValue: 'val', rawValue: 'val'}}
var paramMap = _.chain(location.search.slice(1).split('&'))
// TODO: filtro?
crear y destruir los ingredientes
var ingredientes = '2@Tazas de arroz; 3@Aguacates mexicanos; 1@Banano en rodajas;',
separadorIngredientes = ';',
separadorCantidades = '@';
var separados = _.map(_.compact(ingredientes.split(separadorIngredientes)), function(ingArr) {
var tmp = ingArr.trim().split(separadorCantidades);
return {
cantidad: parseInt(_.first(tmp), 10),
@anaimi
anaimi / Serializable.swift
Created July 9, 2014 03:51
Serialize a Swift object to JSON or Dictionary, with selective properties.
/*
Purpose:
Convert (or Serialize) an object to a JSON String or Dictionary.
Usage:
Use 'Serialize.toJSON' on instances of classes that:
- Inherit from NSObject
- Implement 'Serializable' protocol
- Implement the property 'jsonProperties' and return an array of strings with names of all the properties to be serialized
@ZevEisenberg
ZevEisenberg / resetAllSimulators.sh
Last active December 23, 2024 19:57
Reset all iOS simulators with this one weird trick
osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all
@nathansmith
nathansmith / this-is-madness.css
Last active October 6, 2015 10:36
Examples of CSS selector strength.
* {}
tag {}
[attribute] {}
[attribute="value"] {}
.class {}
@juliengdt
juliengdt / SwiftIntegerChecker.swift
Created August 26, 2015 07:48
To check if a number is between a range in Swift
// To check if a number is between a range, don't do
if number >=0 && number <= 100 {
}
// Use range and news operators instead :
if 0...100 ~= number {
}
@klein-artur
klein-artur / complementaryColor.swift
Last active May 14, 2025 00:49
get complementary color to UIColor in Swift
// get a complementary color to this color:
func getComplementaryForColor(color: UIColor) -> UIColor {
let ciColor = CIColor(color: color)
// get the current values and make the difference from white:
let compRed: CGFloat = 1.0 - ciColor.red
let compGreen: CGFloat = 1.0 - ciColor.green
let compBlue: CGFloat = 1.0 - ciColor.blue
@zacwest
zacwest / ios-font-sizes.swift
Last active September 25, 2025 07:59
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 17
.extraLargeTitle, .extraLargeTitle2,
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]

HomeKit Service and Characteristic UUIDs

Thanks to HAP-NodeJS

Service UUID
Accessory Information 0000003E-0000-1000-8000-0026BB765291
Air Quality Sensor 0000008D-0000-1000-8000-0026BB765291
Battery Service 00000096-0000-1000-8000-0026BB765291
Bridging State 00000062-0000-1000-8000-0026BB765291