This file contains hidden or 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
check process dropbox with pidfile /home/username/.dropbox/dropbox.pid | |
start program = "/home/username/.dropbox-dist/dropboxd-nice" | |
as uid username and gid username | |
stop program = "bin/bash -c '/bin/kill -9 `cat /home/username/.dropbox/dropbox.pid`'" | |
as uid username and gid username |
This file contains hidden or 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
# an example, showing how to load for rspec and conditionally load for cucumber | |
# lives in whichever dir you set the other file to load | |
module ImageStepHelpers | |
def page_should_contain_image_link_for(image) | |
page.should have_xpath(%Q(//img[@src="#{image.url}"])) | |
end | |
def image_data_from_file(image) | |
image_file_path = Rails.root.join image.image.path |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>test-vticker</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="http://sdepold.github.io/jquery-rss/src/jquery.rss.js"></script> | |
<script src="http://richhollis.github.com/vticker/downloads/jquery.vticker.min.js?v=1.14"></script> | |
<script> | |
$(function() { |
This file contains hidden or 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
(defn deck [] | |
(for [suit [:clubs :hearts :spades :diamonds] | |
pip (range 2 15)] | |
{:suit suit | |
:pip pip})) | |
(defn hand-frequencies [hand] | |
(frequencies (map :pip (hand)))) | |
(defn n-of-a-kind? |
This file contains hidden or 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
(ns crash-course-github | |
(:require [clj-http.client :as http] | |
[cheshire.core :refer [parse-string]] | |
[clojure.pprint :refer [pprint]])) | |
(use 'crash-course-github) | |
(defn query-github | |
"Run an arbitrary query against Github API." | |
[query] |
This file contains hidden or 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
(require 'crash-course-clojure.spotify) | |
(use 'crash-course-clojure.spotify) | |
(def tracks | |
(love :tracks) | |
) | |
(def tracks-sorted | |
(sort (fn [x y] (> (count(x :name)) (count(y :name)))) tracks) | |
) |
This file contains hidden or 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
tables = [] # or ActiveRecord::Base.connection.tables | |
collation = "utf8_unicode_ci" | |
char_set = "utf8" | |
db = "your_database_name" | |
# write out | |
puts "USE #{db};" | |
puts "ALTER DATABASE #{db} CHARACTER SET #{char_set} COLLATE #{collation};" | |
tables.each do |t| | |
puts "ALTER TABLE #{t} CHARACTER SET #{char_set} COLLATE #{collation};" # changes for new records | |
puts "ALTER TABLE #{t} CONVERT TO CHARACTER SET #{char_set} COLLATE #{collation};" # migrates old records |
This file contains hidden or 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
import SimpleHTTPServer | |
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def send_head(self): | |
"""Common code for GET and HEAD commands. | |
This sends the response code and MIME headers. | |
Return value is either a file object (which has to be copied | |
to the outputfile by the caller unless the command was HEAD, | |
and must be closed by the caller under all circumstances), or |
This file contains hidden or 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
# controllers/api/api_controller.rb | |
class Api::ApiController < ApplicationController | |
respond_to :json | |
before_filter :ensure_user | |
rescue_from ::ApiException do |exception| | |
logger.info "ApiException #{exception.inspect}" | |
render :json => { :errors => { :error => exception.message} }.to_json, :status => 400 |
This file contains hidden or 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
-----BEGIN CERTIFICATE----- | |
MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMRMwEQYDVQQDDApyaWNo | |
aG9sbGlzMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNj | |
b20wHhcNMTMwNDAyMTEzODA0WhcNMTQwNDAyMTEzODA0WjBBMRMwEQYDVQQDDApy | |
aWNoaG9sbGlzMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ | |
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9lueRqZlS9BWQ | |
KM2Vt8Ajc7goi4mivw+QfuQTbkk3quGuF/ZFrQuyh/N+GXKJmIt/GPoDphVUOBGo | |
nDMd10NAIdQzHsOzElTAZi85KonMJ8KUG3JTqnomNFjKtxdVSTyi4COSpSemT6Y1 | |
WglANxXyG2PtUOypsMjdDmDrZ0zx0N/+Ovg5lGh862f6rDQDk1EGsdUAa1E7cGGu | |
FCIBimJ5t/YX86g0+XedXcMeu8neb7zjIb0TaH5p5N/+hRwWh155kt8EsP9Grz7t |