Skip to content

Instantly share code, notes, and snippets.

@Restuta
Restuta / the-bind-problem.jsx
Last active March 16, 2024 00:22
React, removeEventListener and bind(this) gotcha
/* Sometimes it's pretty easy to run ito troubles with React ES6 components.
Consider the following code: */
class EventStub extends Component {
componentDidMount() {
window.addEventListener('resize', this.onResize.bind(this)); //notice .bind
}
componentWillUnmount() {
window.removeEventListener('resize', this.onResize.bind(this));
@irazasyed
irazasyed / Install Composer using MAMP's PHP.md
Last active April 2, 2024 18:45
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

@cowboy
cowboy / 1.before.js
Created June 25, 2012 17:46
grunt: an example of building task targets dynamically
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
min: {
ariaAccessibility: {
src: ['src/javascripts/jquery.selectBoxIt.ariaAccessibility.js'],
dest: 'src/javascripts/jquery.selectBoxIt.ariaAccessibility.min.js'
},
@dericcrago
dericcrago / gist:1886177
Created February 22, 2012 17:25
add trailing slash to Backbone.Model urls
// example
User = Backbone.Model.extend({
url: function() {
var origUrl = Backbone.Model.prototype.url.call(this);
return origUrl + (origUrl.charAt(origUrl.length - 1) == '/' ? '' : '/');
}
});
@addyosmani
addyosmani / details.js
Created September 12, 2011 12:34 — forked from remy/details.js
Add <details> support - includes stylesheet
/*
better details support testing
var isDetailsSupported = (function(doc) {
var el = doc.createElement('details'),
fake,
root,
diff;
if (!('open' in el)) {
@nuxlli
nuxlli / sublime_text_2_useful_shortcuts.md
Created September 9, 2011 18:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods