Skip to content

Instantly share code, notes, and snippets.

View javiermadueno's full-sized avatar

Javier Madueño javiermadueno

  • Soderberg&Partners
  • Barcelona
View GitHub Profile
@javiermadueno
javiermadueno / batchsampling.js
Created December 30, 2019 19:28 — forked from jayphelps/batchsampling.js
Batch Sampling Example from my talk, Real-time Insights, powered by Reactive Programming
let buffer = getWebSocket()
.bufferTime(1000);
let gate = new BehaviorSubject(true);
let batchSize = 50;
let batchSizeCounter = 0;
let results = gate
.switchMap(enabled => enabled ? buffer : Observable.never())
.do(buffer => {
@javiermadueno
javiermadueno / desymfony2017.md
Created July 14, 2017 12:43 — forked from raulfraile/desymfony2017.md
Slides de deSymfony 2017
@javiermadueno
javiermadueno / html.tpl.php
Created July 4, 2017 09:27 — forked from pascalduez/html.tpl.php
Drupal 7 — Move $scripts at page bottom
<!DOCTYPE html>
<html<?php print $html_attributes; ?>>
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $head_scripts; ?>
</head>
<body<?php print $body_attributes;?>>
@javiermadueno
javiermadueno / convert_databases_utf8.php
Created June 20, 2017 06:33 — forked from hollodotme/convert_databases_utf8.php
Converting mysql string data form latin1 to utf8 for utf8 data stored in utf8 tables via latin1 connection
<?php
/**
* Requires php >= 5.5
*
* Use this script to convert utf-8 data in utf-8 mysql tables stored via latin1 connection
* This is a PHP port from: https://gist.github.com/njvack/6113127
*
* @link : http://www.ridesidecar.com/2013/07/30/of-databases-and-character-encodings/
*
* BACKUP YOUR DATABASE BEFORE YOU RUN THIS SCRIPT!
@javiermadueno
javiermadueno / README.md
Created March 3, 2017 13:52 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@javiermadueno
javiermadueno / generate.php
Created September 5, 2016 07:06 — forked from jreinke/generate.php
Default password encoding in Silex micro-framework
<?php
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
$encoder = new MessageDigestPasswordEncoder();
echo $encoder->encodePassword('foo', '');
// 5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg==
@javiermadueno
javiermadueno / angularjs_directive_attribute_explanation.md
Created August 19, 2016 06:30 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@javiermadueno
javiermadueno / inputTypeNumberPolyfill.js
Created April 1, 2016 09:57 — forked from nbouvrette/inputTypeNumberPolyfill.js
Stand alone JavaScript polyfill allow only numbers on input of type number.
/**
* Stand alone polyfill allow only numbers on input of type number.
*
* While input filtering is already supported by default by some browsers, maximum length has not been implemented by
* any. This script will solve both issue and make sure that only digits can be entered in input elements of type
* number. If the optional attribute `max` is set, it will calculate it's length and mimic the `maxlength` behavior on
* input of type text.
*
* Supports:
*
@javiermadueno
javiermadueno / ajax.js
Created February 3, 2016 19:52 — forked from janbiasi/ajax.js
ajax
(function(window, undefined) {
var strEq = function(str1, str2) {
return str1.toLowerCase() === str2.toLowerCase();
};
var ajaxRequest = function(method, opts) {
opts = opts ? opts : {};
opts.data = opts.data || null;
opts.success = opts.success || function() { };
@javiermadueno
javiermadueno / deploy.rb
Last active September 22, 2015 07:41 — forked from jmather/deploy.rb
Remove dev only files in production via capifony
set :dev_only_files, [web_path + "/app_dev.php", web_path + "/check.php", web_path + "/config.php"]
set :production, true
after 'symfony:cache:warmup', 'pff:productify'
namespace :pff do
desc "Remove app_dev.php, check.php and config.php from production deployment"
task :productify, :except => { :production => false } do
if dev_only_files
pretty_print "--> Removing app_dev.php, config.php, and check.php from web"