Skip to content

Instantly share code, notes, and snippets.

View nikhgupta's full-sized avatar
🏠
Working from home

Nikhil Gupta nikhgupta

🏠
Working from home
View GitHub Profile
@lezuber
lezuber / LogseqImagesToAssetFolder.py
Last active May 31, 2023 06:50
Download Logseq repository images to local asset folder
#!/usr/bin/env python
# coding: utf-8
# What is this?
# This script is for logseq webapp users that want to switch to the local version.
# It will download all images that are linked inside your graph and store them in the local "/assets/" folder.
# Remarks
# 1. Only supports Markdown files (for now)
@yosukehasumi
yosukehasumi / readme.md
Last active October 22, 2021 15:12
DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

  1. Setup
  2. Swapfile
  3. NGINX
  4. ElasticSearch
  5. RVM
  6. Rails
  7. Postgres
  8. Capistrano
@nikhgupta
nikhgupta / custom.css
Created October 10, 2014 02:32
Custom CSS for MarkdownPreview plugin in Chrome
@import url(http://fonts.googleapis.com/css?family=Handlee|Open+Sans&subset=latin);
body {
font-family: "Open Sans", Helvetica, arial, sans-serif;
font-size: 1em;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
@abevoelker
abevoelker / foo_spider.py
Last active August 29, 2015 13:59
scrapy Sidekiq pipeline (resque support shouldn't be too hard)
# project_name/spiders/foo_spider.py
from scrapy.contrib.spiders import CrawlSpider
class FooSpider(CrawlSpider):
post_process = dict(
klass = "Foo::Worker",
# queue = "default",
# retry = True,
)
@alex-zige
alex-zige / gist:5795358
Last active June 8, 2023 07:49
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@tybenz
tybenz / urlshort.sh
Created February 7, 2013 23:02
Bash URL Shortener
#!/bin/bash
echo "Generating URL..."
FULL_PATH="/Users/tbenzige/Projects/aws"
#Count is kept based on a list.txt file
#list.txt is a plain text file meant to show relationships between URLs
#Instead of a running count, we just count the lines in list.txt
INITIAL=`echo -n $(cat $FULL_PATH/list.txt | wc -l)`
NUM="$INITIAL/4"
@minikomi
minikomi / editor.html
Last active November 11, 2021 10:16
my editor
data:text/html,
<style type="text/css">
#e {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
font-size:16px;
}
@schmurfy
schmurfy / gist:3199254
Created July 29, 2012 14:33
Install pandoc Mac OS X 10.8
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew
@jedschneider
jedschneider / gh-pages-tips.md
Created June 7, 2012 17:59
github pages tips for jekyll wiki

Working With Github Pages

The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.

Gitignore

Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.

Working With Code Partials

@nikhgupta
nikhgupta / newrails.bash
Created March 17, 2012 08:58
a bash function to create a new rails project with some defaults
# note that the database is being used with login: root/password
# make necessary changes if you are using something else or simple remove that block
function newrails() {
app="$1"; ruby="${2:-1.9.3@rails}";
if [ -n "${app}" ]; then
read -r -d '' gemfile <<-'EOF'
group :test, :development do
gem 'turn'
gem 'rspec-rails'
gem 'capybara'