Skip to content

Instantly share code, notes, and snippets.

class RestrictPrecisionOnExistingMetrics < ActiveRecord::Migration
def up
ActiveRecord::Base.record_timestamps = false
begin
AnswersMetric.find_each(&:save)
MetricValue.find_each(&:save)
ensure
ActiveRecord::Base.record_timestamps = true
define([
'angular'
], function(angular) {
'use strict';
angular.module('common.pagination', [])
/**
* @ngdoc service
namespace :move_eei_content do
PROGRAM_IDS = [ 595, 596, 597, 598, 599, 600, 601, 602, 603, 613, 614, 615, 616, 617, 618, 849, 855, 856, 619, 620, 621, 622, 623, 625, 626, 627, 656, 628, 629, 630, 631, 632, 633, 634, 859, 882, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 624, 651, 652, 653, 654, 655, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667 ]
CIVIC_CHARACTER_FORMATION_ID = 32
desc 'moves selected eei programs to civic character formation champion'
task :run => :environment do
Tree.where(id: PROGRAM_IDS).each do |tree|
puts "Moving #{tree.title}..."
import { authApiFetch } from '../util/fetch';
export function loadImpa() {
return (dispatch) => {
authApiFetch('/api/get-impa', {
method: 'GET'
}).then((data) => {
if (data.error) {
@nicovalencia
nicovalencia / pseudo.js
Created January 24, 2017 22:36
el-table
// ctrl
() => {
this.dataObj = new supergloo.pager('connected_users');
}
// html
import React from 'react';
class InputList extends React.Component {
constructor({ items }) {
super({ items });
this.state = { items };
}
render() {
const Web3 = require('web3');
const fetch = require('node-fetch');
const POLLING_INTERVAL = 5000;
const EVENTS = {
Transfer: {}
};
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));
const Web3 = require('web3');
const fetch = require('node-fetch');
const ipfsAPI = require('ipfs-api');
const ipfs = ipfsAPI('localhost', '5002');
const POLLING_INTERVAL = 5000;
const EVENTS = {
Transfer: {}
};
mapping (uint256 => Auction) auctionsByTokenId
struct Auction {
address highestBidder
uint256 highestBidAmount
uint256 endsAtBlock
uint256 tokenId
}
uint256 constant INITIAL_BID = 0.01 eth
uint256 constant MIN_BID_INCREMENT = 0.01 eth
uint256 constant EXPIRED_TOKEN_COST = 0.05 eth
it('should require Auction to be ended', async () => {
let playerId = getNextCommonPlayerId();
await instance.createCommonAuction.sendTransaction(playerId, fakeTokenURI);
let auctionsCount = (await instance.totalAuctionsCount()).toNumber();
let lastAuctionIndex = auctionsCount - 1;
// Start auction:
await instance.incrementBid.sendTransaction(lastAuctionIndex, { value: web3.toWei(0.01, 'ether'), from: accounts[1] });
try {