Skip to content

Instantly share code, notes, and snippets.

<?php
$css = file_get_contents('bootstrap.css');
preg_match_all('/\.(([a-z]+\-)[a-z]+)/m', $css, $matches);
foreach ($matches[1] as $key => $value) {
$snippet = <<< EOF
<snippet>
<content><![CDATA[{$value}]]></content>
<tabTrigger>{$matches[2][$key]}</tabTrigger>
<scope>text.html</scope>
<description>{$value} Bootstrap</description>
@slywalker
slywalker / bootstrap_form.php
Created October 6, 2011 05:15
form helper for CakePHP on twitter bootstrap
<?php
class BootstrapFormHelper extends AppHelper {
public $helpers = array('Html', 'Form');
public function input($name, $options = array()) {
$default = array(
'type' => null,
'label' => null,
'before' => null, // to convert .input-prepend
@slywalker
slywalker / AppShell.php
Created July 10, 2012 10:12
CakePHP AppShell::progressBar()
<?php
class AppShell extends Shell {
public function progressBar($current, $total, $size = 50) {
$perc = intval(($current / $total) * 100);
for ($i = strlen($perc); $i <= 4; $i++) {
$perc = ' ' . $perc;
}
$total_size = $size + $i + 3;
{
"require": {
"admad/cakephp-sequence": "^2.0",
"cakedc/enum": "^1.0",
"cakephp/acl": "^0.2.2",
"cakephp/cakephp": "~3.4.0",
"cakephp/localized": "dev-master",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*",
"egeloen/google-map": "^2.0",
{
"afn_valid_scopes":
[
"css",
"sass",
"less",
"scss",
"ctp",
"html"
],
@slywalker
slywalker / composer.json
Created November 5, 2013 03:25
みんなのComposer.jsonはどうかな?
{
"require": {
"FriendsOfCake/crud": "3.*",
"aws/aws-sdk-php": "~2.4",
"cakedc/migrations": "~2.2",
"cakedc/search": "~1.1",
"cakedc/utils": "~1.3",
"cakephp/debug_kit": "~2.2",
"cakephp/localized": "2.1.*@dev",
"chronon/mobile_detect": "~1.1",
@slywalker
slywalker / bingo.html
Created June 3, 2013 04:54
PHPカンファレンス関西2013懇親会抽選用 https://dl.dropboxusercontent.com/u/147844/phpkansai/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bingo!</title>
<link rel="stylesheet" href="./css/bootstrap.css">
<style>
body {
padding-top: 100px;
}
#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
nameserver 127.0.0.1
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
# multi_accept on;
}
http {
<?php
/**
* require QueryPath
*
**/
App::uses('AppModel', 'Model');
App::uses('HttpSocket', 'Network/Http');
App::import('Vendor', 'autoload');
class YahooAuction extends AppModel {