Skip to content

Instantly share code, notes, and snippets.

View mathiasbynens's full-sized avatar

Mathias Bynens mathiasbynens

View GitHub Profile
@landonf
landonf / 0_completion_post.txt
Last active August 29, 2015 14:07
Data posted to Apple by Spotlight (Bulky JSON payloads have been reformatted for readability). Note the X-Apple-UserGuid -- this appears to remain constant across all requests.
POST /fb?key=andromeda HTTP/1.1
Host: api.smoot.apple.com
Content-Type: application/json
Accept-Charset: utf-8
Connection: keep-alive
X-Apple-ActionSignature: ArFF0Bupz4+n05DZ/5MjOYH6XbRrC98eRfE+8OzUT0wKAAABwAMAAAABAAABAO7FAuqnAwyvZFj4n1tcSQxl42hKlg/915t5zBgrff9a2axEBZXtPF2Tg0rdJIEJJ/r4sMinOShzj3lvY9LmX1ZS76JmJNM0WZLzpat3WBzTmsgwyWUGSwO1ZUCURtaYyd5GryXCOfKyC0EIy8g3ppLlRdg4NOfIH043t/x7dzXjSJnuFZxgjkNtXJjlZtpyhU/1aozZABRHLK6nnPu33ek59bQMDwtQGyPC/3+DBJeujZcVuZI6of22HaV2oVFLz3zXEfEAcfeL5WPLWinnmLN+RZIrONwRmy/64kYbrkDO3P00R96wW6LJBYe63d6vWCrXlWTQeL7DDtwaR29Q0lYAAAAQ7fKDT5fxlqnZiMWRl6sNlQAAAJ8BZJzusSpopU9YFrn8J9VG1D/Ve1QAAACGBQJ/jp+/zKfOoBgaJGgjxWW8VEHM8hOyIUG96CcnUgA2Aqfvvv9nzKjAU05WWJSzGq4jMw5xzBsDlj9oSpM9/8PEHAlDKz2v7hNR3TLlAkH/2GMJgF7ly7dnqPPG4fjEvoT7Pz/bEepVSsboPqm8ztaSvCYoC3xBbXEPPO5AjiH4jeDbKLI=
Accept: application/json
X-Apple-UserGuid: 267af341-df6c-4eed-5e78-a2b8a49a1d1f
User-Agent: (OS X 14A389) Spotlight/916
Content-Length: 5991

ES7 String trim functions

String.prototype.trim ( )

Return result of StringTrim abstract operation passing this value as thisArg, and TrimBoth as the type.

String.prototype.trimRight ( )

Return result of StringTrim abstract operation passing this value as thisArg, and TrimRight as the type.

@RReverser
RReverser / es6-intrinsic.js
Created June 14, 2015 14:04
ES6 spec: 6.1.7.4 Well-Known Intrinsic Objects
/*
The MIT License (MIT)
Copyright (c) 2015 Ingvar Stepanyan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@cowboy
cowboy / files.txt
Last active August 29, 2015 14:25
Pizzicato Five ‎– The Band Of 20th Century
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 01 Intro.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 02 The Night Is Still Young.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 03 A New Song.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 04 Serial Stories.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 05 Triste.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 06 Sweet Soul Revue.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 07 To Our Children’s Children’s Children.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 08 Ma Vie, L’ete De Vie.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 09 Drinking Wine.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 10 Goodbye Baby & Amen.mp4
@gf3
gf3 / gist:166083
Created August 11, 2009 20:09
Truncate a string to the closest word
// Truncate a string to the closest word
String.prototype.truncateToWord = function( length ) {
return this
.slice( 0, length + 1 )
.split( /\s+/ )
.slice( 0, -1 )
.join( " " )
}
// Examples
@eligrey
eligrey / readme.md
Created September 13, 2009 19:51
High-resolution JavaScript timer
@NV
NV / README.md
Created January 22, 2010 08:29 — forked from ucnv/README.md

This script is also available at .

@remy
remy / gist:330318
Created March 12, 2010 13:59
autofocus and placeholder support
/**
* Add this script to the end of your document that use <input autofocus type="text" />
* or <input type="text" placeholder="username" /> and it'll plug support for browser
* without these attributes
* Minified version at the bottom
*/
(function () {
function each(list, fn) {
var l = list.length;
@remy
remy / gist:360113
Created April 8, 2010 14:24
setInterval run once, then keep running
setInterval((function () {
console.log(new Date()); // run some arbitrary code
return arguments.callee; // here be the magic
})(), 1000);
// ^---- and that runs the function, and the return val is assign to the interval
@cowboy
cowboy / gist:360138
Created April 8, 2010 14:46 — forked from remy/gist:360113
setInterval and setTimeout patterns
// =========================
// SetInterval
// =========================
// While not truly accurate, setInterval is still fairly good, time-wise.
// Better for things like a "one second tick" but not great for expensive
// code executed at small intervals as iterations can "stack".
// (ECMAScript 5 strict mode compatible)