Skip to content

Instantly share code, notes, and snippets.

View moski's full-sized avatar

Moski Doski moski

View GitHub Profile
@moski
moski / .gitconfig
Created January 24, 2011 12:20
gitconfig file
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
@moski
moski / .gemrc
Created January 24, 2011 12:31
this will speed up gem installation and prevent rdoc and ri from being generated, this is not nessesary in the production environment.
---
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
gem: --no-ri --no-rdoc
@moski
moski / url_expander_credentials.yml
Created July 16, 2011 07:50
Sample config file to be used with the url_expander gem
---
:bitly:
:login: 'moski'
:api_key: 'XXXXXXXXXXXXXXX'
@moski
moski / expand_url.json
Created July 23, 2011 09:13
/api/v1/urls/expand_url response
/* Expand Url (JSON)
Ex: curl http://xpandurl.com/api/v1/urls/expand_url.json?short_url=http%3A%2F%2Fgoo.gl%2FDRppM
Parameters:
short_url: The url you want to expand [Required]
**/
{ "expand_count":25,
@moski
moski / expand_url.xml
Created July 23, 2011 10:21
/api/v1/urls/expand_url XML response
<!-- Expand Url (XML)
Ex: curl http://xpandurl.com/api/v1/urls/expand_url.xml?short_url=http%3A%2F%2Fgoo.gl%2FDRppM
Parameters:
short_url: The url you want to expand [Required]
-->
@moski
moski / expand_url_invalid_url.json
Created July 23, 2011 10:30
Trying to expand an invalid url.
/* Expand Url (JSON) Error: Trying to expand an invalid shortening key
Ex: curl http://xpandurl.com/api/v1/urls/expand_url.json?short_url=http%3A%2F%2Fgoo.gl%2FDRppM1111111111
**/
{ "error":"Not Found - '404'",
"code":404 }
@moski
moski / expand_url_invalid_url.xml
Created July 23, 2011 10:35
Trying to expand an invalid url
<!-- Expand Url (XML) Error: Trying to expand an invalid shortening key
Ex: curl http://xpandurl.com/api/v1/urls/expand_url.xml?short_url=http%3A%2F%2Fgoo.gl%2FDRppM1111111
-->
<?xml version="1.0" encoding="UTF-8"?>
<code>404</code>
<error>Not Found - '404'</error>
@moski
moski / backbone.iframe.sync.js
Created October 13, 2011 16:10
Getting backbone-rails to play nicely with iframe upload
(function () {
Backbone.syncWithoutUpload = Backbone.sync
Backbone.syncWithUpload = function(method, model, options) {
var methodMap = {
'create': 'POST',
'update': 'PUT',
'delete': 'DELETE',
'read' : 'GET'
};
var type = methodMap[method];
@moski
moski / new_view.js.coffee
Created November 28, 2011 12:15
A sample New View backbone class that uses iframe.
Lifelane.Views.Posts ||= {}
class Lifelane.Views.Posts.NewView extends Backbone.View
template: JST["backbone/templates/posts/new"]
events:
"submit #create-post": "save"
# The constructor for creating new post.
constructor: (options) ->
@moski
moski / custom_backbone_datelink.js.coffee
Created November 28, 2011 12:38
Make sure to disable the change event on the html input type file.