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 sb = new StringBuilder(); | |
var sw = new StringWriter(sb); | |
using(var writer = new HtmlTextWriter(sw)) | |
{ | |
writer.AddAttribute(HtmlTextWriterAttribute.Href, someUrl); | |
writer.AddAttributeValues(HtmlTextWriterAttribute.Class, "actionCell", "download"); | |
writer.AddAttributeIf(Target != null, HtmlTextWriterAttribute.Target, Target); | |
writer.RenderBeginTag(HtmlTextWriterTag.A); | |
writer.WriteEncodedText("Download"); |
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.directive("sgReadonly", [() => { | |
function toggleDisableAttr(fields:any[], isDisabled:boolean) { | |
_.each(fields, (f: any) => angular.element(f).prop('disabled', isDisabled)); | |
} | |
return { | |
restrict: "A", | |
scope: { | |
isReadonly: '=sgReadonly', |
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
.transition(@property, @duration: 1s){ | |
-webkit-transition: @property @duration; | |
-moz-transition: @property @duration; | |
-ms-transition: @property @duration; | |
-o-transition: @property @duration; | |
transition: @property @duration; | |
} |
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: '&' | |
} | |
}; | |
}); |
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
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
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', | |
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 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; |
OlderNewer