Skip to content

Instantly share code, notes, and snippets.

View alexanderjeurissen's full-sized avatar

Alexander Jeurissen alexanderjeurissen

View GitHub Profile
@jpadilla
jpadilla / components.my-component.js
Last active April 21, 2023 17:14
Component Lifecycle Hooks
import Ember from 'ember';
export default Ember.Component.extend({
didInitAttrs(options) {
console.log('didInitAttrs', options);
},
didUpdateAttrs(options) {
console.log('didUpdateAttrs', options);
},
@zchee
zchee / actionlist.vim
Last active May 17, 2024 04:39
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@junegunn
junegunn / gist:f4fca918e937e6bf5bad
Last active May 4, 2024 05:07
Browsing git commit history with fzf
# fshow - git commit browser (enter for show, ctrl-d for diff, ` toggles sort)
fshow() {
local out shas sha q k
while out=$(
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --multi --no-sort --reverse --query="$q" \
--print-query --expect=ctrl-d --toggle-sort=\`); do
q=$(head -1 <<< "$out")
k=$(head -2 <<< "$out" | tail -1)
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
# Paste this function in your ".bashrc" to enable the "pomo" command in your terminal
# POMODORO Terminal:
function pomo {
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo -e "POMODORO Terminal\n"
echo "usage: pomo 25 minutes timeout"
echo -e " or: pomo [options] see options below\n"
echo "Options:"
echo " short: 05 minutes timeout"
echo " long: 15 minutes timeout"
@sebmarkbage
sebmarkbage / transferring-props.md
Last active August 2, 2022 10:44
Deprecating transferPropsTo

Deprecating transferPropsTo

It's a common pattern in React to wrap a component in an abstraction. The outer component exposes a simple property to do something that might have more complex implementation details.

We used to have a helper function called transferPropsTo. We no longer support this method. Instead you're expected to use a generic object helper to merge props.

render() {
 return Component(Object.assign({}, this.props, { more: 'values' }));
@TravelingTechGuy
TravelingTechGuy / ChromeExtensionGulp.js
Created April 5, 2014 19:22
Gulp file for building a Chrome Extension
'use strict';
//npm install gulp gulp-minify-css gulp-uglify gulp-clean gulp-cleanhtml gulp-jshint gulp-strip-debug gulp-zip --save-dev
var gulp = require('gulp'),
clean = require('gulp-clean'),
cleanhtml = require('gulp-cleanhtml'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
stripdebug = require('gulp-strip-debug'),
@leemour
leemour / Guardfile
Created February 19, 2014 18:23
Guard was slow now is fast with ignore
ignore([%r{^bin/*}, %r{^config/*}, %r{^db/*}, %r{^lib/*}, %r{^log/*}, %r{^public/*}, %r{^tmp/*}])
guard :rspec, :spec_paths => ['spec/models', 'spec/lib'],
cmd: 'spring rspec -f doc --tag ~@slow',
# all_after_pass: true,
all_on_start: false,
failed_mode: :keep do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
@tarzan
tarzan / .jsbeautifyrc
Last active July 13, 2018 12:43
.jsbeautifyrc
{
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"brace_style": "collapse", // "expand", "end-expand", "expand-strict"
"indent_char": " ",
"indent_scripts": "keep", // "separate", "normal"
"indent_size": 4,
"max_preserve_newlines": 10,
"preserve_newlines": true,
@tirthb
tirthb / gist:5366126
Created April 11, 2013 18:52
Neo4j cypher query to remove orphan nodes i.e. nodes with no relationships
START n=node(*)
WHERE not(n-[*..2]-())
DELETE n;