Skip to content

Instantly share code, notes, and snippets.

View newtonapple's full-sized avatar

David Dai newtonapple

  • Tobiko Data
  • San Francisco
View GitHub Profile
@endolith
endolith / Has weird right-to-left characters.txt
Last active November 20, 2024 11:05
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@newtonapple
newtonapple / chromium_updater.rb
Created August 14, 2009 05:51
An automated Ruby script for grabbing the latest Mac Chromium build
#!/usr/bin/env ruby
# A simple Ruby script to update Chromium from dev build.
# Currently only works on Mac. You should be able extend it to Linux and Windows without much fuzz.
# If you want progress bar, sudo gem install ruby-progressbar
# Usage:
# ruby chromium_updater.rb
require 'fileutils'
require 'open-uri'
@jacaetevha
jacaetevha / add_support_for_HTTP_OPTIONS.rb
Created August 26, 2009 16:13
Add support for the HTTP OPTIONS method to a Sinatra application.
# The HTTP OPTIONS method allows for cross-site HTTP requests.
# For more information see https://developer.mozilla.org/en/HTTP_access_control
# and, of course, the HTTP spec (section 9.2) at http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
# In this example, we plan to use it in development mode only
configure :development do
# Open the Sinatra::Base class and add the method. We can't
# use 'options' as the method name because there is already
# an options method on the class.
class << Sinatra::Base
@romannurik
romannurik / background-page.html
Created September 24, 2009 05:15
A workaround for Cross-domain XHR's not working in Chrome Extensions' content scripts. See http://groups.google.com/group/chromium-extensions/browse_thread/thread/43ec4d383cf8d01d
<!DOCTYPE html>
<html>
<head>
<script src="xhrproxy.js"></script>
<script>
setupXHRProxy();
</script>
</head>
@geoffa
geoffa / flip.css
Created November 20, 2009 21:28
CSS to flip things.
/*
Flips a webpage 180deg.
Apply class="flip" to <body>
From:
- http://mmm.phpied.com/
- http://developer.yahoo.net/blog/archives/2009/09/search_performance.html
*/
.flip {
@mxcl
mxcl / install_homebrew.markdown
Created March 6, 2010 15:14
Installs Homebrew to /usr/local so you don't need sudo to `brew install`
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
(defstruct trie-node :word-fragment :type :children)
(defn type-switch [node type-val]
(assoc node :type type-val))
(defn switch-to-word [node]
(type-switch node :word))
(defn switch-to-nonword [node]
(type-switch node :nonword))
; constructors
@jonraasch
jonraasch / highlight.js
Created September 2, 2010 22:14
Live on-page text highlighting
/*
highlight v3 !! Modified by Jon Raasch (http://jonraasch.com) to fix IE6 bug !!
Highlights arbitrary terms.
<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
MIT license.