This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useRef, useState, useCallback } from 'react'; | |
type IframeGoogleDocsProps = { | |
url: string, | |
}; | |
export function IframeGoogleDoc({ url }: IframeGoogleDocsProps) { | |
const [iframeTimeoutId, setIframeTimeoutId] = useState<any>(); | |
const iframeRef: any = useRef(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cache | |
import ( | |
"crypto/sha256" | |
"encoding/json" | |
"fmt" | |
"os" | |
"sync" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////// | |
// ES6 original | |
//////////////////////////// | |
class A extends B { | |
constructor(x) { | |
this.x = x; | |
} | |
b() {return this.x}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Box = Backbone.Model.extend({ | |
defaults: { | |
top: 0, | |
left: 0, | |
color: 0, | |
content: 0 | |
}, | |
initialize: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// | |
// Converts code indentation from 2 spaces to 4 spaces | |
// | |
// For a hotkey, add to Preferences > Key Bindings - User: | |
// | |
// { "keys": ["ctrl+alt+i"], "command": "run_macro_file", "args": {"file": "res://Packages/User/ConvertTwoSpacesToFour.sublime-macro"} } | |
// | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.forms import ModelForm | |
from django.forms.models import inlineformset_factory | |
from models import Sponsor, Sponsorship | |
class SponsorForm(ModelForm): | |
class Meta: | |
model = Sponsor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyModel = Backbone.Model.extend({ | |
someMethod: function(opts) { | |
var url = this.url() + '/someMethod', | |
// note that these are just $.ajax() options | |
options = { | |
url: url, | |
type: 'POST' | |
}; | |
// add any additional options, e.g. a "success" callback or data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ovveride Underscore.js' template format | |
_.templateSettings = { | |
evaluate: /\{%([\s\S]+?)%\}/g, | |
interpolate: /\{\{(.+?)\}\}/g | |
}; |