Skip to content

Instantly share code, notes, and snippets.

View jesusOmar's full-sized avatar

Jesus Fernandez jesusOmar

View GitHub Profile
<?php
private function _array_search($needle, $haystack) {
if (empty($needle) || empty($haystack)) {
return false;
}
foreach ($haystack as $key => $value) {
foreach ($needle as $nkey => $nvalue) {
if (!empty($value[$nkey]) && $value[$nkey] == $nvalue) {
if($haystack[$key]['empid'] == $needle['empid'] && $haystack[$key]['bdate'] == $needle['bdate']) {
return $key;
@jesusOmar
jesusOmar / php.watchr.rb
Created June 3, 2011 18:19
My watchr scripts with growl notifications and custom images for php and python.
# Prereqs:
# * Ruby
# * gem install watchr
# * growlnotify (http://growl.info/ = Extras folder from growl download.)
# Usage:
# put all your tests in a tests folder and call them anythingTest.php
# run watchr watchr.rb
watch('tests/.*Test\.php') do |md|
@jesusOmar
jesusOmar / crap.js
Last active September 27, 2015 00:37
Validates a set of form fields against a range of accepted values. Uses jQuery with noConflict() and jQuery UI Dialog.
<script>
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery("#btnSave").click(function() {
// Create a list of valid ranges for the fields.
var fields = {
age: {
id: "#txtAge",
val: parseInt(jQuery("#txtAge").val()),
low: 18,
@jesusOmar
jesusOmar / dump.php
Last active September 28, 2015 07:08
Symfony 2 Array dump
<?php
\Doctrine\Common\Util\Debug::dump($value);
@jesusOmar
jesusOmar / development_update.sh
Created June 26, 2013 22:56
My development server automatic update script.
#!/bin/bash
DOCUMENT_ROOT=/var/www/html/vhosts/dev.domain.com;
ENV=dev;
SVN_SERVER=https://subversion.assembla.com/svn/repo/trunk;
SVN_USERNAME=username;
SVN_PASSWORD=password;
echo "Changing directories to $DOCUMENT_ROOT...";
cd $DOCUMENT_ROOT;
{% extends "::layout.html.twig" %}
{% block content %}
{% block activity_title %}
<h1>{{ activity.name | title }}</h1>
{% endblock activity_title %}
{% if isNotIncentiviseActivity %}
<div id="myModal" class="modal fade">
<div class="modal-dialog">
@jesusOmar
jesusOmar / doctrine.php
Created February 8, 2015 17:23
Doctrine Query Help
<?php
$qb2 = $this->createQueryBuilder('a2')
->select('a2')
->innerJoin('a2.registrations', 'appointment_registrations')
->where('a2.id = a1.id') // This does not work :(
;
$qb = $this->createQueryBuilder('a1');
$qb->where($qb->expr()->not($qb->expr()->exists($qb2->getDql())));
<?php namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Appointment
*
* @ORM\Table(name="appointments")
* @ORM\Entity(repositoryClass="AppBundle\Entity\AppointmentRepository")
---
ip: "192.168.10.10"
memory: 4096
cpus: 2
provider: vmware_fusion
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa

Keybase proof

I hereby claim:

  • I am jesusomar on github.
  • I am jesusomar (https://keybase.io/jesusomar) on keybase.
  • I have a public key ASC8PlY0AXMOGoMRJ85Zi-gwydWBw-x8mfMNQ7Za2UTrugo

To claim this, I am signing this object: