Skip to content

Instantly share code, notes, and snippets.

View flrent's full-sized avatar
🎧

Florent Lamoureux flrent

🎧
View GitHub Profile
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active October 14, 2024 00:05
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@brandonjp
brandonjp / findOverflowParents.js
Last active October 23, 2024 16:25
find overflow:hidden ancestors
// when you're trying to use `position:sticky` on an element
// you'll have trouble if any parent/ancestor element has
// overflow set to anything other than "visible" (such as: auto,hidden,overlay,scroll)
// & turns out if a parent is `display:flex` it might need some love
// (to remedy this you can set the `align-self` of your sticky element)
// see here for how the display & align-self properties affect: http://bit.ly/2ZaRu4o
// so, to find those troublesome parents...
// copy & paste this into Chrome Inspector/Dev Tools console
// (and be sure to change the #stickyElement below, if needed)
@tbranyen
tbranyen / app.js
Last active December 29, 2015 01:09
define(function(require, exports, module) {
'use strict';
var Ember = require('ember');
var App = Ember.Application.create({
rootElement: 'main',
Router: require('router')
});
@bloodyowl
bloodyowl / gist:6543749
Created September 12, 2013 21:02
Jony Ive bullshit generator
;(function(){
var text = [
[
"Right from the beginning, it appeared to us that designing the new"
, "When we first thought about it, we understood that designing the new"
]
, [
" iPhone"
, " iMac"
@TheBrousse
TheBrousse / tiapp.xml
Created March 10, 2013 16:19
To use Holo theme on Andriod, simply add the following in your tiapp.xml file. You are using a device that does not support this theme, it will fallack to the default theme on 2.x automatically.
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>16</tool-api-level>
<manifest android:installLocation="preferExternal"
android:versionCode="3" android:versionName="1.0.2">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>
<application android:theme="@android:style/Theme.Holo">
<activity
android:configChanges="keyboardHidden|orientation"
android:name="org.appcelerator.titanium.TiActivity"
android:screenOrientation="portrait"
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active November 5, 2024 18:44
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@fabiomcosta
fabiomcosta / sync-settimout-snippet.js
Created August 26, 2011 21:06
Mocks the setTimeout function with jasmine, making setTimeout dependent tests synchronous and easier to test.
// inside your beforeEach hook
spyOn(window, 'setTimeout').andCallFake(function(fn){
fn.apply(null, [].slice.call(arguments, 2));
return +new Date;
});
...