Skip to content

Instantly share code, notes, and snippets.

View jessepollak's full-sized avatar

Jesse Pollak jessepollak

View GitHub Profile
@jessepollak
jessepollak / zip.fs
Last active December 29, 2015 08:29
let array1 = [| 1; 2; 3; 4 |]
let array2 = [| 1; 2; 3 |]
Array.zip array1 array2
// => raises ArgumentException
array_1 = [1, 2, 3, 4]
array_2 = [1, 2, 3]
array_1.zip(array_2)
# => [[1, 1], [2, 2], [3, 3], [4, nil]]
array_2.zip(array_1)
# => [[1, 1], [2, 2], [3, 3]]
@jessepollak
jessepollak / instaInterval.js
Last active February 11, 2018 12:52
setInterval + Immediately Invoked Function Expressions == instaInterval.
setInterval((function interval() {
// do something instantly then every 5 seconds
console.log('This is a better version of setInterval');
return interval;
})(), 5000);
@jessepollak
jessepollak / clef_application_iframe_guide.md
Last active December 30, 2015 22:19
Clef application creation iframe guide

Anyone can use the easy-embed Clef application creation iframe to allow users of their plugin to quickly create a Clef application for their site without leaving the plugin environment.

Embeding the iframe

When you embed the iframe, you must provide a variety of variables, which allow Clef to customize the experience for the user. Each of these variables must be passed as a URL parameter with a URL encoded value.

  • domain — The domain that the website is hosted on. In WordPress, we get this value by accessing urlencode(get_option('site_url')).

  • name - The name of the application that will be created. In WordPress we get this value by accessing urlencode(get_option('blogname')).

@jessepollak
jessepollak / making_movies.txt
Last active December 13, 2018 23:48
Makin' movies for the web.
<video preload autoplay>
<source src="/static/video/screen.mp4" type="video/mp4" />
<source src="/static/video/screen.ogv" type="video/ogg" />
<object width="640" height="360" type="application/x-shockwave-flash" data="/static/video/screen.swf">
<param name="movie" value="/static/video/screen.swf" />
<param name="flashvars" value="autostart=true&amp;file=/static/video/screen.mp4" />
</object>
</video>
# reduce quality # ffmpeg -i screen.mov -crf 20 screen-low.mov
@jessepollak
jessepollak / export_email.txt
Created January 10, 2014 02:14
Export emails for MySQL
$ mysql -h HOST -P PORT -u USER -p NAME < /tmp/emails.sql | sed 's/\t/,/g' > /tmp/emails.csv
@jessepollak
jessepollak / per_login_logout_hooks.md
Last active August 29, 2015 13:56
Using per-login Clef logout hooks

Using per-login Clef logout hooks

Previously, to use the Clef logout hook, you had to set a single logout hook on your Clef application. This logout hook would be hit every time a user logged out of your app.

With the new per-login Clef logout hooks, you can pass a URL to be hit as the logout hook every time a user logs in.

Passing the logout hook

Using this version of the logout hook is very easy. When you do the /authorize portion of the OAuth handshake, just specify the URL to be hit for logout.

In the icsauth/includes/functions.php, there's a function:

function ics_login_errors($error) {
  global $error;
  global $validation_error;
  if ($validation_error) {
    $error = "<b>Fehler: </b>Ihre ÖAK-Nummer konnte nicht gefunden werden, oder ist fehlerhaft. Bitte geben Sie diese erneut ein, um den Loginvorgang abzuschließen!";
  }
 else {
@jessepollak
jessepollak / gist:11262729
Created April 24, 2014 17:30
Clef badge without WordPress
<a href="https://bit.ly/wordpress-login-clef" class="clef-badge pretty" style="display: block; overflow: hidden; text-indent: -579px; height: 50px; width: 140px; background: url(http://bit.ly/clef-login-badge); background-size: 100% 100%; opacity: .8;">Secure Login Powered by Clef</a>
@jessepollak
jessepollak / Create_Clef_Application.md
Last active August 29, 2015 14:00
Clef application iframe guide

Anyone can use the easy-embed Clef application creation iframe to allow users of their plugin to quickly create a Clef application for their site without leaving the plugin environment.

Embeding the iframe

When you embed the iframe, you must provide a variety of variables, which allow Clef to customize the experience for the user. Each of these variables must be passed as a URL parameter with a URL encoded value.

  • domain — The domain that the website is hosted on. In WordPress, we get this value by accessing urlencode(get_option('site_url')).

  • name - The name of the application that will be created. In WordPress we get this value by accessing urlencode(get_option('blogname')).