Skip to content

Instantly share code, notes, and snippets.

View heartcode's full-sized avatar

Robert Pataki heartcode

View GitHub Profile
@heartcode
heartcode / scroll-window-to.js
Created February 11, 2012 23:23
Scrolls the window to the required position (Please note that this snippet works best with top scrolling just for now)
/*
* Scrolls the window to the required position using animation with custom easing.
* The required position can be set with the 1st argument ('position');
* The fineness of the animation can be customized by using the 'speed' (2nd) argument, which ranges between 0.1 (very fine) and 1 (instant jump).
* Usage #1:
* scrollWindowTo(0, 0.2); // -> Scrolls the page to the top with a fine animation
* Usage #2:
* scrollWindowTo(100, 1); // -> Makes the page jump to 100px
*/
var scrollWindowTo = (function(){
@heartcode
heartcode / FontLibrary.as
Created February 29, 2012 15:25
(unicodeRange) Font embedding for ActionScript projects using Flex 4.0+ SDK
package com.heartcode.utils.fonts
{
import flash.display.Sprite;
import flash.events.Event;
import flash.text.Font;
/**
*
*/
public class FontLibrary extends Sprite
@heartcode
heartcode / TLFFactory.as
Created March 1, 2012 15:16
A simple class for creating TLFTextFields
package com.waste.assets.tlf
{
import fl.text.*;
import flash.text.*;
import flash.text.engine.FontLookup;
import flashx.textLayout.formats.*;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.elements.TextFlow;
/**
@heartcode
heartcode / Default (OSX).sublime-keymap
Created April 18, 2012 19:02
Sublime Text 2 | Key Bindings - User
[
{ "keys": ["super+m"], "command": "toggle_minimap" },
{ "keys": ["super+d"], "command": "duplicate_line" },
{ "keys": ["super+up"], "command": "swap_line_up" },
{ "keys": ["super+down"], "command": "swap_line_down" }
]
@heartcode
heartcode / .bash_profile
Last active October 10, 2015 15:47
.bash_profile
export PATH="/usr/local/bin:/usr/local/mysql/bin:/usr/local/etc:/usr/local/sbin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
# [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion
source ~/.git-completion.sh
ssh-add
function rvm_version {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
@heartcode
heartcode / mixins.css.scss
Created October 26, 2012 15:39
CSS animation mixin
@mixin animation ($transform: background, $duration: 0.3s, $easing: ease, $delay: 0.3s) {
-webkit-transition: $transform $duration $easing $delay;
-moz-transition: $transform $duration $easing $delay;
-o-transition: $transform $duration $easing $delay;
transition: $transform $duration $easing $delay;
}
@heartcode
heartcode / mixins.css.scss
Created November 9, 2012 11:09
SASS mixins
@mixin background_image ($filename) {
background-image: image-url(1x/#{$filename});
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5) {
background-image: image-url(2x/#{$filename});
}
}
@heartcode
heartcode / .bash_profile
Last active December 19, 2015 15:09
.bash_profile v2
export PATH="/bin:/sbin:/usr/local/etc:/usr/local/mysql/bin:/usr/bin:usr/local/sbin:/usr/local/bin:$PATH/.rbenv/bin:$HOME"
eval "$(rbenv init - --no-rehash)"
# Load SSH keys
ssh-add
[[ -s ~/.bashrc ]] && source ~/.bashrc
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
@heartcode
heartcode / .gitconfig
Last active December 20, 2015 09:49
.gitconfig
# More great options: http://thomashunter.name/blog/git-colored-output-shortcut-commands-autocompletion-and-bash-prompt/
[color]
diff = auto
status = auto
branch = auto
[format]
pretty = "Commit: %C(yellow)%H%nAuthor: %C(green)%aN <%aE>%nDate: (%C(red)%ar%Creset) %ai%nSubject: %s%n%n%b"
@heartcode
heartcode / gist:6150225
Created August 4, 2013 12:45
My Sublime Text User Prefs
{
"color_scheme": "Packages/Theme - Default/Tomorrow-Night-Eighties.tmTheme",
"folder_exclude_patterns":
[
"build",
"docs",
".*",
"acceptance-test/src",
"acceptance-test/deps",
"acceptance-test/target",