Skip to content

Instantly share code, notes, and snippets.

@niuage
niuage / .gitconfig
Created April 11, 2011 22:16 — forked from midu/.gitconfig
[url "https://github.com/"]
insteadOf = "gh:"
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
filesystem will be different but this guide will get you working with it
while we wait for all that to finalize.
Ignore the number prefixes on each file. This is just to ensure proper order in the Gist.
It's based on eric1234 gist https://gist.github.com/911003. ijust made it 3.1 compliant in terms of convention
(function ($, context) {
var mpq = context.mpq,
sync_track = function (e) {
var self = this,
event = e;
event.preventDefault();
mpq.track('dashboard-interaction', {
@niuage
niuage / gee
Created January 10, 2012 22:47
hehe
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@niuage
niuage / Quest mode in Google Maps
Created June 14, 2012 15:03
How to add the Quest mode in Google Maps from April Fools Day 2012
// Set map options
var mapOptions = {
center: new google.maps.LatLng(41.917142, -87.673837), // Or whatever
zoom: 15,
mapTypeId: "quest",
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE, "quest"]
},
scrollwheel: false
}
.hint-page {
ul {
padding-top: 20px;
li {
padding: 0 0 35px 75px;
background-position: 0 5px;
background-repeat: no-repeat;
# extracted from http://www.html5rocks.com/en/tutorials/file/dndfiles/
handleFileSelect = (event) ->
files = event.target.files
for file in files
continue if !file.type.match('image.*')
reader = new FileReader
reader.onload = displayImage
# This will match anything that URI.parse will recognize, meaning that it’s a pretty accurate and powerful URL matcher.
class User
validates_format_of :website, :with => URI::regexp(%w(http https))
end
{
"_index":"bows",
"_type":"bow",
"_id":"181",
"_version":5,
"exists":true,
"_source":{
"aps":1.2,
"armour":null,
"base_name":"Citadel Bow",