Skip to content

Instantly share code, notes, and snippets.

View return-none's full-sized avatar
🐍

Konstantin Pauk return-none

🐍
View GitHub Profile
@return-none
return-none / Rakefile
Last active December 14, 2015 18:59
Rakefile for new post Jekyll blogging
# Original idea by MattHall
# https://gist.github.com/MattHall/1801090
# usage rake new_post title="my awesome title"
require 'date'
task :new_post do
title = ENV['title']
path = "_posts/#{Date.today}-#{title.downcase.gsub(/[^[:alnum:]]+/, '-')}.md"
if File.exist?(path)
@return-none
return-none / capistrano.rb
Created March 14, 2013 17:53
Capistrano deploy from local directory
set :scm, :none
set :repository, "."
set :deploy_via, :copy
@return-none
return-none / Cakefile
Created May 1, 2013 12:38
Simple build task
fs = require 'fs'
{print} = require 'util'
{spawn} = require 'child_process'
task 'build', 'Build assets/js from src/coffee', ->
coffee = spawn 'coffee', ['-c', '-o', 'assets/js', 'src/coffee']
coffee.stderr.on 'data', (data) ->
process.stderr.write data.toString()
coffee.stdout.on 'data', (data) ->
"""
A two-part middleware which modifies request.COOKIES and adds a set and delete method.
`set` matches django.http.HttpResponse.set_cookie
`delete` matches django.http.HttpResponse.delete_cookie
MIDDLEWARE_CLASSES = (
'django_cookies.CookiePreHandlerMiddleware',
...
'django_cookies.CookiePostHandlerMiddleware',
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Display unstaged (*) and staged(+) changes
export GIT_PS1_SHOWDIRTYSTATE="1"
# Display whether there are stashed ($) changes
export GIT_PS1_SHOWSTASHSTATE="1"
# Display if there are untracked (%) files
export GIT_PS1_SHOWUNTRACKEDFILES="1"
# Display if we're ahead (>) or behind (<) or diverged (<>) relative to upstream
@return-none
return-none / mappick.js
Created June 18, 2013 17:48
underscore can do it
var some_json = [
{
id: 1,
title: 'first_element',
other: 'i dont need it',
},
{
id: 2,
title: 'secont_element',
other: 'i dont need it',
// formats Date object in format "yyyy-mm-dd"
function format_date(date) {
var day = date.getDate().toString();
var month = (date.getMonth() + 1).toString();
var year = date.getFullYear().toString();
if (day.length === 1) day = "0" + day;
if (month.length === 1) month = "0" + month;
return [day, month, year].join('-');
}
@return-none
return-none / .railsrc
Created August 21, 2013 07:54
Skip bundle install on rails new
-B