Skip to content

Instantly share code, notes, and snippets.

View gasolin's full-sized avatar

gasolin gasolin

View GitHub Profile
@patrickhammond
patrickhammond / android_instructions.md
Last active March 29, 2024 20:14
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule

Why is Google blocking Inbox on Firefox?

Recently, Google launched a new service called Inbox. It's basically Gmail re-invented with a different UI and UX. It's a good tool which improved my ability to keep a zero email inbox. I'm currently using the Android application of Inbox and not at all on the desktop, since it's not available for Firefox, my default browser. This requires me to open up Inbox in Google Chrome if I want to see it. Opening up Inbox in Firefox gives the following message:

Image of Inbox message if using Firefox

But, I couldn't understand why it's only available in Google Chrome so I started investigating on why it's so.

User Agent hack

@changtimwu
changtimwu / fluxpurejs.js
Last active February 4, 2016 07:19
gasolin demonstrates flux concept in only 50 lines of javascript
/* original link http://blog.gasolin.idv.tw/2014/11/flux-javascript.html */
// Renderer.js
var ClickRenderer = {
init: function s_init(element, Store) {
this.element = element;
this.store = Store;
window.addEventListener('render_view1', this);
},
handleEvent: s_handleEvent(evt) {
@yocontra
yocontra / flux.css
Created December 12, 2014 21:38
flux.css
html {
filter: brightness(0.8) sepia(0.9);
-o-filter: brightness(0.8) sepia(0.9);
-ms-filter: brightness(0.8) sepia(0.9);
-moz-filter: brightness(0.8) sepia(0.9);
-webkit-filter: brightness(0.8) sepia(0.9);
-salesforce-filter: brightness(0.8) sepia(0.9);
-dropbox-filter: brightness(0.8) sepia(0.9);
-blink-filter: brightness(0.8) sepia(0.9);
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@bahmutov
bahmutov / server-after.js
Last active August 7, 2017 17:34
Remove boilerplate when connecting promise-returning middleware to Express
// use point-free callbacks
// http://glebbahmutov.com/blog/point-free-programming-is-not-pointless/
var middleware = require('./middleware');
app.get('example/uri', function (req, res, next) {
middleware.first(req, res)
.then(next)
.catch(res.json)
.done();
}, function (req, res, next) {
middleware.second(req, res)
@carcinocron
carcinocron / debugger pause beforeunload
Last active April 25, 2024 16:48
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 07:54
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@pierrebeaucamp
pierrebeaucamp / LeanCanvas.md
Created November 12, 2015 04:05
A Lean Canvas in markdown

Lean Canvas

The Lean Canvas is a version of the Business Model Canvas adapted by Ash Maurya specifically for startups. You can read more about it here.

Problem

Top 3 Problems