Skip to content

Instantly share code, notes, and snippets.

View vitorpacheco's full-sized avatar

Vitor Pacheco vitorpacheco

  • Solutis Tecnologias
  • Brasil, Salvador - BA
View GitHub Profile
@jwage
jwage / SplClassLoader.php
Last active August 16, 2024 17:36
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@eberfreitas
eberfreitas / easygd.php
Created August 25, 2010 19:09
A simple class to handle images in PHP with GD
<?php
/**
* EasyGD - A simple class to handle images in PHP with GD
*
* Basic Usage:
*
* $image = new EasyGD('image.jpg');
* $image->crop(100, 50)
* ->width(50)
<?php
// Define the 'class' class
$class = Obj()
->fn('new', function ($class) {
$newClass = Obj($class->methods)
->fn('new', function($class) {
$obj = Obj($class->imethods);
$args = func_get_args();
array_shift($args);
@predominant
predominant / cdcupdate.php
Created December 22, 2010 23:13
CakeDC repo downloader, and updater. For the truly lazy.
#!/usr/bin/php
<?php
if ($argc <= 1) {
$account = 'CakeDC';
} else {
$account = $argv[1];
}
if ($argc <= 2) {
Index: sapi/cli/config.w32
===================================================================
--- sapi/cli/config.w32 (revision 308839)
+++ sapi/cli/config.w32 (working copy)
@@ -6,7 +6,8 @@
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
- SAPI('cli', 'php_cli.c', 'php.exe');
+ SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c', 'php.exe');
@slywalker
slywalker / pagination.ctp
Created October 5, 2011 07:25
pagination element for CakePHP on twitter bootstrap
<?php
if (!isset($modules)) {
$modulus = 11;
}
if (!isset($model)) {
$models = ClassRegistry::keys();
$model = Inflector::camelize(current($models));
}
?>
<div class="pagination">
@casimiroarruda
casimiroarruda / build.xml
Created February 28, 2012 01:59
Arquivo de configuração para o phing
<?xml version="1.0" encoding="UTF-8"?>
<project name="TheProject" default="build" basedir=".">
<!-- Altere estas propriedades adequando-as ao seu projeto -->
<property name="application.library" value="${project.basedir}/library"/>
<property name="application.tests" value="${project.basedir}/tests"/>
<property name="application.builddir" value="${project.basedir}/build"/>
<target name="build"
@jswebschmiede
jswebschmiede / snippet.js
Created September 6, 2012 22:31 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
* Tip: http://pivotallabs.com/users/jdean/blog/articles/1400-working-with-asynchronously-loaded-javascript
*/
(function(doc, script) {
var js,
@naraga
naraga / PCQueueDemo.cs
Created September 18, 2012 22:08
Producer / Consumer queue optimized for IO bound operations
class Program
{
// PcQueue - demo
// Code copied from "C# 5.0 in a Nutshell: The Definitive Reference" by Joseph Albahari and Ben Albahari
// Modified by @borisbucha to efficiently support IO bound operations (simply adding TaskCreationOptions.LongRunning to consumer tasks)
// which sugests to scheduler to allocate dedicated thread to enqued items instead of poluting Threadpool.
static void Main()
{
Console.WriteLine("press any key when ready");
Console.ReadLine();
@junichi11
junichi11 / composer.json
Created October 3, 2012 11:33
Composer template for CakePHP Plugin
{
"name": "vendor/plugin_name",
"type": "cakephp-plugin",
"description": "Moge Plugin for CakePHP",
"keywords": ["cakephp","moge"],
"homepage": "https://github.com/yousername/your_plugin",
"license": "MIT",
"authors": [
{
"name": "hoge moge",