Skip to content

Instantly share code, notes, and snippets.

View gimenete's full-sized avatar

Alberto Gimeno gimenete

View GitHub Profile
@gimenete
gimenete / UIView+ActivityIndicator.h
Created July 11, 2013 09:01
Show an activity indicator in any UIView. Example: [imageView showActivityIndicator]; Then hide it [imageView hideActivityIndicator];
#import <Foundation/Foundation.h>
@interface UIView (ActivityIndicator)
- (void)showActivityIndicator;
- (void)showActivityIndicatorWithStyle:(UIActivityIndicatorViewStyle)style;
- (void)hideActivityIndicator;
@end
@gimenete
gimenete / gist:9377962
Created March 5, 2014 22:26
Run less.js in a sandbox
var fs = require('fs')
var path = require('path')
var vm = require('vm')
var util = require('util')
String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
}
var basedir = path.join(__dirname, 'less_files')+path.sep
Backbeam.addRealTimeConnectionListener(new RealTimeConnectionListener() {
@Override
public void realTimeConnecting() {
System.out.println("connecting...");
}
@Override
public void realTimeConnected() {
System.out.println("connected");
@gimenete
gimenete / gist:53704124583b5df3b407
Last active July 31, 2020 16:20
Animated rootViewController transition
// put this in your AppDelegate
- (void)changeRootViewController:(UIViewController*)viewController {
if (!self.window.rootViewController) {
self.window.rootViewController = viewController;
return;
}
UIView *snapShot = [self.window snapshotViewAfterScreenUpdates:YES];
[viewController.view addSubview:snapShot];
self.window.rootViewController = viewController;
@gimenete
gimenete / chain.js
Last active August 29, 2015 14:07
Promises-like control flow without promises
module.exports = function(f) {
var pro = {}
var chain = []
var end = null
function next() {
var f = chain.shift()
if (!f) {
end.apply(null, arguments)
} else {
@gimenete
gimenete / validate.js
Last active February 28, 2017 14:43
Validate input parameters in node.js requests
var _ = require('underscore')
var util = require('util')
function validate(request) {
var errors = []
var values = {}
var obj = {}
function validator(param) {
@gimenete
gimenete / compare-modules.js
Created October 17, 2014 21:14
Compare your installed node_modules with clean npm install
// mv node_modules node_modules_old && npm install
var fs = require('fs')
var path = require('path')
var node_modules = path.join(__dirname, 'node_modules')
var node_modules_old = path.join(__dirname, 'node_modules_old')
fs.readdir(node_modules, function(err, files) {
files.forEach(function(dir) {
if (dir.charAt(0) === '.') return
#!/usr/bin/env node
const express = require('express')
const graphqlHTTP = require('express-graphql')
const { buildSchema } = require('graphql')
const gql = `
type Message {
id: Int!
text: String!
@gimenete
gimenete / 2018.md
Last active December 31, 2017 15:19

2017

Cuando pienso en el pasado suelo utilizar años de referencia. Por ejemplo en 2002 empecé la universidad, en 2008 volví de vivir un tiempo en Madrid y en 2014 viví en EEUU. Son años que mentalmente me sirven para situar cosas en el tiempo. Recuerdo fácilmente qué ocurrió antes y después de estos años. Bien pues 2017 ya sé de antemano que va a ser uno de esos años.

En 2017 he sido padre de un niño precioso, super activo y adorable, Bruno. Tras un par de sustos durante el embarazo todo ha salido estupendamente y he aprendido muchísimo a nivel personal. Está siendo increíble. Supongo que no cuento nada nuevo a los que ya son padres.

A nivel profesional en enero cambié súbitamente de proyecto. Después de 2 años haciendo la UI de una aplicación de gestión de infraestructura de fibra óptica para Verizon y Frontier, pasé a liderar un equipo para desarrollar una aplicación desktop (electron) para la empresa con más datos deportivos probablemente del mundo: STATS.com. Ha sid

@gimenete
gimenete / inferred.ts
Created February 12, 2018 17:37
Calculate inferred types from a typescript file
import * as ts from 'typescript'
import * as util from 'util'
const program = ts.createProgram(['src/foo.ts'], {
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.CommonJS
})
const typeChecker = program.getTypeChecker()
const findFunctions = (parent: ts.Node) => {