Skip to content

Instantly share code, notes, and snippets.

View mpampols's full-sized avatar

Marc Pàmpols mpampols

View GitHub Profile
@mpampols
mpampols / index.html
Created August 28, 2016 21:34
Dynamically add new slides to a bxSlider instance
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>bxSlider add slides dynamically</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bxslider/4.2.5/jquery.bxslider.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bxslider/4.2.5/jquery.bxslider.min.css" rel="stylesheet" />
</head>
@mpampols
mpampols / plane_torus_light.playground
Created February 23, 2015 21:14
A playground experiment using SceneKit in iOS 8 SDK that shows a plane, a torus and a light attached to it casting shadows
import UIKit
import SceneKit
import QuartzCore
import XCPlayground
var sceneView = SCNView(frame: CGRect(x: 0, y: 0, width: 350, height: 450))
var scene = SCNScene()
sceneView.scene = scene
XCPShowView("View", sceneView)
@mpampols
mpampols / jquery.slidify.js
Created January 26, 2015 10:52
jQuery Slidify Menu Plugin
/**
* jQuery Slidify Menu Plugin by Marc Pampols <mpampols@gmail.com>
*
* Example usage:
* $(".portlet-pensando-en-ti .portletItem").slidify({
* slideInSpeed: 200,
* slideOutSpeed: 400
* });
**/
@mpampols
mpampols / Cart.php
Created September 11, 2014 20:37
Prestashop: Calculate the shipping cost by grouping products by supplier
<?php
/**
* Return package shipping cost
*
* @param integer $id_carrier Carrier ID (default : current carrier)
* @param booleal $use_tax
* @param Country $default_country
* @param Array $product_list
* @param array $product_list List of product concerned by the shipping. If null, all the product of the cart are used to calculate the shipping cost
server {
listen 80;
server_name www.marcpampols.com marcpampols.com;
return 301 https://www.marcpampols.com$request_uri;
}
server {
listen 443;
ssl on;
@mpampols
mpampols / racc.mobileconfig
Created July 18, 2014 22:38
Cellular payload mobileconfig for RACCtel compatible with iOS 8 beta
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>APNs</key>
<array>
<dict>
@mpampols
mpampols / masmovil.mobileconfig
Created July 10, 2014 21:15
Cellular payload mobileconfig for Más Móvil compatible with iOS 8 beta
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>APNs</key>
<array>
<dict>
### Keybase proof
I hereby claim:
* I am mpampols on github.
* I am mpampols (https://keybase.io/mpampols) on keybase.
* I have a public key whose fingerprint is 6D34 CEC3 9A36 99B1 01D2 6784 6FE6 A8BF 35BD 10A7
To claim this, I am signing this object:
@mpampols
mpampols / gist:8806061
Created February 4, 2014 15:40
Error when adding any content type after uninstalling collective.hootsuite
Traceback (innermost last):
• Module ZPublisher.Publish, line 60, in publish
• Module ZPublisher.mapply, line 77, in mapply
• Module ZPublisher.Publish, line 46, in call_object
• Module Products.CMFPlone.FactoryTool, line 458, in __call__
• Module Products.CMFPlone.FactoryTool, line 207, in __getitem__
• Module Products.CMFPlone.FactoryTool, line 68, in _createObjectByType
• Module Products.CMFCore.TypesTool, line 559, in _constructInstance
• Module zope.event, line 31, in notify
• Module zope.component.event, line 24, in dispatch
@mpampols
mpampols / encode_videos.sh
Created February 4, 2014 11:48
Bash that checks a folder for .mp4 files without STREAMING string and reencodes them using ffmpeg to move the moov atom at the beginning of the file in order to enable web streaming.
#!/bin/bash
for file in /opt/web/streaming/*.mp4
do
echo "Check if file ${file% STREAMING.mp4} STREAMING.mp4 exists"
if [ ! -f "${file% STREAMING.mp4} STREAMING.mp4" ]; then
echo "-- New afile detected:"
echo "-- Running: ffmpeg -i "$file" -c:a copy -c:v copy -movflags faststart "${file%.mp4} STREAMING".mp4"
ffmpeg -i "$file" -c:a copy -c:v copy -movflags faststart "${file%.mp4} STREAMING".mp4
mv "$file" /opt/videos-originals