Skip to content

Instantly share code, notes, and snippets.

View jpalala's full-sized avatar
🎯
Focusing

Joe Palala jpalala

🎯
Focusing
View GitHub Profile
@jpalala
jpalala / db_driver_extension.php
Created November 16, 2011 08:15 — forked from Eclarian/db_driver_extension.php
CodeIgniter Database Driver Extension to simplify the CRUD actions within your app
<?php
/**
* Database Driver Extension
*
* DEPENDENCIES:
* CodeIgniter 2.x.x (with ActiveRecord turned on)
* is_associative() function -- place in autoloaded helper file. It should load early enough before any queries.
*
* This Extension allows you to insert/update, batch insert/batch update, and delete from any
* table within your database simply with an easy interface
@jpalala
jpalala / gist:3754048
Created September 20, 2012 04:57 — forked from six519/gist:3634045
Split Words
<?php
function splitWords($paragraph, $numberOfWords) {
$returnArray = array();
$splittedString = explode(" ", $paragraph);
$counter = 0;
$counter2 = 0;
for($x = 0; $x < count($splittedString); $x++) {
@jpalala
jpalala / paginated_collection.js
Created October 6, 2012 10:52 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@jpalala
jpalala / gist:3851248
Created October 8, 2012 07:49 — forked from vinhboy/gist:1274476
Testing backbone js powered shopping cart
<html>
<body>
<table id="cart">
<thead>
<tr>
<th></th>
<th>Price/Bottle</th>
<th>Quantity</th>
<th>Total</th>
</tr>
a{
border-radius:10px;
background:#efefef;
color:blue;
font-size: 12px;
padding:5px 16px 5px 16px;
margin: 10px;
line-height:90%;
}
The procedure for setting up automatic private/public key login on our servers is as follows:
- On your own machine, go to $HOME/.ssh and type: ssh-keygen -t dsa
- When prompted for it, leave the default location for the file and let the passphrase empty
- Copy the content of the "id_dsa.pub" file that just got created into the $HOME/.ssh/authorized_keys and authorized_keys2 on our machine.
- Set the following permissions:
chmod 644 $HOME/.ssh/authorized_keys*
server {
server_name [host];
root /var/www/[document_root]; ## <-- Your only path reference.
# Enable compression, this will help if you have for instance advagg module
# by serving Gzip versions of the files.
gzip_static on;
location = /favicon.ico {
server {
server_name [host];
root /var/www/[document_root]; ## <-- Your only path reference.
# Enable compression, this will help if you have for instance advagg module
# by serving Gzip versions of the files.
gzip_static on;
location = /favicon.ico {
There are a lot of complaints going around about Laravel these days, but a lot
of the important ones seem to be missing from the spotlight.
Bugfixes, issues and pull requests being left open for months with no
clarification of intent:
- https://github.com/laravel/framework/pull/1799
- https://github.com/laravel/framework/issues/1963
- https://github.com/laravel/framework/issues/2089
- https://github.com/laravel/framework/issues/2234
@jpalala
jpalala / slug-url-gen.php
Last active September 26, 2022 05:32 — forked from anonymous/gist:2912227
Slug URL generator for seo (removes spaces hyphens, and other characters)
<?php
function slugify($str) {
$search = array('Ș', 'Ț', 'ş', 'ţ', 'Ş', 'Ţ', 'ș', 'ț', 'î', 'â', 'ă', 'Î', 'Â', 'Ă', 'ë', 'Ë');
$replace = array('s', 't', 's', 't', 's', 't', 's', 't', 'i', 'a', 'a', 'i', 'a', 'a', 'e', 'E');
$str = str_ireplace($search, $replace, strtolower(trim($str)));
$str = preg_replace('/[^\w\d\-\ ]/', '', $str);
$str = str_replace(' ', '-', $str);
return preg_replace('/\-{2,}', '-', $str);
}