Skip to content

Instantly share code, notes, and snippets.

View PabloVallejo's full-sized avatar

Pablo Vallejo PabloVallejo

View GitHub Profile
@PabloVallejo
PabloVallejo / regexp.py
Created June 18, 2013 02:20
Python Regular expressions examples
import re
m = re.search('(?<=abc)def', 'abcdef')
# Getting first match
m.group(0) # -> 'def'
m = re.search('(?<=-)\w+', 'spam-egg')
m.group(0) # -> 'egg'
@PabloVallejo
PabloVallejo / php.last-inserted-index.php
Created July 23, 2013 20:21
Get index of last inserted element in array
<?php
// Create array
$a = array();
// Add an item to it
$a[] = 1;
// Point to the last index of the array
end( $a );
<?php
/**
* Function that will handle post insertion with data from
* POST request.
*
* <code>
*
* // Sample returned response
* ( object ) array( 'status'=> 200, 'post_id' => 10 );

Topics

Objetivo de las charlas

Entendiendo la arquitectura MVC * Models * Views

@PabloVallejo
PabloVallejo / get_first_greather_int_index.php
Created August 29, 2013 17:45
get_first_greather_int_index
<?php
/**
* Return the key of the first elements
* greater than the one passed.
*
* <code>
*
* // Get the index of the first number greater than 15.
* // returns "1"
/**
* Components - Misc
*/
// Floating actions
.floating-actions {
width: 80px;
min-height: 150px;
margin-top: 15px;
@PabloVallejo
PabloVallejo / comment.insert.diff
Created August 2, 2013 19:55
comment controller
diff --git a/application/controllers/comment.php b/application/controllers/comment.php
index 099c043..70a8603 100644
--- a/application/controllers/comment.php
+++ b/application/controllers/comment.php
@@ -45,6 +45,7 @@ class Comment_Controller {
// 'comment_content' => wp_generate_password( 50, false, false )
'comment_content' => $req->content
, 'comment_post_ID' => $req->post_id
+ , 'comment_parent' => $req->parent_id
);
@PabloVallejo
PabloVallejo / app.js.global-events.diff
Created August 1, 2013 17:39
app.js.global-events
diff --git a/assets/js/handlers/comment.js b/assets/js/handlers/comment.js
index 4cd330d..bb08dd5 100644
--- a/assets/js/handlers/comment.js
+++ b/assets/js/handlers/comment.js
@@ -8,6 +8,12 @@
initialize: function() {
+ // Bind to global event `user.login`.
+ // window.Bppl.Event.on( 'user.login', this.functionToCall );
diff --git a/application/helpers/user.php b/application/helpers/user.php
index ce949c5..bf40944 100644
--- a/application/helpers/user.php
+++ b/application/helpers/user.php
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
*
* Helper functions are intended for being accessible
diff --git a/assets/js/helpers/utilities.js b/assets/js/helpers/utilities.js
index a34e884..21330fc 100644
--- a/assets/js/helpers/utilities.js
+++ b/assets/js/helpers/utilities.js
@@ -297,6 +297,18 @@
}
/**
+ * Converts a cammelcased string to dashed one one
+ * `sampleString`, `sample-string`