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
| function( d ) { | |
| // Create a copy of this date object | |
| var target = new Date(d.valueOf()); | |
| // ISO week date weeks start on monday | |
| // so correct the day number | |
| var dayNr = (d.getDay() + 6) % 7; | |
| // Set the target to the thursday of this week so the |
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
| # encoding: UTF-8 | |
| Capistrano::Configuration.instance(:must_exist).load do | |
| namespace :rails do | |
| desc "Open the rails console on one of the remote servers" | |
| task :console, :roles => :app do | |
| hostname = find_servers_for_task(current_task).first | |
| exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'" | |
| end | |
| 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
| // grab your file object from a file input | |
| $('#fileInput').change(function () { | |
| sendFile(this.files[0]); | |
| }); | |
| // can also be from a drag-from-desktop drop | |
| $('dropZone')[0].ondrop = function (e) { | |
| e.preventDefault(); | |
| sendFile(e.dataTransfer.files[0]); | |
| }; |
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($.expr[':'], { | |
| inview: function ( el ) { | |
| var $e = $( el ), | |
| $w = $( window ), | |
| wt = $w.scrollTop(), | |
| wb = wt + $w.height(), | |
| et = $e.offset().top, | |
| eb = et + $e.height(); | |
| return eb >= wt && et <= wb; |
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 pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files | |
| # for Pry binding references | |
| # | |
| # Installation | |
| # | |
| # ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit | |
| # | |
| # Based on | |
| # | |
| # http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/ |
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
| ActiveSupport.on_load(:active_record) do | |
| module Arel::NullsLastPredications | |
| def nulls_last | |
| Arel::Nodes::NullsLast.new self | |
| end | |
| end | |
| module Arel::Nodes | |
| class NullsLast < Unary | |
| def gsub *args |
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
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "io" | |
| "log" | |
| "mime/multipart" | |
| "net/http" | |
| "os" |
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
| # Symlink the shared protected folder | |
| run "ln -nfs #{shared_path}/protected #{latest_release}/protected" |
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
| defmodule Bumper do | |
| @doc ~S""" | |
| Reads a Bitmap (24-bit) and displays width, height, and the RGB of each pixel | |
| """ | |
| def show(filename) do | |
| {:ok, bindata} = File.read(filename) | |
| << "BM", | |
| _::size(64), | |
| offset_to_pixels::size(32)-little, |
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
| defmodule Shell do | |
| def escape_value(value), do: escape_value(value, "") | |
| defp escape_value("", res), do: "\"#{res}\"" | |
| defp escape_value("\"" <> value, res), do: escape_value(value, res <> "\\\"") | |
| defp escape_value("\\" <> value, res), do: escape_value(value, res <> "\\\\") | |
| defp escape_value(<<char :: utf8, rest :: binary>>, res), | |
| do: escape_value(rest, res <> <<char>>) | |
| end |
OlderNewer