Skip to content

Instantly share code, notes, and snippets.

View vamsiikrishna's full-sized avatar
🎯

Vamsi Krishna B vamsiikrishna

🎯
  • Bengaluru - India
View GitHub Profile
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@rwilson
rwilson / Pascal.scala
Created November 30, 2010 21:27
Pascal's Triangle in scala
// An exercise using scala to output a nicely formatted Pascal's triangle
import scala.math.max
// Define an extractor for Int so we can match below
object Int {
def unapply(s:String) : Option[Int] = try {
Some(s.toInt)
} catch {
case _ : java.lang.NumberFormatException => None
}
@kbond
kbond / build.xml
Created May 10, 2011 14:23
Symfony2 ant build script template
<?xml version="1.0" encoding="UTF-8" ?>
<project name="[PROJECT_NAME]" default="build" basedir=".">
<property environment="env"/>
<loadfile property="version" srcfile="${basedir}/VERSION"/>
<condition property="bat" value=".bat" else="">
<os family="windows" />
</condition>
<target name="test">
<delete dir="${basedir}/build"/>
@cblunt
cblunt / Gemfile
Created October 21, 2011 08:55
Configure Carrierwave for Amazon S3 Storage and Heroku
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL
@weavenet
weavenet / gist:1524092
Created December 27, 2011 15:50
Quick github repo backup script
#!/bin/bash
# Script to backup git repo to S3
# Set bucket, dir, password and account to use for the backup. I keep mine in local env vars
# These are set by localrc which lives on an encrypted home directory and is executed by my bashrc
bucket=$GITHUB_BACKUP_BUCKET
dir=$GITHUB_BACKUP_DIR
password=$GITHUB_BACKUP_PASSWORD
account=$GITHUB_ACCOUNT
@boucher
boucher / gist:1750375
Created February 6, 2012 07:09 — forked from siddarth/gist:1379745
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@havvg
havvg / base.json.twig
Created March 19, 2012 16:30
Symfony2 Twig JSON with JSONP
{% set jsonp = app.request.query.get('callback') %}
{% if jsonp %}{{ jsonp }}({% endif %}
{% block data %}{% if is_json|default(false) %}{{ data|raw }}{% else %}{{ data|json_encode|raw }}{% endif %}{% endblock %}
{% if jsonp %});{% endif %}
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@leon
leon / nginx.conf
Created June 29, 2012 16:34
Nginx PHP-FPM Symfony 2 minimal config
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {