Skip to content

Instantly share code, notes, and snippets.

View robink's full-sized avatar
🎯
Focusing

Robin Komiwes robink

🎯
Focusing
View GitHub Profile
@isaacabraham
isaacabraham / 1. FreeAgentCore.fs
Last active July 20, 2016 09:55
FreeAgent file download
#I @"packages"
#r @"Http.Fs\lib\net40\HttpClient.dll"
#r @"FSharp.Data\lib\net40\FSharp.Data.dll"
open HttpClient
open FSharp.Data
module Security =
type RefreshTokenResponse = JsonProvider< """{
"access_token":"ACCESS TOKEN",
@iRyusa
iRyusa / layout.haml
Created May 22, 2013 12:21
Snippet for missing translation highlight in RAILS layout
- if Rails.env.development?
:css
.translation_missing{
color: red;
}
@robink
robink / Gemfile
Last active December 17, 2015 06:58
Show the "changelog" / "releases notes" of a given repo. Relies on Pull Requests descriptions (as they are editables) and printing only when their title contains "#changelog".
source 'https://rubygems.org'
gem "github_api"
gem "highline"
@robink
robink / DbBackup.rb
Created January 22, 2013 14:07
Resque DbBackup job - A simple mysql database backup job with an upload to a cloud container at the end (rackspace cloud files). Require resque scheduler.
module DbBackup
@queue = :db_backup
def perform( forced_filename = nil )
config = Rails.configuration.database_configuration
database = config[Rails.env]["database"]
username = config[Rails.env]["username"]
password = config[Rails.env]["password"]
dumps_path = Rails.root.join('tmp', 'dumps').to_s
@ryanb
ryanb / abilities.rb
Created September 15, 2012 19:23
How you can break up large Ability class in CanCan
module Abilities
def self.ability_for(user)
if user.admin?
AdminAbility.new(user)
else user
MemberAbility.new(user)
else
GuestAbility.new
end
end
@i-scorpion
i-scorpion / README.txt
Created June 18, 2012 12:24
Twitter bootstrap fixed table header using jQuery
Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled.
Using the code from twitter bootstrap documentation page, this code is customized for table header.
Create the table with following layout -
<table class="table-fixed-header">
<thead class="header">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
@MarkVaughn
MarkVaughn / get_set_url_param.js
Created March 19, 2012 05:29
Get & Set URL parameter in Javascript
function getURLParameter(name) {
return decodeURIComponent(
(RegExp('[?|&]'+name + '=' + '(.+?)(&|$)').exec(location.search)||[null,null])[1]
);
}
function setURLParameter(name,value){
var search;
if(getURLParameter(name)){
search =location.search.replace(new RegExp('([?|&]'+name + '=)' + '(.+?)(&|$)'),"$1"+encodeURIComponent(value)+"$3");
}else if(location.search.length){
@jamiepenney
jamiepenney / bootstrap.rb
Created February 14, 2012 19:57
Form builder for Twitter Bootstrap v2 form elements
# This file goes in config/initializers
require 'bootstrap_form_builder'
# Make this the default Form Builder. You can delete this if you don't want form_for to use
# the bootstrap form builder by default
ActionView::Base.default_form_builder = BootstrapFormBuilder::FormBuilder
# Add in our FormHelper methods, so you can use bootstrap_form_for.
ActionView::Base.send :include, BootstrapFormBuilder::FormHelper
@iwinux
iwinux / gist:1529093
Created December 28, 2011 18:38
config.assets.precompile
def compile_asset?(path)
# ignores any filename that begins with '_' (e.g. sass partials)
# all other css/js/sass/image files are processed
if File.basename(path) =~ /^[^_].*\.\w+$/
puts "Compiling: #{path}"
true
else
puts "Ignoring: #{path}"
false
end
@clemherreman
clemherreman / random_sign.js
Created November 10, 2011 13:43 — forked from robink/random_sign.js
-1 | 1
var randomSign = function() {
return (Math.random() > 0.5) ? 1 : -1;
};