Skip to content

Instantly share code, notes, and snippets.

View chestone's full-sized avatar
🐈
Is Cat

Cheston Lee chestone

🐈
Is Cat
View GitHub Profile
@chestone
chestone / SlideShow.js
Created January 21, 2011 04:16
A div with an id of 'slideshow' contains five images, the first of which is shown and the others are hidden using a display style of none. Using Javascript, create a simple slideshow that cycles through the images, displaying each image for three seconds
var imgs = document.getElementById('slideshow').getElementsByTagName('img');
var currIdx = 0;
setInterval(function() {
imgs[currIdx].style.display = 'none';
currIdx = (currIdx + 1 == imgs.length) ? 0 : currIdx + 1;
imgs[currIdx].style.display = '';
}, 3000);
@chestone
chestone / akornSlideShow
Created March 10, 2011 23:18
Slideshow from Alex Korn.
setInterval(function(imgs, currIdx) {
return function() {
imgs[currIdx].style.display = 'none';
currIdx = (currIdx + 1 == imgs.length) ? 0 : currIdx + 1;
imgs[currIdx].style.display = '';
};
}(document.getElementById('slideshow').getElementsByTagName('span'), 0), 3000);
@chestone
chestone / create-jekyll-post.sh
Last active August 29, 2015 13:57
Create a Jekyll post with front-matter
#!/bin/sh
echo "What would you like the title of your post to be?"
read post_name
echo "What categories would you like this post to be under?(space seperated list)"
read categories
today=$( date "+%Y-%m-%d" )
rawpost="$today-$post_name.md"
post=${rawpost// /-}
from rauth import OAuth1Service
# Get an API Key in your SmugMug Account Settings.
API_KEY = None
API_KEY_SECRET = None
OAUTH_ORIGIN = 'https://secure.smugmug.com'
REQUEST_TOKEN_URL = OAUTH_ORIGIN + '/services/oauth/1.0a/getRequestToken'
ACCESS_TOKEN_URL = OAUTH_ORIGIN + '/services/oauth/1.0a/getAccessToken'
@chestone
chestone / .scss-lint.yml
Last active August 29, 2015 14:04
Annotated SCSS-lint config file describing options
---
linters:
BorderZero: # border : 0 is preferred over border: none
enabled: false
CapitalizationInSelector: # all class names should be in lowercase
enabled: false
ColorKeyword: # use color in hex rather than name
enabled: false
DeclarationOrder: #Rule sets should start with @extend declarations, followed by properties and nested rule sets, in that order
enabled: false
@chestone
chestone / .jshintrc
Last active August 29, 2015 14:04
jshintrc
{
"browser": true,
"jquery": true,
"node": true,
"camelcase": true,
"eqeqeq": true,
@chestone
chestone / .scss-lint.yml
Last active August 29, 2015 14:04
scss-lint.yml
---
linters:
BorderZero: # border : 0 is preferred over border: none
enabled: false
CapitalizationInSelector: # all class names should be in lowercase
enabled: false
ColorKeyword: # use color in hex rather than name
enabled: false
DeclarationOrder: #Rule sets should start with @extend declarations, followed by properties and nested rule sets, in that order
enabled: true
@chestone
chestone / arc-delete.sh
Last active January 11, 2020 22:53
How to delete all of your Phabricator diffs.
git branch -D `git branch | grep -E arcpatch-D[0-9]+`
@chestone
chestone / PropTypesTransform.js
Last active May 11, 2017 23:01
Add 'prop-types' imports & rewrite your PropTypes statements.
module.exports = function(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
let importPropTypes = false;
const modifyPropTypes = (path) => {
if (!importPropTypes) importPropTypes = true;
return {
type: 'Identifier',
name: 'PropTypes',
export default testComponent(components, ) {
class ComponentUnderTest {
render() {}
}
}