Skip to content

Instantly share code, notes, and snippets.

View avinashbot's full-sized avatar

Avinash Dwarapu avinashbot

View GitHub Profile
@jharjono
jharjono / sinatra_sass_coffee.rb
Created March 7, 2011 19:12
a setup of Sinatra using Slim for HTML, Sass for CSS, and CoffeeScript for JavaScript
#!/usr/bin/env ruby
# Libraries:::::::::::::::::::::::::::::::::::::::::::::::::::::::
require 'rubygems'
require 'sinatra/base'
require 'slim'
require 'sass'
require 'coffee-script'
# Application:::::::::::::::::::::::::::::::::::::::::::::::::::
@cobyism
cobyism / gh-pages-deploy.md
Last active June 26, 2024 23:06
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@mrdcbrush
mrdcbrush / thisOldiPadiTunesSearch.rb
Last active December 25, 2015 07:19
Searches the itunes store for ios applications that are compatible with the original iPad. Alter the term and rating parameters to filter results.
require 'net/http'
require 'uri'
require 'json'
term = 'calendar'
rating = 4
uri = URI("https://itunes.apple.com/search?term="+ term +"&country=us&media=software&entity=iPadSoftware&limit=50")
resp = Net::HTTP.get_response(uri)
results = JSON.parse(resp.body)
@taddev
taddev / gihtubpage.conf
Last active January 25, 2024 14:56
NGINX Reverse proxy settings to Github pages
server {
listen 80 default_server;
listen [::]:80 ipv6only=on default_server;
server_name splunk.net blog.splunk.net www.splunk.net .taddevries.com;
access_log /var/log/nginx/blog.access_log main;
error_log /var/log/nginx/blog.error_log info;
return 301 https://blog.splunk.net;
}
server {
@John2496
John2496 / gist:a2823bd1c04e5d83fa6c
Last active February 6, 2017 16:31
Project managers don't want you to know about this one simple tip...
<?php
// simple technique to remove bugs from your code
// example buggy code
$your_code = "<html><Oh man>i hope i don't have any American cockroaches in my code</Oh man></html>";
$list_of_bugs = array('American cockroach', 'Ants', 'Aphids', 'Aphids', 'Asian paper wasp',
'Asian paper wasp nest', 'Assassin bug', 'Australian bag moth', 'Australian bag moth pupa',
'Avondale spider', 'Backswimmer', 'Bamboo moth', 'Banana moth', 'Banana moth pupa',
@grugq
grugq / gist:03167bed45e774551155
Last active April 6, 2024 10:12
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@bsphere
bsphere / timestamp.go
Last active January 23, 2024 02:50
UNIX timestamps in Golang
package timestamp
import (
"fmt"
"labix.org/v2/mgo/bson"
"strconv"
"time"
)
type Timestamp time.Time
@imjasonh
imjasonh / markdown.css
Last active May 24, 2024 22:56
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@gene1wood
gene1wood / all_aws_managed_policies.json
Last active May 29, 2024 05:17
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
This file has been truncated, but you can view the full file.
{
"APIGatewayServiceRolePolicy": {
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy",
"AttachmentCount": 0,
"CreateDate": "2019-10-22T18:22:01+00:00",
"DefaultVersionId": "v6",
"Document": {
"Statement": [
{
@almightycouch
almightycouch / psql_changefeed.sql
Last active August 16, 2019 07:56
PostgreSQL changefeed using NOTIFY
CREATE FUNCTION notify_changes() RETURNS trigger AS $$
DECLARE
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify('insert', json_build_object('table', TG_TABLE_NAME, 'new_val', row_to_json(NEW))#>>'{}');
RETURN NEW;
ELSIF TG_OP = 'UPDATE' THEN
PERFORM pg_notify('update', json_build_object('table', TG_TABLE_NAME, 'new_val', row_to_json(NEW), 'old_val', row_to_json(OLD))#>>'{}');
RETURN NEW;
ELSIF TG_OP = 'DELETE' THEN