This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GitHub delete all notifications button | |
// @namespace http://www.github.com/micolous/delete-all-notifications | |
// @description Adds a button to allow you to delete all notifications on a page. | |
// @include http://github.com/inbox/notifications* | |
// @include https://github.com/inbox/notifications* | |
// ==/UserScript== | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a Modernizr check for VML | |
Modernizr.addTest('vml', function() { | |
// Adapted from http://stackoverflow.com/questions/654112/how-do-you-detect-support-for-vml-or-svg-in-a-browser | |
var a = document.body.appendChild(document.createElement('div')); | |
a.innerHTML = '<v:shape id="vml_flag1" adj="1" />'; | |
var b = a.firstChild; | |
b.style.behavior = "url(#default#VML)"; | |
var supportsVml = b ? typeof b.adj == "object": true; | |
a.parentNode.removeChild(a); | |
return supportsVml; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#### | |
# Installer for Duplicity and boto backend to make backing | |
# up your OS X based system to wherever you want. Requires | |
# Homebrew (http://mxcl.github.com/homebrew/) to be installed | |
# first. | |
# | |
# To run: | |
# curl https://raw.github.com/gist/3418344/brew-duplicityboto.sh | bash | |
#### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#### | |
# Internal HTTP Monitor Script Plugin for Cloudkick. | |
# | |
# This script does a curl to a URL passed in on the command line and | |
# checks the return code provided by curl to determine whether or not | |
# the request was successuful or not. Useful for situations where you | |
# need to monitor the health of app servers behind a firewall/HAProxy | |
# setup. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is going to be a really quick summary of things, but it should give you an idea. | |
// (At least of some of the unique aspects of scala.) | |
// EXAMPLE 1: Flow control via pattern matching | |
trait HasUserIdentifier { | |
// Anything mixing this in must have a userId method | |
// that returns a string | |
def userId:String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.openstudy { package snippet { | |
import scala.xml._ | |
import java.io.InputStreamReader | |
import net.liftweb.common._ | |
import net.liftweb.http._ | |
import LiftRules._ | |
import net.liftweb.util._ | |
import Helpers._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentThing < ActiveRecord::Base | |
include SecureThingBehavior | |
# Make the storage location of all our secure things accessible | |
# along with whatever else you need. | |
attr_accessible :secure | |
end | |
class ThingA < ParentThing | |
attr_secure :meeting_location, :meeting_passcode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test1 | |
[1,2,3,4,5].each do |item| | |
next if item == 3 | |
puts item | |
end | |
end | |
def test2 | |
[1,2,3,4,5].each do |item| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class ContactPhones( home_phone:Option[String] = None, work_phone:Option[String] = None, | |
cell_phone:Option[String] = None) | |
case class ContactName( first_name:Option[String] = None, middle_name:Option[String] = None, | |
last_name:Option[String] = None) | |
case class Contact(email_addresses:List[EmailAddress], action_by:String, id:Long = 0, | |
status:Option[Status.Value] = None, prefix_name:Option[String] = None, | |
name:Option[ContactName] = None, job_title:Option[String] = None, | |
department_name:Option[String] = None, company_name:Option[String] = None, | |
phone:Option[ContactPhones] = None, fax:Option[String] = None, | |
addresses:List[Address] = List(), notes:List[Note] = List(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If we receive a jQuery JSONP call and we don't call the callback, add in a bogus | |
// call to the callback function. | |
LiftRules.responseTransformers.append { response => | |
response.toResponse match { | |
case resp @ InMemoryResponse(data, headers, _, _) => | |
{ | |
for(callback <- S.param("callback")) yield { | |
val dataStr = new String(data) | |
if (! dataStr.contains(callback)) { |
OlderNewer