This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ git clone github:lenary/guides.git | |
| Cloning into guides... | |
| remote: Counting objects: 255, done. | |
| remote: Compressing objects: 100% (216/216), done. | |
| remote: Total 255 (delta 111), reused 163 (delta 35) | |
| Receiving objects: 100% (255/255), 1.49 MiB | 564 KiB/s, done. | |
| Resolving deltas: 100% (111/111), done. | |
| $ cd guides | |
| $ git remote -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # LOL!!1 | |
| # Dunno who made this. BUT I LUVZ IT. | |
| alias wtf='dmesg' | |
| alias onoz='cat /var/log/errors.log' | |
| alias rtfm='man' | |
| alias visible='echo' | |
| alias invisible='cat' | |
| alias moar='more' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # avoid path traversal attacks and speed up look-up | |
| set :css_files, {} | |
| Dir.glob("#{settings.public}/css/*.css") { |file| settings.css_files[File.basename(file, '.css')] = file } | |
| get "/css/:name.css" do |name| | |
| expires 60*60*24*356*3 | |
| send_file setting.css_files[name] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.ajaxSetup({ | |
| beforeSend: function(xhr, settings) { | |
| function getCookie(name) { | |
| var cookieValue = null; | |
| if (document.cookie && document.cookie != '') { | |
| var cookies = document.cookie.split(';'); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = jQuery.trim(cookies[i]); | |
| // Does this cookie string begin with the name we want? | |
| if (cookie.substring(0, name.length + 1) == (name + '=')) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Extend the Underscore object with the following methods */ | |
| // Rate limit ensures a function is never called more than every [rate]ms | |
| // Unlike underscore's _.throttle function, function calls are queued so that | |
| // requests are never lost and simply deferred until some other time | |
| // | |
| // Parameters | |
| // * func - function to rate limit | |
| // * rate - minimum time to wait between function calls | |
| // * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Download Preformatted Sections | |
| function makeDownloadable() { | |
| // Iconza by Turbolink, Creative Commons BY 3.0 Unported | |
| // http://www.softicons.com/free-icons/designers/turbomilk | |
| var png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABxVBMVEUAAACFhYaBgYGHh4iHiImLjI2Gh4eGhodbW1xqa2toaGlpampVVVdhYWJTU1RmZmf///+JiYmkpKR8fHysrKyYmJiHh4e2trZmZmaRkZGIiIiTk5OKiopQUVKDhIZ+fn7ExMTGxsbMzMxhYWFkZGSCgoSGhoaurq5oaGhsbGxubm7JycmAgIJPT1CFhojq6uq+vr6cnJzh4eG1tbWUlJS8vLzn5+eenp69vb1nZ2dlZWXT09Ozs7PAwMCoqKrR0dHPz8/Ozs7i4uLCwsLBwcHZ2dnU1NS3t7eqqqp+f4CmpqaoqKjt7e3Hx8eVlZV7fH58fX6ampqZmZmdnZ3o6Ojl5eXk5OTf39/e3t50dXfd3d2Pj4+NjY2Li4uhoqOOjo6HiIrb29va2tp6enp3d3dub3BwcXOioqKBgYGFhYXv7+/IyMj5+fliYmLKystgYGBwcHBpaWpra21zc3NycnJcXFyQkJBhYmNlZWZtbW3Ly8xcXV6jo6Nra2u/v793eHpjY2N2dnaCg4OLjI7g4OBmZmeCgoLLy8u5ubmEhIRfX2Dc3NzW1tbKysqxsbFPT1Gvr69NTk9NTU9NTk5NTU7m5ua7u7tu8VCdAAAAEHRSTlMAnxe99/evvfC1qKf4+PGpMlfdYgAAAPdJREFUGBlFwYNuRAEQAMCt3e6zz7ZZ27Zt27b9vW2aSzoDySkX/9LSATKKfV9d3eW+y57e/ofH4SQYHRuvjpeUlplp+4JWt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'backports' # aliases Proc#=== to Proc#call | |
| rs = (0..10000).to_a.sample(30) | |
| rs.each do |r| | |
| case r | |
| when lambda { |n| n.zero? } then puts "#{r} is zero" | |
| when lambda { |n| (n % 5).zero? } then puts "#{r} is fiven" | |
| when lambda { |n| (n % 4).zero? } then puts "#{r} is fourven" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rvm use @$(basename `pwd`) --create |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # Processor for Github flavored markdown, inspired by: | |
| # https://github.com/alampros/Docter/blob/master/bin/github-flavored-markdown.rb | |
| # | |
| # Current version of this script can be found here: | |
| # https://gist.github.com/1300939 | |
| # | |
| # Adapted for Redcarpet version 2 by Ralph von der Heyden | |
| # http://github.com/ralph | |
| # http://twitter.com/ralph |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "" Vim, not Vi. | |
| " This must be first, because it changes other options as a side effect. | |
| set nocompatible | |
| filetype off | |
| "" General Settings | |
| " Enable syntax highlighting. | |
| syntax on | |
| " Line endings should be Unix-style unless the file is from someone else. |