Skip to content

Instantly share code, notes, and snippets.

View rajdeep26's full-sized avatar

Rajdeep Mandrekar rajdeep26

View GitHub Profile
@mjrich
mjrich / README.md
Created November 6, 2012 04:48 — forked from nikhilrajendra/README.md
Thanking friends who wishes for your birthday
@rnkn
rnkn / paginator.html
Last active October 27, 2015 18:57
A better Jekyll paginator
{% if paginator.total_pages > 1 %}
<p>
{% if paginator.previous_page == 1 %}
<a href="{{ '/blog/' | prepend: site.baseurl }}">previous</a>
{% elsif paginator.previous_page %}
<a href="{{ paginator.previous_page_path | prepend: site.baseurl }}">previous</a>
{% else %}
previous
{% endif %}
@nhoizey
nhoizey / README.md
Last active October 27, 2015 19:00
Jekyll pagination
$ ab -c 1 -n 1000 http://127.0.0.1:3000/home
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
@sacreman
sacreman / gist:4453493
Created January 4, 2013 15:32
haproxy config
global
log 127.0.0.1 local2 info
pidfile /var/run/haproxy.pid
stats socket /var/run/haproxy.stat mode 600 level admin
#debug
defaults
mode http
log global
@flaviaza
flaviaza / README.txt
Created September 21, 2012 18:08 — forked from i-scorpion/README.txt
Twitter bootstrap fixed table header using jQuery
Here is a simple jQuery plugin to make a table header fixed on top of a div when this is scrolled.
Using the code from twitter bootstrap documentation page, this code is customized for table header.
Create the table with following layout -
<div class="row fixed-table">
<div class="table-content">
<table class="table table-striped table-fixed-header" id="mytable">
<thead class="header">
<tr>
<th>Email Address</th>
@wakiki
wakiki / gist:3312792
Created August 10, 2012 09:12
Rails 3 merging scope with OR
# By Steve Leung
# steve@leungs.me
class ActiveRecord::Relation
# temporarily hack for allowing combining scopes with OR
# doesn't add the join tables so need to use .includes manually
# ie. Jobship.includes(:job).or(Jobship.accepted, Jobship.declined).count
def or(*scopes)
clauses = *scopes.map do |relation|
@neilsoult
neilsoult / LazyLoad.js
Created October 31, 2013 19:40
LazyLoad directive for loading external javascript for AngularJs. In this example, I use google maps' API as the external library being loaded
angular.module('testApp', []).
directive('lazyLoad', ['$window', '$q', function ($window, $q) {
function load_script() {
var s = document.createElement('script'); // use global document since Angular's $document is weak
s.src = 'https://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize';
document.body.appendChild(s);
}
function lazyLoadApi(key) {
var deferred = $q.defer();
$window.initialize = function () {
@Pierstoval
Pierstoval / imagemagick_geometry.php
Last active January 9, 2020 15:24
This enormous regexp matches any "Geometry" parameter for ImageMagick. See the docs about this: http://www.imagemagick.org/script/command-line-processing.php#geometry
<?php
$number = "\d*(?:\.\d+)?"; // It's a reference to use in other cases that matches any kind of number/float
$width = "(?<w>(?:$number)?%?)?"; // This is the first part, the width
$height = "(?:x(?<h>(?:$number)?%?))?"; // Here is the height, the same as "width" but starting with an "x"
$aspect = "[!><@^]"; // These are the different filters one can use to stretch, shrink, etc.
$size = "$width$height"; // To match any size we need width and height at least (aspect comes later)