Skip to content

Instantly share code, notes, and snippets.

View TechFounder's full-sized avatar

Jimmy Chen TechFounder

View GitHub Profile
TechFounder / assets.css.scss
Last active August 29, 2015 13:56
A useful jQuery snippet to make any tagged item a clickable link. This is how in Rails.
View assets.css.scss
[data-link] {
cursor: pointer;
TechFounder / index.html
Last active August 29, 2015 13:57
You want a way to center any object to the middle of the page (horizontal centering)?
View index.html
<div id="first">
<div id="second">
Item you want centered
for example:
<a href="" target="_top" id="first">
<img src="photo.png" alt="photo">
TechFounder /
Last active August 29, 2015 14:06
CoffeeScript to use with checkbox to hide / unhide form fields or div.
# Use this if you only want to use the checkbox as a clicker
$('#checkbox-id').click ->
# Use this if you actually care about checking to see if the checkbox has been checked
$('#checkbox-id').click ->
if $(@).prop('checked')
$('.what-you-want-to-hide, .what-you-want-to-hide-also').slideDown 'slow'
$('.what-you-want-to-hide, .what-you-want-to-hide-also').slideUp 'slow'
TechFounder / view.haml
Created September 23, 2014 21:55
Prevent link_to from redirecting to a new page when you don't have any particular link to go to. So you don't get that annoying top of the page action.
View view.haml
= link_to 'Link to Nowhere', 'javascript:;'
TechFounder /
Last active August 29, 2015 14:07
How to setup a fixed navbar using javascript when you have an extra header on top of it. Or, a fading navbar.
# The basic idea here is that you set a num of pixels before triggering the css "fixed"
# which would freeze whatever you div attribute you set, in this case"nav".
# This is a simple way to do it but there's a library you can use to do the same thing.
num = 250 #number of pixels before modifying styles
$(window).bind "scroll", ->
if $(window).scrollTop() > num
$("nav").addClass "fixed"
TechFounder / font.sass
Created January 5, 2015 22:50
SASS mixin font sizes
View font.sass
$min-font-size: 10
$max-font-size: 50
@mixin font-sizes
@for $i from $min-font-size through $max-font-size
font-size: ($i / 16)em
@extend .font-normal
@include font-sizes
TechFounder / comment
Created January 7, 2015 19:22
Safety Pig
View comment
_._ _..._ .-', _.._(`))
'-. ` ' /-._.-' ',/
) \ '.
/ _ _ | \
| a a / |
\ .-. ;
'-('' ).-' ,' ;
'-; | .'
View jsbin.edivah.css
#fade {
width: 100px;
height: 100px;
border-radius: 50%;
border: none;
View fix_homebrew.rb
# This script fixes /usr/local only.
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several