Skip to content

Instantly share code, notes, and snippets.

View jjulian's full-sized avatar

Jonathan Julian jjulian

  • MD
  • 01:42 (UTC -04:00)
View GitHub Profile
make: *** [rdoc] Abort trap
[2010-08-26 23:56:31] make
/Users/jjulian/.rvm/gems/ruby-1.8.7-p160/gems/rdoc-2.4.3/lib/rdoc/rdoc.rb:51: warning: already initialized constant GENERATORS
error loading "/Users/jjulian/.rvm/gems/ruby-1.8.7-p160/gems/sdoc-0.2.20/lib/rdoc/discover.rb": superclass mismatch for class Paragraph (TypeError)
/Users/jjulian/.rvm/gems/ruby-1.8.7-p160/gems/rdoc-2.4.3/lib/rdoc/rdoc.rb:51: warning: already initialized constant GENERATORS
/Users/jjulian/.rvm/gems/ruby-1.8.7-p160/gems/json-1.4.3/lib/json/common.rb:66: [BUG] unknown type 0x22 (0xc given)
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
<div class="editable">
<p>Several things to notice here:</p>
<p>First, if the browser supports .addEventListener(..) we need to do a little extra work to support mouseenter/mouseleave.</p>
<p>But (and I can't stress this enough), this concept is absolutely flawed! We're assuming that if the browser supports .addEventListener(..) then it must not support mouseenter/mouseleave.</p>
<h1 class="nubbin_wrapper">Hello!</h1>
<p>While this happens to be true at present (to the best of my knowledge) it's unwise to assume that this will always be the case. The problem is, there is no (highly reliable) way to determine whether or not a browser supports a particular event (at least not that I know of). I'm okay with this approach for now, only because we're writing the code in such a way, that even if a browser did support mouseenter/mouseleave, our custom implementation of it shouldn't cause any major problems.</p>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text
#!/usr/bin/env ruby
require 'cgi'
# EDIT ME! PATH TO YOUR jslint.js file
lint = `java org.mozilla.javascript.tools.shell.Main ~/Library/JSLint/jslint.js "$TM_FILEPATH"`
lint.gsub!(/^(Lint at.+?:)(.+?)\n(?:(.+?)\n\n)?/m) do
"<p><strong>#{CGI.escapeHTML($1)}</strong>#{CGI.escapeHTML($2)}</p>" <<
($3 ? "<pre>#{CGI.escapeHTML($3)}</pre>" : '')
end
def handle_approved(handle)
allowed = YAML::load_file('/var/www/allowed.yml')
allowed.include?(handle.downcase)
end
# in the action, after the twitter handle is pulled from oauth
if !handle_approved(handle)
reset_session
flash[:notice] = 'Sorry, your username is not allowed'
logger.error "denied access for #{handle}"
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db('myapp_development');
$query = empty($_GET['query']) ? '' : $_GET['query'];
$rows = mysql_query("SELECT * FROM users where username like '%$query%' ORDER BY created_at DESC");
<html>
<head>
<link rel="stylesheet" href="ext-3.1.1/resources/css/ext-all.css" />
<script src="ext-3.1.1/adapter/ext/ext-base.js"></script>
<script src="ext-3.1.1/ext-all-debug.js"></script>
<script>
Ext.BLANK_IMAGE_URL = 'ext-3.1.1/resources/images/default/s.gif';
Ext.onReady(function(){
var personStore = new Ext.data.ArrayStore({
fields: ['id', 'name', 'image', 'city', 'country'],
require 'spec_helper'
describe Base58 do
it "should handle creating encoded strings over 2 characters long" do
(1..100000).each do |i|
i.should encode_and_decode_to(i)
end
end
end
@jjulian
jjulian / gist:313826
Created February 24, 2010 20:42
Minimal Ext JS Viewport example
<html>
<head>
<link rel="stylesheet" href="ext-3.1.1/resources/css/ext-all.css" />
<script src="ext-3.1.1/adapter/ext/ext-base.js"></script>
<script src="ext-3.1.1/ext-all-debug.js"></script>
<script>
Ext.BLANK_IMAGE_URL = 'ext-3.1.1/resources/images/default/s.gif';
// ...your grid code...
//grid.render('grid-example'); <- do not render the grid, the viewport will do this for you
Ext.onReady(function(){
var ourStore = new Ext.data.JsonStore({ //change to JsonStore
url:'Chapter15Example.json',
root:'files', //add root here
fields: [ //add fields here
{name:'file_name',mapping:'name'},
{name:'file_size',mapping:'size',type:'int'},
'type',
{name:'lastmod',mapping:'datelastmodified',type:'date'},
{name:'file_attributes',mapping:'attributes'}, //these last few fields are not in the source json
'mode',
# To rewrite server subdomains into directories: Capture the subdomains
# in a rewrite condition, then use backreferences to them in the rule.
# . run apache locally
# . add project.client.staging.domain.com to /etc/hosts
# . curl project.client.staging.domain.com
# . in rewrite_log, you'll see rewrite '/' -> '/root/staging/client/project'
RewriteLogLevel 3
RewriteLog "rewrite_log"
RewriteEngine On
ServerName project.client.staging.domain.com