Skip to content

Instantly share code, notes, and snippets.

@rik
rik / simulateTyping.js
Created Sep 1, 2017
Fake typing animation with async/await
View simulateTyping.js
async function nextFrame() {
return new Promise((resolve) => {
requestAnimationFrame(resolve)
})
}
async function randomDelay(min, max) {
const delay = Math.random() * (max - min) + min;
const startTime = performance.now()
while (performance.now() - startTime < delay) {
@rik
rik / feed.xml
Created Mar 29, 2017
Microsoft Edge Dev Blog
View feed.xml
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
<channel>
<title>Microsoft Edge Dev Blog</title>
<atom:link href="https://blogs.windows.com/msedgedev/feed/" rel="self" type="application/rss+xml"/>
<link>https://blogs.windows.com/msedgedev</link>
<description>Official blog of the Microsoft Edge Web Platform Team</description>
<lastBuildDate>Fri, 24 Mar 2017 16:06:25 +0000</lastBuildDate>
<language>en-US</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
@rik
rik / ugly-batch.diff
Created Oct 23, 2015
Batch, not so ugly
View ugly-batch.diff
containers/NavigationContainer.jsx | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/containers/NavigationContainer.jsx b/containers/NavigationContainer.jsx
index 2ae609f..071d35d 100644
--- a/containers/NavigationContainer.jsx
+++ b/containers/NavigationContainer.jsx
@@ -30,6 +30,10 @@ import TopNavigationModal from 'Components/Navigation/TopNavigationModal.jsx';
export default React.createClass({
mixins: [i18nContextMixin],
View feed.xml
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
<title>Carnets de La Grange</title>
<subtitle>Chroniques d'un po&#xE8;te urbain</subtitle>
<id>tag:la-grange.net,2000-04-12:karl</id>
<updated>2015-09-27T08:21:00Z</updated>
<link href="http://www.la-grange.net/feed.atom" rel="self" type="application/atom+xml"/>
<link href="http://www.la-grange.net/" rel="alternate" type="application/xhtml+xml"/>
<link href="http://creativecommons.org/licenses/by/2.0/fr/" rel="license"/>
<icon>http://www.la-grange.net/favicon.png</icon>
View gist:8c60533b9fc0a4da3d6c
ensure_endpoint: function() {
if (!navigator.push) {
// Do nothing when push notifications are not supported
console.log('no support for push notifications');
return Promise.resolve();
}
if (ensure_endpoint_in_progress) {
return Promise.resolve();
}
View gist:0b5a769d99f94f1cc916
commit 6a5062cfc309c819c9f6958f15b2abc54b66f0c9
Author: Anthony Ricaud <anthony@ricaud.me>
Date: Sat Jan 5 22:40:15 2013 +0100
Don't choke on large git repos
diff --git a/themes/wedisagree.zsh-theme b/themes/wedisagree.zsh-theme
index 9bdbce4..87ab659 100644
--- a/themes/wedisagree.zsh-theme
+++ b/themes/wedisagree.zsh-theme
View gist:127171f5cb3fea5971d8
http_sumo_app: 10:25:43 django.request:ERROR Internal Server Error: /api/2/user/generate: /Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/django/core/handlers/base.py:224
Traceback (most recent call last):
File "/Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 88, in get_response
response = middleware_method(request)
File "/Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/django/middleware/common.py", line 71, in process_request
if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
File "/Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/django/core/urlresolvers.py", line 600, in is_valid_path
resolve(path, urlconf)
File "/Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/django/core/urlresolvers.py", line 480, in resolve
return get_resolver(urlconf).resolve(path)
View gist:dec872561e31b8c69804
/Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/badger/models.py:33: DeprecationWarning: django.utils.simplejson is deprecated; use json instead.
import django.utils.simplejson as json
/Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/nose/util.py:14: DeprecationWarning: The compiler package is deprecated and removed in Python 3.x.
from compiler.consts import CO_GENERATOR
/Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/badger/models.py:33: DeprecationWarning: django.utils.simplejson is deprecated; use json instead.
import django.utils.simplejson as json
/Users/rik24d/code/kitsune/venv/lib/python2.7/site-packages/nose/util.py:14: DeprecationWarning: The compiler package is deprecated and removed in Python 3.x.
View gist:52bc6933158270835e2f
On the phone:
1) Go in Settings > Developer (at the bottom)
1-a) If Settings > Developer doesn't exist, enable it in Settings > Information > More information > Developer Menu
2) Debugging via USB > Select "ADB and devtools"
On your computer:
3) Download https://github.com/mozilla/buddyup/archive/master.zip (from https://github.com/mozilla/buddyup, "download zip" in the bottom right)
4) Unzip
5) Plug in your phone
View gist:9c591e010eb4281f9ec5
apps/callscreen/js/calls_handler.js | 2 ++
apps/callscreen/js/handled_call.js | 2 ++
2 files changed, 4 insertions(+)
diff --git a/apps/callscreen/js/calls_handler.js b/apps/callscreen/js/calls_handler.js
index 0464826..76b41f9 100644
--- a/apps/callscreen/js/calls_handler.js
+++ b/apps/callscreen/js/calls_handler.js
@@ -78,6 +78,8 @@ var CallsHandler = (function callsHandler() {
/* === Handled calls === */
You can’t perform that action at this time.