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
module.exports = async function(deployer, _, accounts) { | |
let someContract = await SomeContract.deployed(); | |
try { | |
// If this contract method fails, the migration does not stop | |
await someContract.someMethod(namehash(''), web3.utils.sha3("eth"), accounts[0]); | |
} | |
catch (err) { | |
console.log('Deploy step X failed', err); | |
throw new Error('Deploy step X failed'); |
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
truffle console --network ganache_cli | |
The full procedure is like this | |
- make sure that ganache_cli is running and truffle.js is configured properly | |
- truffle networks --clean // to reset old garbage | |
- truffle console --network ganache_cli | |
- migrate | |
- interact with your deploys smart contract via JS | |
- MySmartContract.deployed().then(function(instance) {... call your contract's instance methods ;}); |
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
myContract.deploy().send({from: accounts[1]}) |
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
import Web3 from 'web3'; | |
// We are assumming that the user has installed the Metamask browser extension | |
// and we are using Provider from the injected instance of web3 | |
// to create instance of Web3 of our desired version | |
// See https://www.udemy.com/ethereum-and-solidity-the-complete-developers-guide/learn/v4/t/lecture/9020582?start=0 for more details | |
// This way we can simply import preconfigured instance of web3 | |
const web3 = new Web3(window.web3.currentProvider); | |
export default web3; |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
items: [ | |
{id: 1, name: 'first item'}, | |
{id: 2, name: 'second item'}, | |
{id: 3, name: 'third item'}, | |
{id: 4, name: 'fourth item'}, |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
itemToDelete: null, | |
hasItemToDelete: Ember.computed('itemToDelete', function(){ | |
return this.get('itemToDelete') != null; | |
}), | |
_closeConfirmationDialog: function() { |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
myStrings: ['bla', 'asd', 'zzz', 'fgh'], | |
computedStrings: Ember.computed('myStrings.[]', function() { | |
return this.get('myStrings') | |
.map(aString => Ember.String.capitalize(aString)); | |
}), | |
actions: { |
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
nl2br(str) { | |
var newStr = str.split('\n').map(function(item) { | |
const key = Math.random() * (9999999 - 1) + 1; | |
return ( | |
<span key={key}> | |
{item} | |
<br/> | |
</span> | |
) |
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
nl2br(str) { | |
var newStr = str.split('\n').map(function(item) { | |
const key = Math.random() * (9999999 - 1) + 1; | |
return ( | |
<span key={key}> | |
{item} | |
<br/> | |
</span> | |
) |
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
app.directive('someDirective', function () { | |
return { | |
scope: { | |
oneWay: '@', | |
twoWay: '=', | |
expr: '&' | |
} | |
}; | |
}); |
NewerOlder