Skip to content

Instantly share code, notes, and snippets.

View guinslym's full-sized avatar

Guinslym guinslym

View GitHub Profile
@ajaxray
ajaxray / KNPPaginatorConfig.yml
Last active May 25, 2017 11:13
Bootstrap 3 style pagination template for Symfony KnpPaginatorBundle.
# From http://stackoverflow.com/a/23035644/228648
# Update pagination config in config.yml as:
knp_paginator:
template:
pagination: AcmeBundle:Common:paginator-bootstrap.html.twig
@vigram
vigram / sidekiq_tasks.rake
Created December 11, 2014 12:09
Rake task to restart Sidekiq process
# Usage: bundle exec rake sidekiq:restart RAILS_ENV=<environment name>
namespace :sidekiq do
sidekiq_pid_file = Rails.root+'tmp/pids/sidekiq.pid'
desc "Sidekiq stop"
task :stop do
puts "#### Trying to stop Sidekiq Now !!! ####"
if File.exist?(sidekiq_pid_file)
puts "Stopping sidekiq now #PID-#{File.readlines(sidekiq_pid_file).first}..."
@ZengetsuFR
ZengetsuFR / suitcaseOnTheBus.py
Last active August 29, 2015 14:08
playing with chicago's public data
# -*- coding: utf-8 -*-
#exercise from "Learn Python Through Public Data Hacking" see youtube here : http://youtu.be/RrPZza_vZ3w
#Travis traveled to Chicago and took the Clark Street #22 bus up to Dave's office.
#Problem: He just left his suitcase on the bus!
#Your task: Get it back!
#Dave's office is located at:
# latitude =41.980262
# vim: set ft=python :
from __future__ import print_function
import json
import sys
import datetime
from redis import StrictRedis as Redis
@rtt
rtt / gist:5a2e0cfa638c938cca59
Created August 14, 2014 09:46
example python tinderbot
# encoding: utf8 1,1 Top# encoding: utf8
import argparse
from datetime import datetime
import json
from random import randint
import requests
import sys
from time import sleep
@anupamshakya7
anupamshakya7 / Transformation_From_XSLT
Created April 25, 2014 11:11
How to transform an XML file using XSLT in Python
from lxml import etree
data = open('D:\Conversion\MACSXML_Parts.xslt')
xslt_content = data.read()
xslt_root = etree.XML(xslt_content)
dom = etree.parse('D:\Conversion\Cat2015UF.xml')
transform = etree.XSLT(xslt_root)
result = transform(dom)
f = open('D:\Conversion\MACSXML_Parts.csv', 'w')
f.write(str(result1))
#Sort the Ruby files in your project by number of has_many
ack " has_many " -c | awk -F ":" '{print $2,$1}' | grep -v "0" | sort -rn
#Sort the Ruby files in your project by LOC
find . -iname "*.rb" -type f -exec wc -l {} \; | sort -rn
anonymous
anonymous / Floating-Labels.markdown
Created April 16, 2014 20:10
A Pen by Rik Schennink.
CKEDITOR.editorConfig = function( config )
{
config.width = 450;
config.forcePasteAsPlainText = true;
config.autoGrow_onStartup = true;
config.autoGrow_minHeight = 300;
config.fillEmptyBlocks = false;
config.autoParagraph = false;
config.toolbar_mini = [
['Format'],