Skip to content

Instantly share code, notes, and snippets.

View rek's full-sized avatar
🏋️

adam tombleson rek

🏋️
  • CNTXT
  • Riyadh, Saudi Arabia
View GitHub Profile
@jeromepl
jeromepl / Enhance.js
Last active April 6, 2020 20:26 — forked from sebmarkbage/Enhance.js
Higher-order Components in React with ES7
import { Component } from "React";
export default (ComposedComponent) => class extends Component {
constructor(props) {
super(props);
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
@paulirish
paulirish / readme.md
Last active June 17, 2022 06:46
resolving the proper location and line number through a console.log wrapper

console.log wrap resolving for your wrapped console logs

I've heard this before:

What I really get frustrated by is that I cannot wrap console.* and preserve line numbers

We enabled this in Chrome DevTools via blackboxing a bit ago.

If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.

@Hunter-Dolan
Hunter-Dolan / gist:4579913
Created January 20, 2013 17:10
"Post Commit" hook to append the lolcommits image to every commit.
#!/usr/bin/env ruby
commit = `git log -1 --oneline`
hash = commit.to_s.split(" ").first
message = commit.sub("#{hash} ", "")
unless(message.gsub("\n","").end_with?(".jpg"))
`lolcommits --capture`
repopath = `git rev-parse --show-toplevel`.gsub("\n", "")
repourl = `git config --get remote.origin.url`.gsub("\n", "")
@andrewdeandrade
andrewdeandrade / reverse_alphabetical_sort_in_backbone
Created May 1, 2011 04:10
Reverse Alphabetical Sort in Backbone.js
// Assumption: You have a model with a name.
comparator: function (User) {
if (User.get("name")) {
var str = User.get("name");
str = str.toLowerCase();
str = str.split("");
str = _.map(str, function(letter) { return String.fromCharCode(-(letter.charCodeAt(0))) });
return str;
};