Skip to content

Instantly share code, notes, and snippets.

@cemre
cemre / greatcirclearc.java
Created October 22, 2011 22:36
Rendering great circle arcs in Processing between two coordinates
void drawPath(float lat1, float lon1, float lat2, float lon2) {
stroke(0);
strokeWeight(5);
noFill();
lat1 *= PI/180;
lon1 *= PI/180;
lat2 *= PI/180;
lon2 *= PI/180;
@cemre
cemre / gist:1671372
Created January 24, 2012 17:33
Butfirst / Butlast in SCSS
/*
Apply a style to all elements but the first or last one.
Such as:
.items {
@include butfirst(margin-top, 10px);
}
.menu-item {
@include butlast(margin-right, 10px);
@cemre
cemre / stripes.scss
Created March 1, 2012 04:23
SASS Striped CSS3 background mixin
@mixin striped-background($stripe1, $stripe2, $angle: -45deg, $size: 40px, $other-backgrounds: false) {
@include background-image(linear-gradient($angle, $stripe1 25%, $stripe2 25%, $stripe2 50%, $stripe1 50%, $stripe1 75%, $stripe2 75%, $stripe2), $other-backgrounds);
background-repeat: repeat;
@include background-size(unquote("#{$size} #{$size}"));
}
// from twitter bootstrap
@-webkit-keyframes progress-bar-stripes {
from { background-position: 0 0; }
@cemre
cemre / twitterauth.rb
Created March 2, 2012 04:45
Twitter authentication/login with Capybara and Selenium
# Call this function after you click the 'sign in with twitter' button on your website
# It switches to the popup, logs in, then switches back to your site.
def auth_with_twitter(username, password = @@default_password)
# Twitter auth
page.driver.browser.switch_to.window page.driver.browser.window_handles.last do
# If logged in, force log out.
if !page.has_css? "#username_or_email"
find('.current-user a').click
@cemre
cemre / sprintly.css
Created August 19, 2012 19:15
Sprintly user stylesheet
* {
font-family: "helvetica neue" !important;
text-shadow: none !important;
}
#main-wrapper {
background-image: none !important;
background-color: rgb(248, 248, 243) !important;
}
@cemre
cemre / gist:3455788
Created August 24, 2012 21:26
bretton
It depends on what's already been established; if you're a designer co-founder and your other co-founders are assuming CEO/CTO/CMO titles, you should insist on 'Chief Design Officer'. Although as someone who has that title myself, I always refer to myself as "The Design Co-Founder". Official titles are nice for resumes and business cards, but always sound douchey in person...
Head of Design. That's my title at Xero. I'm a co-founder, but that's not relevant to my title. What is relevant is that I work across the entire business: product, marketing, brand, business strategy. I find it works quite well in communicating the gravitas of the role, nice and simply.
@cemre
cemre / gist:4402564
Created December 28, 2012 22:29
Save an area on the screen as a non-retina screenshot, put it in dropbox, paste URL in clipboard. Make a service using these instructions: http://blog.lanceli.com/2012/08/downscale-screenshot-at-hight-resolution-on-retina-mackbook-pro.html
# the path where screenshots to save
SS_PATH="/tmp"
# a variable of unix timestamp for screenshot file name
NOW=$(date +%s)
# execute screen capture command, screenshot$NOW.png is the name of file
screencapture -i -r $SS_PATH/screenshot$NOW@2X.png
# then downscale the high resolution screenshot to 50%
@cemre
cemre / sentence.html
Created April 1, 2013 19:21
Rails to_sentence in pure CSS
<span class="join-as-sentence">
<span class="item">
David Yen
</span>
<span class="item">
Hursh
</span>
<span class="item ">
@cemre
cemre / alerter.rb
Last active December 23, 2015 18:59
Get a call when Apple has iPhones in stock. https://medium.com/p/7f921ea94e8f
require 'twilio-ruby'
require 'httparty'
require 'json'
class Alerter
def check
# set up a client to talk to the Twilio REST API
account_sid = 'xxxxxx'