Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Adam Kirkwood adamkirkwood

🏠
Working from home
View GitHub Profile
@adamkirkwood
adamkirkwood / api-v1-plugins.json
Last active Mar 30, 2016
[GET] /api/v1/plugins
View api-v1-plugins.json
[
{
"name": "sync.sketchplugin",
"description": "Use Google Sheets to sync typography across your team.",
"author": "Stan",
"owner": "nolastan"
},
{
"name": "qordoba-for-sketch",
"description": "Qordoba’s Sketch plugin allows designers to translate their mockups to other languages, making product internationalization easier.",
@adamkirkwood
adamkirkwood / routes.rb
Created Mar 19, 2016
Sketchpacks.com OpenSearch implementation
View routes.rb
Rails.application.routes.draw do
# ...snip...
resources :plugins, concerns: :paginatable, path_names: { new: 'register' } do
get '/search', to: 'plugins#search', on: :collection, as: 'search'
end
# ...snip...
end
@adamkirkwood
adamkirkwood / plugins_controller.rb
Created Mar 19, 2016
Sketchpacks.com OpenSearch implementation
View plugins_controller.rb
class PluginsController < ApplicationController
# ...snip...
def search
redirect_to plugins_path if search_query.blank?
@plugins = Plugin.search(search_query).page params[:page]
# redirect to plugin if the search returned a direct hit
@adamkirkwood
adamkirkwood / opensearch.xml
Created Mar 19, 2016
Sketchpacks.com - OpenSearch definition
View opensearch.xml
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding>
<AdultContent>false</AdultContent>
<Language>en-us</Language>
<ShortName>Sketchpacks</ShortName>
<LongName>Google Search of Sketchpacks.com</LongName>
<Description>Use Google to search Sketchpacks, the Sketch Community's plugin registry and directory</Description>
@adamkirkwood
adamkirkwood / opensearch.xml
Created Mar 19, 2016
Sketchpack.com's OpenSearch implementation
View opensearch.xml
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding>
<AdultContent>false</AdultContent>
<Language>en-us</Language>
<ShortName>Sketchpacks</ShortName>
<LongName>Google Search of Sketchpacks.com</LongName>
<Description>Use Google to search Sketchpacks, the Sketch Community's plugin registry and directory</Description>
<Tags>sketchapp sketch plugins registry directory search</Tags>
View example usage
# Attach the scope as part of a chain in an ActiveRecord query:
UserFacebookFanpages.valid.tracked.find(:all)
@adamkirkwood
adamkirkwood / gist:1767824
Created Feb 8, 2012 — forked from ismasan/gist:1582736
Linode Ubuntu 10.04 (Lucid) with passenger & nginx for rails hosting
View gist:1767824
#################################################################
# #
# A guide to setting up a linode Ubuntu VPS for #
# Ruby on Rails hosting with nginx & passenger #
# #
# Compiled by Chris Toomey [ctoomey.com] on Sept. 9 2011 #
# #
#################################################################
# Start with base 10.04 image. Setup the DNS for any domains you
View gist:1317157
MOCHIGAMES.namespace(MOCHIGAMES, 'GameRating');
MOCHIGAMES.GameRating = (function(parent, $) {
var Settings = {
base: window.location.origin,
endpoint: 'api/v1/usergamerating'
};
var Game = {
View gist:1309716
DatabaseError at /
column profiles_userprofile.date_to_double_purchase_limit does not exist
LINE 1: ...s", "profiles_userprofile"."is_banned_from_chat", "profiles_...
^
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.3 SVN-67268
Exception Type: DatabaseError
Exception Value:
column profiles_userprofile.date_to_double_purchase_limit does not exist
View gist:1251880
<div class="offer-item">
<input type="radio" name="offerURL" class="radio" value="https://buy.boku.com/checkoutidentify/b6e52d180c115a1e28fc4cab/buy.js" />
<label><span class="item-amount">21,592</span> <span class="currency-name">MOCHICOINS</span> for $<span class="item-price">26.99</span></label>
</div>