Skip to content

Instantly share code, notes, and snippets.

View Schniz's full-sized avatar

Gal Schlezinger Schniz

View GitHub Profile
@Schniz
Schniz / scrollWindowTo.js
Last active December 11, 2015 18:49
scrolls the browser to a place in the window. FUN FUN FUN.
/**
* Nicely scrolls the window to a certain place in a page
* @param whereTo jQuery|px to scroll to
* @param speed in ms. default - 700
* @param easing the easing. default - easeOutCirc
*/
scrollWindowTo = function(whereTo, speed, easing) {
if (!speed) speed = 700;
if (!easing) easing = jQuery.easing["easeOutCirc"] ? "easeOutCirc" : null;
@Schniz
Schniz / ubuntu.sh
Last active December 16, 2015 02:29
My startup file @ Ubuntu
# Git branch parsing
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
# Prompt
export PS1="\[\e[33m\]\u\[\e[0m\] \w\[\e[32m\]\$(parse_git_branch)\[\e[0m\] \[\e[1;34m\]≋\[\e[0m\] "
# Aliases
alias ls="ls --color" # LSing in color!
@Schniz
Schniz / jquery.mousescroll.js
Last active December 16, 2015 05:59
Prevents mouse scrolling on the whole page, and just scrolls that awesome selected item. I don't remember where I found this code, but here it is, converted to jQuery's awesome stuff. example $("ul#awesome-but-long-list").mouseScroll(); returns jQuery $(this), for fluent access
/**
* Prevents mouse scrolling on the whole page, and just scrolls that awesome selected item.
* I don't remember where I found this code, but here it is, converted to jQuery's awesome stuff.
*
* @example $("ul#awesome-but-long-list").mouseScroll();
* @return jQuery $(this), for fluent access
*/
$.fn.mouseScroll = function () {
return $(this).bind('mousewheel DOMMouseScroll', function (e) {
var delta = e.wheelDelta || -e.detail || e.originalEvent.wheelDelta;
@Schniz
Schniz / jquery.iscroll.wrapper.js
Created April 15, 2013 14:29
jQuery iScroll wrapper. depends on jQuery ($) and iScroll
/**
* Creates an iScroll instance and returns it.
* use string as the options param for calling a function.
* you can use the args for sending it to the function!
*
* @param {JSON} options for the new iScroll item
* if its a string, it will call the specific function
* @param arg arguments for sending the args to the selected function.
*
* @return IScroll for the current item.
@Schniz
Schniz / Long-Shadow-Sass-Mixin.markdown
Created September 4, 2013 15:05
A Pen by Gal Schlezinger.
//-------------------
// Watch this scheme in Colour Lovers: http://www.colourlovers.com/palette/3022861/Grass_Fields_Forever
//-------------------
$white: #fff
$grey: #f7f7f7
$lightGreen: #d9f5d2
$medGreen: #ace198
$darkGreen: #90d074
@Schniz
Schniz / deploy.rb
Last active April 8, 2018 02:57 — forked from markoa/deploy.rb
Files for using capistrano and resque. some shell magic for killin those resque workers. pay attention to the `w.stop` stuff - it should kill all the resque proccesses (!!) when the god stops it. yeah.
namespace :god do
desc "Hot-reload God configuration for the new release Resque worker"
task :reload_release do
run "cd #{release_path} && god && god load config/resque.god && god restart resque"
end
desc "Hot-reload God configuration for the current release Resque worker"
task :reload_current do
run "cd #{current_path} && god && god load config/resque.god && god restart resque"
end
@Schniz
Schniz / 0_reuse_code.js
Created February 8, 2014 19:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Schniz
Schniz / javascript_resources.md
Created February 8, 2014 19:07 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@Schniz
Schniz / rails_resources.md
Created February 8, 2014 19:07 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h