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 base64 | |
import subprocess | |
def encode_powershell_command(command: str) -> str: | |
return base64.b64encode(command.encode('utf-16-le')).decode('utf-8') | |
def run_powershell_command(command: str, as_admin: bool = False): | |
encoded_command = encode_powershell_command(command) | |
if as_admin: |
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 sys | |
from copy import deepcopy | |
def add(x, y): | |
return reduce([x, y]) | |
def reduce(root): | |
root = deepcopy(root) |
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
'use strict'; | |
let path = require('path'); | |
let Funnel = require('broccoli-funnel'); | |
module.exports = { | |
name: require('./package').name, | |
preprocessTree(type, tree) { | |
if (type === 'template') { |
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
/* | |
This is an example of how you would compose two APIs that use AbortController. | |
The function `getLocalShops` first gets the user's geolocation coordinates | |
and then makes a fetch using these coordinates. Both of these operations could be expensive, | |
so we want to abort them as soon as the outer getLocalShops call is aborted. | |
*/ |
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({ | |
didRender() { | |
console.log("bar-column#didRender"); | |
} | |
}); |
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({ | |
init() { | |
this._super(...arguments); | |
// Simulate loading data in a route | |
this.store.push({ | |
data: [ | |
{ type: 'user', id: '1', attributes: { name: 'mmun' } }, |
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 DS from 'ember-data'; | |
export default DS.JSONAPIAdapter; |
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' | |
}); |
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
struct activity { | |
long s, e, h; | |
bool operator<(const activity& other) const { | |
return e < other.e; | |
} | |
}; | |
// code snippet | |
upper_bound(activities.begin(), activities.end(), {0, x, 0}) - a.begin(); |
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({ | |
names: ['martin', 'ricardo', 'spencer'] | |
}); |
NewerOlder