Skip to content

Instantly share code, notes, and snippets.

@aerith
aerith / なかったことにしたい.user.js
Created October 26, 2010 10:21
JSDeferred 使って書き直さないとちゃんと動かないんじゃないかな?
// ==UserScript==
// @name FaceBook Auto Poke
// @namespace ns.aerith.sc
// @include http://www.facebook.com/*
// ==/UserScript==
(function () {
var target_id = 'pagelet_netego_pokes';
var container = document.getElementById(target_id);
@aerith
aerith / gist:644591
Created October 25, 2010 08:14
文字列が正規表現パターンかどうかをそれっぽく判別する関数。
<?php
/*
* 文字列が正規表現パターンかどうかをそれっぽく判別する関数。
*/
function regexpUses($pattern)
{
// See: http://php.net/manual/reference.pcre.pattern.modifiers.php
// See: http://php.net/manual/regexp.reference.delimiters.php
if (preg_match('@^([^\s\\\\a-z0-9])(?:.*?)\1(?:[imsxeADSUXJu]*)?$@mD', $pattern)) return true;
if (preg_match('@^\{(?:.*?)\}(?:[imsxeADSUXJu]*)?$@mD', $pattern)) return true;
@aerith
aerith / gist:573142
Created September 10, 2010 05:15 — forked from sorah/gist:573131
<?php
array_map(function ($i) { $s=($i%3==0?'Fizz':'').($i%5==0?'Buzz':''); $s=($s=="")?$i:$s; print "${s}\n"; }, range(1,100));
# aerith@www2381u:~$ view .vhosts/llll.aerith.sc.conf
<VirtualHost *:80>
ServerName llll.aerith.sc
DocumentRoot /home/aerith/.sites/llll.aerith.sc/htdocs
ErrorLog /var/log/apache2/llll.aerith.sc.error.log
CustomLog /var/log/apache2/llll.aerith.sc.access.log vhost_combined
var sys = require('sys');
process.stdout.write(sys.inspect(pathExistsSync('test'), true, null) + "\n");
process.stdout.write(sys.inspect(pathExistsSync('--test--'), true, null) + "\n");
function pathExistsSync (path) {
var fs = require('fs');
try {
var stat = fs.statSync(path);
} catch (error) {
return (error.errno !== process.ENOENT);
<mx:VBox width="100%" height="100%">
<mx:Repeater id="rp" startingIndex="0" recycleChildren="false">
<flexlibContainer:WindowShade id="windowShade" width="100%" data="{rp.currentItem}" opened="false">
<flexlibContainer:headerRenderer>
<mx:Component>
<flexlibControl:CanvasButton
xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%"
creationComplete="creationCompleteHandler(event)"
click="headerClickHandler(event)"
<?xml version="1.0" encoding="UTF-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="600" height="400" paddingLeft="0" paddingTop="0" paddingBottom="0" paddingRight="0" creationComplete="creationCompleteHandler()">
<mx:Script>
<![CDATA[
import mx.binding.utils.BindingUtils;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import mx.collections.XMLListCollection;
@aerith
aerith / app.rb
Created November 27, 2009 09:23
#!/usr/bin/ruby
require 'rubygems'
require 'sinatra'
require 'haml'
require 'pathname'
get '*' do
base = Pathname.new(File.dirname(__FILE__)).parent
path = @params[:splat].first.gsub(/^\//, '')
<?php //>
$item = "hoge";
$values = array(
array(
'id' => 1,
'title' => 'title1',
),
array(
'id' => 2,
'title' => 'title2',
<html>
<head>
<script type="text/javascript">
<!--
var $ = function (id) { return document.getElementById(id); };
window.onload = function () {
var images = $('image-list').getElementsByTagName('img');
for ( var i = 0; i < images.length; i++ ) {