Skip to content

Instantly share code, notes, and snippets.

(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.")
#!/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);
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use Text::Markdown 'markdown';
use HTML::TreeBuilder;
use List::Util 'max';
@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'
@marocchino
marocchino / rt.md
Created September 17, 2012 17:48
rubykaigi2012 timetable
-- landing page access ranking analysis using Treasure Data
SELECT first_path, COUNT(1) AS count
FROM (
SELECT TD_SESSIONIZE(time, 3600, host) AS session_id, TD_FIRST(path, time) AS first_path
FROM (
SELECT time, v['host'] as host, v['path'] as path
FROM www_access
DISTRIBUTE BY v['host']
SORT BY v['host'], v['time']
) ss
@eligor13
eligor13 / twpicdl.sh
Created September 5, 2014 01:52
Twitpic whole images downloader for mac
#!/bin/sh
# Modified by Stan Schwertly to download locally rather than to send to Posterous.
# Github: http://github.com/Stantheman/Twitpic-Backup
# Copyright 2010 Tim "burndive" of http://burndive.blogspot.com/
# This software is licensed under the Creative Commons GNU GPL version 2.0 or later.
# License informattion: http://creativecommons.org/licenses/GPL/2.0/
# This script is a derivative of the original, obtained from here:
;;; 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
@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__)));