Skip to content

Instantly share code, notes, and snippets.

@Cezarion
Cezarion / .gitignore
Created October 8, 2014 08:31
Wp-gitignore
## -----------------------------------------
## OS
## -----------------------------------------
# -----------------------------------------
# OSX
# -----------------------------------------
.DS_Store
.AppleDouble
/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
/**
* Console.log with call location and grouping to reduce log noise.
* Apply directly to code once.
*
* Original: http://remysharp.com/2014/05/23/where-is-that-console-log/
*/
var groupable = typeof console.groupCollapsed !== 'undefined';
['log', 'warn'].forEach(function(method) {
var old = console[method];
console[method] = function() {
/**
* Prepare the App Folder
*/
(function(){
window.appRootDirName = ".myapp";
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log("device is ready");
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
@Cezarion
Cezarion / app.js
Created May 14, 2014 16:48 — forked from jgoux/app.js
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@Cezarion
Cezarion / disable-dashboard
Created February 1, 2014 21:28
Disable Dashboard on OS X Mavericks
1) Open the Terminal.
2) Type in "defaults write com.apple.dashboard mcx-disabled -boolean YES".
3) Press the return (enter) key.
4) Type "killall Dock".
5) Press the return (enter) key.
<?php
/**
* Transforms an under_scored_string to a camelCasedOne
*/
function camelize($scored) {
return lcfirst(
implode(
'',
array_map(
@Cezarion
Cezarion / select-rows-by-max-date.sql
Created December 11, 2013 09:07
Select all rows by max date
/* --------------------------------------------------------------
DB MODEL
ID Type_id Name Value Date
-- -------- ------ ------- ---------------------
1 56 "name1" "lorem" "2011-03-19 22:08:13"
5 58 "name2" "ipsum" "2011-03-19 22:00:44"
22 58 "name2" "dolor" "2011-03-20 11:03:13"
31 25 "name3" "sit" "2011-04-28 18:42:07"
44 12 "name4" "amet" "2011-04-12 11:06:11"
@Cezarion
Cezarion / simple-collection.php
Created November 25, 2013 10:08
Collection class in PHP
<?php
/**
* @title: Simple collection classe in PHP
* @link : http://www.sitepoint.com/collection-classes-in-php/
*/
class Collection
{
private $items = array();