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 valid_password?(incoming_password) | |
result = super incoming_password | |
if !result | |
# try old encryptor during transition | |
digest = Devise::Encryptors::CakeLegacy.digest(incoming_password, self.class.stretches, self.password_salt, self.class.pepper) | |
result = Devise.secure_compare(digest, self.encrypted_password) | |
if result | |
# update password to use new encryptor when there is a match | |
self.password = incoming_password | |
self.save |
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 main | |
import ( | |
"fmt" | |
"math" | |
"strconv" | |
) | |
func main() { | |
smallest, _ := strconv.ParseInt("aaaaaaaaa", 16, 0) |
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
Ember.Application.initializer({ | |
name: "loadWidgets", | |
initialize: function(container) { | |
App.deferReadiness(); | |
Ember.$.getJSON("/widgets.json", function(json) { | |
var store = container.get('store:main'); | |
store.load(App.Widgets, json); | |
App.advanceReadiness(); | |
}); | |
} |
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
serializer = DS.JSONSerializer.create() | |
serializer.configure 'App.Model', | |
sideloadAs: 'models' | |
App.RestAdaptor = DS.RESTAdapter.extend | |
serializer: serializer | |
App.Store = DS.Store.extend | |
adapter: App.RestAdaptor |
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
Person = DS.Model.extend | |
fields: DS.belongsTo("Fields") | |
Fields = DS.Model.extend | |
goats: DS.attr("number") | |
serializer = Ls.JSONSerializer.create() | |
serializer.map Fields, | |
fields: embedded: 'always' | |
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
stringThings = function(array) { | |
var string, v, i, len; | |
string = ""; | |
for (i = 0, len = array.length; i < len; i++) { | |
v = array[i]; | |
string += "" + v.key + v.value; | |
} | |
return 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
var singleValues =""; | |
$(document).ready(function(){ | |
$('form.forms').submit(function(event) { | |
event.preventDefault(); | |
var input_value = $(this).find('input.inputs').val(); | |
var s = aL(input_value); | |
alert(s); | |
}); |
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
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs) | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
# Enable the 2D Dock | |
defaults write com.apple.dock no-glass -bool true | |
# Disable menu bar transparency | |
defaults write -g AppleEnableMenuBarTransparency -bool false | |
# Expand save panel by default |
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
require 'json' | |
require 'restclient' | |
api_key = "<insert apikey>" | |
start_date = "2011-01-01" # YYYY-MM-DD | |
end_date = "2013-01-01" | |
url = "http://www.pipelinedeals.com/api/v3/deals?api_key=#{api_key}&conditions[deal_created][from_date]=#{start_date}&conditions[deal_created][to_date]=#{end_date}" | |
response = RestClient.get(url) | |
json = JSON.parse(response) |
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
require 'mongoid' | |
ENV["RACK_ENV"] = 'test' | |
Mongoid.load!("./config/mongoid.yml") | |
class Tag | |
include Mongoid:: Document | |
end |