Skip to content

Instantly share code, notes, and snippets.

@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 / t9.coffee
Last active June 27, 2017 00:05
Solving t9 by compiling regular expressions
_ = require 'underscore'
# My phone
dialpad = {
'1': []
'2': ['a','b','c']
'3': ['d','e','f']
'4': ['g','h','i']
'5': ['j','k','l']
'6': ['m','n','o']
@egeste
egeste / bureau-rvm.zsh-theme
Last active November 21, 2017 23:05
Oh My ZSH NVM, RVM, optimized "Bureau" Theme
# oh-my-zsh Customized Bureau Theme
### NVM
ZSH_THEME_NVM_PROMPT_PREFIX="(node-"
ZSH_THEME_NVM_PROMPT_SUFFIX=")"
### RVM
ZSH_THEME_RVM_PROMPT_PREFIX="("
ZSH_THEME_RVM_PROMPT_SUFFIX=""
@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"
<?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 / withErrorBoundary.js
Created November 30, 2018 21:30
Using React 16 error boundaries in a decorator
import React, { PureComponent } from 'react'
import DefaultFallbackComponent from 'wherever'
export default (FallbackComponent = DefaultFallbackComponent) => {
return ComposedComponent => {
class ErrorBoundary extends PureComponent {
state: {
info: undefined,
error: undefined
// Go to sumologic, open the chrome dev tools, paste this into the console, and run it (press enter).
// This script will cycle through all of your open dashboards in the current tab every 5 mins.
(function() {
let tabIndex = 0; // Start at index 0
const timeout = ((1000 * 60) * 5); // 5 min
setInterval(function () { // Start the timer
// Get whatever dashboard tabs are open at execution
const tabs = document.querySelectorAll('.tab-navigator__tab.tab-navigator__regular-tab._dashboard');
tabIndex++; // Increment the index
@egeste
egeste / sublime-preferences.json
Last active December 10, 2021 19:26
My Sublime preferences
{
"additional_path_items":
[
"/Users/sregester/.rvm/gems/ruby-2.1.6/bin/"
],
"auto_indent": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,