Skip to content

Instantly share code, notes, and snippets.

View Ghostscript Devices
GPL Ghostscript 9.14 (2014-03-26)
Copyright (C) 2014 Artifex Software, Inc. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-g<width>x<height> page size in pixels | -r<res> pixels/inch resolution
-sDEVICE=<devname> select device | -dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
View ruby211-readline63.patch
Index: orig/ext/readline/readline.c
===================================================================
--- orig/ext/readline/readline.c (revision 45224)
+++ fixed/ext/readline/readline.c (revision 45225)
@@ -1974,7 +1974,7 @@
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
View TestflihtappDeployTeamcity.sh
#!/bin/bash
#
# testflightapp.com tokens
API_TOKEN="YOUR_API_TOKEN"
TEAM_TOKEN="YOUR_TEAM_TOKEN"
PRODUCT_NAME="RowMotion"
ARTEFACTS="$PWD/Artefacts"
View designer.html
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
View cmd
doug@swift1-01:/etc/swift$ env|grep ST_
ST_AUTH=http://127.0.0.1:8080/auth/v1.0
ST_USER=test:tester3
ST_KEY=testing3
View gist:603217
// Load the original image from disk
using (Image originalImage = Image.FromFile(Server.MapPath("~/App_Data/" + file.FileName)))
{
// Apply the queued transformations to the original image
using (Image newImage = filters.Apply(originalImage))
{
return File(newImage.ToByteArray(), file.ContentType);
}
}
View custom_steps.rb
Given /^I visit subdomain "(.+)"$/ do |sub|
#host! "#{sub}.example.com" #for webrat
Capybara.default_host = "#{sub}.example.com" #for Rack::Test
Capybara.app_host = "http://#{sub}.example.com:9887" if Capybara.current_driver == :culerity
################################################################################
# As far as I know, you have to put all the {sub}.example.com entries that you're
# using in your /etc/hosts file for the Culerity tests. This didn't seem to be
# required for Rack::Test
################################################################################
@doxavore
doxavore / mongoid_scope_building.rb
Created Nov 17, 2010
Using Mongoid's scoping mechanisms can really add up... not always in a good way.
View mongoid_scope_building.rb
# Example implementation, ignoring the less important details:
class MyTree
include Mongoid::Document
include Mongoid::Tree
referenced_in :account, :inverse_of => :trees
field :slug
scope :slugged, lambda { |s, options={}| where(options.merge(:slug => s)).first }
View gist:736619
// jQuery barfs because $(empty).data("autocomplete") => undefined
$(".course-autocomplete").autocomplete({
source: "/courses/autocomplete.json"
}).data("autocomplete")._renderItem = function(ul, item) {
return $("<li>")
.data("item.autocomplete", item)
.append("<a>" + item.name + "</a>")
.appendTo(ul);
};
View gist:796283
first = ["t", "o", "p", "c", "o", "d", "e", "r", "s", "i", "n", "g", "l", "e", "r",
"o", "u", "n", "d", "m", "a", "t", "c", "h", "f", "o", "u", "r", "n", "i"]
second = ["n", "e", "f", "o", "u", "r", "j", "a", "n", "u", "a", "r", "y", "t", "w",
"e", "n", "t", "y", "t", "w", "o", "s", "a", "t", "u", "r", "d", "a", "y"]
hash = Hash.new(0)
(first + second).each_with_index do |element, i|
hash[element] += 1
end