Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
#' Description | |
#' This file runs a live election-night forecast based on The Economist's pre-election forecasting model | |
#' available at projects.economist.com/us-2020-forecast/president. | |
#' It is resampling model based on https://pkremp.github.io/update_prob.html. | |
#' This script does not input any real election results! You will have to enter your picks/constraints manually (scroll to the bottom of the script). | |
#' | |
#' Licence | |
#' This software is published by *[The Economist](https://www.economist.com)* under the [MIT licence](https://opensource.org/licenses/MIT). The data generated by *The Economist* are available under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/). | |
#' The licences include only the data and the software authored by *The Economist*, and do not cover any *Economist* content or third-party data or content made available using the software. More information about licensing, syndication and the copyright of *Economist* content can be fou |
https://github.com/adambair/rails-initiate/blob/master/rails-initiate.rdoc |
#!/bin/sh | |
#for db in commercialads_dev emberrailsapi_dev; do | |
# pg_dump -h pg-local -U postgres "$db" > "$db"_dump | |
#done | |
#list=`psql -l | awk '{ print $1}' | grep -vE '^-|^List|^Name|template[0|1]'` | |
list=`psql -h pg-local -U postgres -l | awk '{ print $1}' | grep -vE '^-|^\||^List|^Name|template[0|1]|postgres|^\('` | |
for lis in $list; do |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
class AddExpiresAtToOffer < ActiveRecord::Migration | |
def change | |
add_column :offers, :expires_at, :date | |
Offer.reset_column_information | |
Offer.find_each do |offer| | |
puts '...running loop' | |
offer.update_attribute(:expires_at, offer.created_at + 6.months) | |
offer.save |
after_save :expires_at #once its been saved update the expires_at attribute | |
def expired? | |
if accepted! #if an offer has been accepted it cannot expire | |
return false | |
else | |
created_at < expires_at ? false : true #if created_at is less than expires_at return false, else return true | |
end | |
end |
App.Photo.reopenClass({ | |
getRecent: function(query) { | |
var query = this._query(query), results; | |
query.method = 'flickr.photos.getRecent'; | |
return this.find(this._query(query)); | |
}, |
// Override DS.Adapter.didFindQuery only so that we can change the | |
// loader.populateArray function. Unfortunately, we can't just twiddle | |
// the populateArray function and let _super do the work. A hook would be nice. | |
didFindQuery: function(store, type, payload, recordArray) { | |
var loader = DS.loaderFor(store); | |
// ======================================== | |
// Here's the only difference! | |
// | |
if (type.toString() === 'App.Photo') { |