Skip to content

Instantly share code, notes, and snippets.

pwim / widget.html
Created Mar 2, 2012
Widget HTML Snippet
View widget.html
<script type="text/javascript" src=""></script>
<a class="doorkeeper-registration-widget" href="">Register for Javascript Widget Demo</a>
pwim / doorkeeper-cors.html
Created Jun 26, 2017
Example of using cors with Doorkeeper API
View doorkeeper-cors.html
<script src="" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script type="text/javascript">
dataType: "json",
url: "",
headers: { 'Authorization': 'Bearer your_token' },
data: {},
success: function(data) {
pwim / widget.js
Created Mar 2, 2012
Doorkeeper Widget
View widget.js
(function() {
<%="vendor/assets/javascripts/getElementsByClassName-1.0.1.js")) %>
<%="vendor/assets/javascripts/ready.js")) %>
domready(function() {
var widget_link, iframe, i, widget_links;
widget_links = getElementsByClassName('doorkeeper-registration-widget');
for (i = 0; i < widget_links.length; i++) {
widget_link = widget_links[i];
iframe = document.createElement('iframe');
iframe.setAttribute('src', widget_link.href + "/widget.html");
View after_removing_callbacks_controller.rb
class CustomersController < ApplicationController
# …
def create
if auto_create_request?
@customer = Customer.auto_create(customer_params)
@customer = Customer.register(customer_params)
respond_to do |format|
View sample.html
<link rel='stylesheet' type='text/css' href='' />
<script type='text/javascript' src=''></script>
<script type='text/javascript' src=''></script>
<script type="text/javascript">
url: "",
dataType: "jsonp",
success: function (data) {
var events =, function(e){
return { title: e.event.title, start: new Date(e.event.starts_at), end: new Date(e.event.ends_at), url: e.event.public_url, allDay: false};
pwim / gist:3720944
Created Sep 14, 2012
kaigi room 1 log
View gist:3720944
ryopeko has left IRC (Remote host closed the connection)
kurko has joined (
itochan is now known as itochan_off
ukstudio has left IRC (Ping timeout: 240 seconds)
sorah: squaleにいるのでそっちまはまかせた
volpe_hd28v has left IRC (Ping timeout: 240 seconds)
znz_ has left IRC (Ping timeout: 240 seconds)
znz_ has joined (
webgyo has left IRC (Quit: Leaving...)
pwim / gist:3720942
Created Sep 14, 2012
sapporo kaigi room 2 log
View gist:3720942
yokolet has joined (
sorah has joined (
OK lets start
sqale is a PaaS
i'll talk about is core, backend
not that ruby related sorry :P
View gist:2816967
# Is there already a pattern for doing this?
def map_find(enumerable)
enumerable.each do |e|
t = yield(e)
return t if t
# equivalent to the following but with one less function call
View clean.css
input[type='number'][size='2'] {
width: 26px;
input[type='number'][size='3'] {
width: 36px;
View original.css
input#profile_min_age, input#profile_max_age {
width: 26px;
input#profile_height, input#profile_min_seek_height, input#profile_max_seek_height {
width: 36px;