Skip to content

Instantly share code, notes, and snippets.

@sharl
sharl / emacs.rb
Created June 12, 2012 03:00
Yet Another Emacs 24.1 Homebrew Formula (fullscreen+IME inline)
require 'formula'
class Emacs < Formula
homepage 'http://www.gnu.org/software/emacs/'
url 'http://ftpmirror.gnu.org/emacs/emacs-24.1.tar.bz2'
mirror 'http://ftp.gnu.org/pub/gnu/emacs/emacs-24.1.tar.bz2'
sha1 'ab22d5bf2072d04faa4aebf819fef3dfe44aacca'
if ARGV.include? "--use-git-head"
head 'http://git.sv.gnu.org/r/emacs.git'
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use Text::Markdown 'markdown';
use HTML::TreeBuilder;
use List::Util 'max';
@hiromi2424
hiromi2424 / Post.php
Created March 12, 2012 03:56
CakePHP Mass Assignment Vulnerability - common process
<?php
// モデルの場合。
// 以下と相似なヘルパーメソッドを作れば、いちいち同じようなメソッドを大量生産しなくて済むよ!
class Post extends AppModel {
public function edit($id, $data) {
$this->create(false);
$this->set($data);
$this->set('id', $id);
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use Text::Markdown 'markdown';
use HTML::TreeBuilder;
use List::Util 'max';
@phillro
phillro / gist:1147306
Created August 15, 2011 17:50
Elastica with an authenticated search
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/Elastica/lib'));
function elasticsearch_autoload($class) {
$file = str_replace('_', '/', $class) . '.php';
require_once $file;
}
spl_autoload_register('elasticsearch_autoload');
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__)));
(require 'cl)
(require 'popup)
(defvar popup-color-string
(let ((x 9) (y 3))
(mapconcat 'identity
(loop with str = (make-string x ?\ ) repeat y collect str)
"\n"))
"*String displayed in tooltip.")
;;; inao-mode.el --- major mode for writing inao manuscripts
;; Copyright (C) 2010 SAKURAI Masashi
;; Author: SAKURAI Masashi <m.sakurai at kiwanami.net>
;; Keywords: outlines, convenience
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or