Skip to content

Instantly share code, notes, and snippets.

@prasadsilva
prasadsilva / fresh-chrome-with-custom-tz.sh
Last active June 4, 2023 12:54 — forked from stuartsierra/fresh-chrome.sh
Launch new instances of Google Chrome on OS X with isolated cache, cookies, user config and custom Timezone
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@ianmustafa
ianmustafa / index.php
Last active April 5, 2023 19:45
Composer Autoload in CodeIgniter. This method provides Cmposer autoloader to be loaded before CodeIgniter classes. Useful to be used with dotenv file using PHP Dotenv package by josegonzalez.
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
*
@stevegraham
stevegraham / active_jerbz.rake
Created December 4, 2014 15:47
Run ActiveJobs with Sneakers
require 'sneakers/runner'
task :environment
namespace :sneakers do
desc "Start processing jobs with all workers"
task :work => :environment do
silence_warnings do
Rails.application.eager_load! unless Rails.application.config.eager_load
end
@zedar
zedar / GroovyHTTPBuilderChunkedResponse.md
Last active August 29, 2015 14:08
HTTPBuilder and chunked response

There is a bug in Groovy version up to 2.3.7. HTTPBuilder is not able to automatically parse chunked response to JSON format. If external server returns response with header:

Transfer-Encoding : chunked

Usually applied code:

def http = new HTTPBuilder(url)

def result = http.request(POST, JSON) { req ->

@ohryan
ohryan / responsive-align.less
Last active April 30, 2019 17:27
Bootstrap 3 Responsive Text Align
.text-xs-left { text-align: left; }
.text-xs-right { text-align: right; }
.text-xs-center { text-align: center; }
.text-xs-justify { text-align: justify; }
@media (min-width: @screen-sm-min) {
.text-sm-left { text-align: left; }
.text-sm-right { text-align: right; }
.text-sm-center { text-align: center; }
.text-sm-justify { text-align: justify; }
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
# Custom tasks
require 'capistrano/composer'
require 'capistrano/npm'
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@ozuma
ozuma / nochunk.cgi
Created July 24, 2013 05:30
Suppress "Transfer-Encoding: chunked" header and chunked body in CGI. (Apache, Perl)
#!/usr/bin/perl
use strict;
use warnings;
my $body = <<"EOM";
<html>
<head>
<title>title</title>
</head>
@dergachev
dergachev / prepend-timestamp.md
Last active September 28, 2016 14:56
shell snippet to prepend timestamp to command output

prepend-timestamp

Shell snippet that prepends a nice to a command's output.

For example, here's the (snipped) output of vagrant provision:

Successfully installed bundler-1.3.5  
1 gem installed  
Using rmagick (2.13.2)  
@djburdick
djburdick / rails_db_migrate_multiple_databases.rb
Created May 22, 2013 17:16
make schema_migrations work over multiple databases. #rails
module ActiveRecord
class Migrator
class << self
def get_all_versions
table = Arel::Table.new(schema_migrations_table_name)
# must not be Base.establish_connection b/c that'll drop the mysql2
# adapter connection and blow up rake db:schema:dump
SchemaMigration.establish_connection(ActiveRecord::Base.configurations['cluster'][Rails.env])
cluster_migrations = SchemaMigration.connection.select_values(table.project(table['version'])).map{ |v| v.to_i }