Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Maximilian Hoffmann maxhoffmann

👋
View GitHub Profile
View notification.js
var $ = require('NodObjC');
$.import('Cocoa');
var installNSBundleHook = function() {
var cls = $.NSBundle;
if (cls) {
var bundleIdentifier = cls.getInstanceMethod('bundleIdentifier');
bundleIdentifier.setImplementation(function(val) {
@spoike
spoike / reactjs_componentapi_cheatsheet.md
Created May 13, 2014
React JS Cheatsheets for Component API, Specifications and Lifecycle
View reactjs_componentapi_cheatsheet.md

ReactJS Component Cheatsheet

To create a ReactComponent:

ReactComponent React.createClass(object proto)

Basic JSX example:

var TitleComponent = React.createClass({
  // REQUIRED
View bloop.js
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
View express-static.js
function onlyStatic (middleware) {
return function (req, res, next) {
var match = /(\.css|\.eot|\.gif|\.html|\.js|\.png|\.svg|\.ttf|\.woff|\.jpg)($|\?.*$)/ig.exec(req.originalUrl);
if (!match) return next();
middleware(req, res, next);
};
}
//usage
this.use(onlyStatic(express.static(__dirname + "/public")));
@dustinsenos
dustinsenos / gist:5294392
Created Apr 2, 2013
Retina Mouse Cursor Files. Below is the file location of the retina mouse cursors on OS X 10.8.3. All files are .pdfs (thanks Apple) so they should work perfectly in Photoshop, Illustrator etc.
View gist:5294392
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HiServices.framework/Versions/A/Resources/cursors
@desandro
desandro / require-js-discussion.md
Created Jan 31, 2013
Can you help me understand the benefit of require.js?
View require-js-discussion.md

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@paulmillr
paulmillr / safari-web-inspector.md
Last active Oct 12, 2015
Safari web inspector evolution
View safari-web-inspector.md

As a developer, i’m curious what happens to tools I use. Some time ago I decided to log all changes in web inspectors of browsers.

So far list includes only Safari and Firefox primarly because it’s easy to track their changes. In the future other browsers will be in too.

Safari web inspector evolution

  • August 2012: Initial release of new safari web inspector. It had terrible UI / UX.
  • October:
    • Reduced main panels count from 8 to 3-4.
  • November:
@trcarden
trcarden / gist:3295935
Created Aug 8, 2012
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
View gist:3295935
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@cowboy
cowboy / Abstraction.js
Created May 24, 2012
A modern JavaScript if-elseif-else abstraction, because control flow statements are so 1995
View Abstraction.js
/*
* Abstraction.js
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Licensed under the MIT license.
* http://benalman.com/about/license/
*/
var Abstraction = (function($) {
var _ = $.prototype;
View ios-8-web-app.html
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->