Skip to content

Instantly share code, notes, and snippets.

Xavier Cambar xcambar

Block or report user

Report or block xcambar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
testString: 'Ember Twiddle'
});
View components.my-component.js
import Component from '@ember/component'
export default Component.extend({
tagName: '',
aIsChecked: false,
bIsChecked: false,
someOtherMethod() {
console.log('someOtherMethod() this = ', this)
},
someMethod() {
@xcambar
xcambar / strip_tags.js
Last active Sep 3, 2018
Efficiently and securely remove <script> tags from source HTML
View strip_tags.js
// This code would normally inject global variables and run an alert
// if injected in your document naively
const source = '<p>bla <script>window.SHIT=true</script></p><script>alert("SHIT")</script>'
// Crete a DocumentFragment from the source HTML
const frag = document.createRange().createContextualFragment(source)
// Remove all the <script> nodes
[...frag.querySelectorAll('script')].forEach((e)=> {
e.parentNode.removeChild(e)
@xcambar
xcambar / controllers.application.js
Created Apr 20, 2018
ember-modal-dialog: double onClose call
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
countClose: 0,
incCloseCount() {
this.incrementProperty('countClose');
}
});
@xcambar
xcambar / vagrant.sh
Last active Feb 2, 2017
Show vagrant status
View vagrant.sh
[ -e .vagrant ] && (VBoxManage showvminfo $(cat .vagrant/machines/default/virtualbox/id) --machinereadable | grep 'VMState=' | sed 's/.*"\(.*\)"[^"]*$/\1/)
@xcambar
xcambar / controllers.application.js
Created Jan 18, 2017
ember-one-way-controls radio bug
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
myValue: '?',
actions: {
setToSomethingElse() {
this.set('myValue', 'something else');
}
}
});
View keybase.md

Keybase proof

I hereby claim:

  • I am xcambar on github.
  • I am xcambar (https://keybase.io/xcambar) on keybase.
  • I have a public key ASBzE-UDKYiIs5y1i-k-VVup6VcmZ-S_OqHnKS-q2RjeAQo

To claim this, I am signing this object:

View browserstack.log
Starting BrowserStack Local { key: 'XXX...', force: true }
BrowserStack Local started
Started child process for: chrome 52 environment
Started child process for: chrome 51 environment
Started child process for: ie 11 environment
Started child process for: ie 10 environment
Started child process for: ie 9 environment
Started child process for: safari 9.1 environment
Started child process for: safari 8 environment
Started child process for: safari 7.1 environment
@xcambar
xcambar / docker_machine_indicator.sh
Created Feb 23, 2016
Indicates the currently active docker machine, if any.
View docker_machine_indicator.sh
function docker_indicator() {
if [[ -n "$DOCKER_MACHINE_NAME" ]]; then
echo "%F{blue}(🐳 $DOCKER_MACHINE_NAME)%f"
fi
}
View ENV
```sh
$ env | sort
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.XWX6O4Sj3X/Render
BASE16_MODE=dark
BASE16_SCHEME=flat
BROWSER=open
CHROME_BIN=CHROME_BIN=~/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
COLORFGBG=7;0
COMMAND_MODE=unix2003
You can’t perform that action at this time.