Skip to content

Instantly share code, notes, and snippets.

View RATTLESNAKE-VIPER's full-sized avatar

Gautam RATTLESNAKE-VIPER

  • Mumbai,Maharashtra,India
View GitHub Profile
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active April 25, 2026 16:44
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@mpalmerlee
mpalmerlee / documentModel.js
Last active April 2, 2018 21:12
Save MongoDB Document With Concurrent Edit Protection
var mongoose = require("mongoose");
var ObjectId = mongoose.Schema.Types.ObjectId;
//create schema for a post
var PostSchema = new mongoose.Schema({
nonce: ObjectId, //this is used for protecting against concurrent edits: http://docs.mongodb.org/ecosystem/use-cases/metadata-and-asset-management/
name: String,
dateCreated: { type: Date, default: Date.now },
dateLastChanged: { type: Date, default: Date.now },
postData: mongoose.Schema.Types.Mixed
@branneman
branneman / better-nodejs-require-paths.md
Last active April 26, 2026 01:36
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@rbaulin
rbaulin / UIImage+ImageEffects.h
Last active January 9, 2017 09:38
UIImage+ImageEffects.m presented on WWDC 2013
/*
File: UIImage+ImageEffects.h
Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur.
Version: 1.0
Copyright (C) 2013 Apple Inc. All Rights Reserved.
*/
@import UIKit;
@nijikokun
nijikokun / bench-execution.md
Last active December 2, 2024 11:03
Benchmark single method execution time easily using Node.js or Javascript in general.

So, I was developing a node shell script and wanted to determine the time it took from start, to finish to generate the output of a file. Simple, right? It is, but the problem is that if you want a clean way to do it... you have to develop it, otherwise you'll have a lot of wrapper code surrounding methods and such. So I wrote a small method to simplify it even further.

Benchmark Method:

function benchmark (method) {
  var start = +(new Date);

  method && method(function (callback) {
 var end = +(new Date);
@erikroyall
erikroyall / evento.js
Last active September 23, 2016 17:03
A cross-browser event handling system
// Evento - v1.0.0
// by Erik Royall <[email protected]> (http://erikroyall.github.io)
// Dual licensed under MIT and GPL
// Array.prototype.indexOf shim
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
'use strict';
@sxua
sxua / UIAppearance.md
Created September 18, 2013 17:19
UIAppearance methods (including iOS 7)

UIActivityIndicatorView

5.0

@property (readwrite, nonatomic, retain) UIColor *color

UIBarButtonItem

@jedi4ever
jedi4ever / nodejs-cluster-zero-downtime.md
Last active March 27, 2026 06:38
nodejs clustering, zero downtime deployment solutions

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)

@mrtj
mrtj / UIView+Blur.h
Created July 4, 2013 15:20
Create blurred image from any UIView #objective-c
#import <UIKit/UIKit.h>
@interface UIView (Blur)
+(UIImage*)createBlurredImageFromView:(UIView*)view;
@end
@AquaGeek
AquaGeek / cache.db.sql
Last active July 20, 2022 06:38
iOS Cache.db
CREATE TABLE cfurl_cache_blob_data(
entry_ID INTEGER PRIMARY KEY,
response_object BLOB,
request_object BLOB,
proto_props BLOB,
user_info BLOB
);
CREATE INDEX proto_props_index ON cfurl_cache_blob_data(entry_ID);
CREATE TABLE cfurl_cache_receiver_data(