Skip to content

Instantly share code, notes, and snippets.

View vishvish's full-sized avatar
😷
coding

Vish vishvish

😷
coding
View GitHub Profile
@vishvish
vishvish / gist:1680186
Created January 26, 2012 01:05
CarrierWave Amazon S3 File Reprocessor Rake Task - Fixed for "\xFF" from ASCII-8BIT to UTF-8 error
##
# CarrierWave Amazon S3 File Reprocessor Rake Task
#
# Written (specifically) for:
# - CarrierWave
# - Ruby on Rails 3
# - Amazon S3
#
# Works with:
# - Any server of which you have write-permissions in the Rails.root/tmp directory
@vishvish
vishvish / gist:5722132
Last active December 18, 2015 03:59 — forked from nbibler/gist:5307941
.powrc for projects that works with RVM
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
fi
if [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
fi
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
config_files = Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf")
config_files.each do |file|
certificate_files = ['ca', 'cert', 'key', 'tls-auth']
config_dir = File.dirname(file)
connection_name = nil
new_config = []
File.read(file).each do |line|
line.strip!

Keybase proof

I hereby claim:

  • I am vishvish on github.
  • I am vv (https://keybase.io/vv) on keybase.
  • I have a public key whose fingerprint is D448 E579 3FAC 8326 DF09 9853 15B3 36DC 1548 75BD

To claim this, I am signing this object:

{
"apiVersion": "1.0.0",
"swaggerVersion": "1.2",
"basePath": "http://petstore.swagger.wordnik.com/api",
"resourcePath": "/store",
"produces": [
"application/json"
],
"authorizations": {},
"apis": [
@vishvish
vishvish / gist:4163de24fb38b6be0c6e
Created November 11, 2015 09:35 — forked from j3j5/gist:8b3e48ccad746b90a54a
Adyen Test Card Numbers
Adyen Test Card Numbers
These cards are only valid on our TEST system and they will never involve any actual transaction or transfer of funds. The TEST card numbers will not work on the Adyen LIVE Platform.
For all cards use the following expiration and CVV2/CVC2/or CID for Amex.
For all cards:
Expiration Dates CVV2 / CVC3 CID (American Express)
06/2016 OR 08/2018 737 7373
package main
import (
"fmt"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
h, _ := os.Hostname()
fmt.Fprintf(w, "Hi there, I'm served from %s!", h)
}
@vishvish
vishvish / DispatchGroupDemo.swift
Created December 29, 2015 00:03 — forked from kristopherjohnson/DispatchGroupDemo.swift
Simple demo of dispatch_group_async/dispatch_group_notify/dispatch_group_wait in Swift
import Foundation
let notified = dispatch_semaphore_create(0)
let group = dispatch_group_create()
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
for n in 0..<20 {
dispatch_group_async(group, queue) {
let timeInterval = Double(arc4random_uniform(1000)) * 0.01
@vishvish
vishvish / tmux-cheatsheet.markdown
Created April 13, 2016 09:38 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname