Skip to content

Instantly share code, notes, and snippets.

View carlosromero's full-sized avatar

Carlos Romero carlosromero

View GitHub Profile
function qa () {
console.log('CHECK PDK Loaded');
console.log($pdk);
console.log('CHECK PDK Loaded Version');
console.log($pdk.version);
@carlosromero
carlosromero / preview.js
Created January 26, 2016 14:03
crop and resize input file preview image
var reader = new FileReader();
reader.onload = function (e) {
// get loaded data and render thumbnail.
var imgTmp = new Image();
imgTmp.onload = function(evt) {
var tempCanvas = document.createElement("canvas"),
tCtx = tempCanvas.getContext("2d");
if (this.width > this.height) {
var width = this.height;
var imgX = (this.width - this.height)/2;
<?php
use Guzzle\Http\Client;
use Guzzle\Http\Message\Response;
use Guzzle\Http\Message\Request;
use Behat\Behat\Context\SnippetAcceptingContext;
/**
* Defines application features from the specific context.
*/
class RestContext implements SnippetAcceptingContext
<?php
namespace My\Bundle\Command;
use Assetic\Asset\AssetInterface;
use Assetic\Util\VarUtils;
use Symfony\Bundle\AsseticBundle\Command\DumpCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@carlosromero
carlosromero / gist:2828263
Created May 29, 2012 13:04
Unprotect worksheet
Sub Quitar_contraseña()
Dim a As Integer, b As Integer, c As Integer
Dim d As Integer, e As Integer, f As Integer
Dim a1 As Integer, a2 As Integer, a3 As Integer
Dim a4 As Integer, a5 As Integer, a6 As Integer
On Error Resume Next
For a = 65 To 66: For b = 65 To 66: For c = 65 To 66
For d = 65 To 66: For e = 65 To 66: For a1 = 65 To 66
For a2 = 65 To 66: For a3 = 65 To 66: For a4 = 65 To 66
For a5 = 65 To 66: For a6 = 65 To 66: For f = 32 To 126
@carlosromero
carlosromero / gist:2828257
Created May 29, 2012 13:02
Unprotect workbook
Sub Quitar_contraseña()
Dim a As Integer, b As Integer, c As Integer
Dim d As Integer, e As Integer, f As Integer
Dim a1 As Integer, a2 As Integer, a3 As Integer
Dim a4 As Integer, a5 As Integer, a6 As Integer
On Error Resume Next
For a = 65 To 66: For b = 65 To 66: For c = 65 To 66
For d = 65 To 66: For e = 65 To 66: For a1 = 65 To 66
For a2 = 65 To 66: For a3 = 65 To 66: For a4 = 65 To 66
For a5 = 65 To 66: For a6 = 65 To 66: For f = 32 To 126
@carlosromero
carlosromero / gist:1283907
Created October 13, 2011 10:16
kill process
ps -A|awk '/searchd/ {print $1}'|xargs kill
#or use: killall process name
@carlosromero
carlosromero / tables_dump.sh
Created July 5, 2011 16:31
Mysql dump by tables
#!/bin/bash
USER=root
PASS=
DBNAME=mydb
DIRLOCAL=/home/user/dumps/
cd $DIRLOCAL
mkdir `date +%Y%m%d`
cd `date +%Y%m%d`
@carlosromero
carlosromero / populate_db.sh
Created July 5, 2011 16:24
Mysql dumps loader
#!/bin/bash
DBDUMP=$1
USER=root
PASS=
DBNAME=mydb
DIRLOCAL=/home/user/dumps/
cd $DIRLOCAL$DBDUMP
gzip -d *.gz
pwd