Skip to content

Instantly share code, notes, and snippets.

View ljuti's full-sized avatar
💻
Most likely in an editor

Lauri Jutila ljuti

💻
Most likely in an editor
View GitHub Profile
@leastbad
leastbad / README.md
Created April 16, 2020 08:08
Choices.js Stimulus wrapper preview

Choices.js Stimulus wrapper

https://joshuajohnson.co.uk/Choices/

Soon, this will be published as an NPM package, but there's an absence of documentation right now. It supports almost all functions from the original library; soon it will support 100% of them.

This wrapper adds Ajax pre-fetch search. Happens if controller has a data-search-path attribute.

Stimulus controller targets use new v2 syntax. Controller attaches a reference to itself on the element so that you can access the internal state from external scripts.

@alexrqs
alexrqs / videojs-plugin-events-logger.js
Last active November 9, 2023 10:09
VideoJS event list
// The events are from https://www.w3.org/TR/html5/semantics-embedded-content.html#media-elements-event-summary
import videojs from 'video.js'
const Plugin = videojs.getPlugin('plugin')
const EVENTS = [
'loadstart',
'progress',
'suspend',
'abort',
'error',
@sebboh
sebboh / gist:f1dfe4f096746c45f3e9ea06a09743a0
Last active February 27, 2024 17:10 — forked from masonforest/gist:4048732
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

This method does not add your OAuth token to Gemfile.lock. It uses bundle config to store your credentials, and allows you to configure Heroku to use environment variables when deploying.

  1. Generate an OAuth token from GitHub
@ekoneil
ekoneil / gist:3178821
Created July 25, 2012 21:30
Calling Facebook APIs with the 3.0 SDK
// #1: Graph API: /me
- (void)requestMe {
[FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *me,
NSError *error) {
if(error) {
[self printError:@"Error requesting /me" error:error];
return;
}
@kellyredding
kellyredding / run.rb
Created May 16, 2012 17:54
Pull Gmail labels via IMAP using Gmail IMAP extensions
require 'net/imap'
# Net::IMAP raises a parse error exception when fetching attributes it doesn't
# recognize. Here I patch an instance of Net::IMAP's `msg_att` method to
# recognize the Gmail IMAP extended attributes
# Refer to:
# * https://developers.google.com/google-apps/gmail/imap_extensions#access_to_gmail_labels_x-gm-labels
# * http://blog.wojt.eu/post/13496746332/retrieving-gmail-thread-ids-with-ruby
@chsh
chsh / app_delegate.rb
Created May 7, 2012 10:18
Example to use UIWebView for RubyMotion.
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds
@window.rootViewController = GoogleViewController.alloc.init
@window.makeKeyAndVisible
true
end
end