Skip to content

Instantly share code, notes, and snippets.

View desaiuditd's full-sized avatar
🚀

Udit Desai desaiuditd

🚀
View GitHub Profile
@desaiuditd
desaiuditd / hook.php
Created March 3, 2015 17:49
Git Webhook
<?php
// array - repo names and local filesystem path and branch
$repos = array(
'plugin-slug' => array (
'branch' => 'master',
'localpath' => '/var/www/example.com/htdocs/wp-content/plugins/plugin-slug'
),
);
hook_write_log( 'Hello at ' . date( 'D M j G:i:s T Y' ) );
@desaiuditd
desaiuditd / nginx-force-https
Last active August 29, 2015 14:16
Nginx Rules for Force HTTPS
#WWW to HTTPS+non-WWW
server {
server_name www.example.com ;
return 301 https://example.com$request_uri ;
}
#WWW to HTTPS+non-WWW
server {
listen 443 ;
server_name www.example.com ;
@desaiuditd
desaiuditd / gruntfile.js
Last active August 29, 2015 14:17
Grunt Deploy
// Generated on 2014-04-08 using generator-angular 0.8.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
{
"staging": {
"destination": "/var/www/staging.example.com/htdocs/",
"hostname": "staging.example.com",
"username": "www-data",
"port": 22,
"sshLocalPath": "/home/udit/.ssh/id_rsa"
},
"production": {
"destination": "/var/www/example.com/htdocs/",
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@desaiuditd
desaiuditd / get_meta.py
Last active August 29, 2015 14:21 — forked from jeffaudi/get_meta.py
This python script uses the Airbus Geo Catalog API to retrieve the meta-data associated to a list of imagery identifiers
# Script : get_meta.py
# Source : https://gist.github.com/jeffaudi/9fcac727cf6251287ecc/
# Copyright (c) 2014, Jeff Faudi
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
@desaiuditd
desaiuditd / git-clone-non-empty-directory.md
Last active August 29, 2015 14:21 — forked from davisford/gist:5039064
git clone in non-empty directory

Let's say you start a project locally, and do some editing.

$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE

Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:

@desaiuditd
desaiuditd / SortLL_src_sortll_SortLL.java
Last active January 23, 2016 01:46
Sort Linked List
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sortll;
/**
*
* @author Pooja
@desaiuditd
desaiuditd / ucfirst.java
Created February 16, 2016 21:26 — forked from jimjam88/ucfirst.java
Java mimic of PHP's ucfirst function
/**
* Mimics PHP's ucfirst function.
*
* @param subject The string to be ucfirst'd
* @return The subject string with an uppercased first character
*/
final public static String ucfirst(String subject)
{
return Character.toUpperCase(subject.charAt(0)) + subject.substring(1);
}

Keybase proof

I hereby claim:

  • I am desaiuditd on github.
  • I am desaiuditd (https://keybase.io/desaiuditd) on keybase.
  • I have a public key whose fingerprint is 2C76 0DDF EAF3 3C66 B687 FCFB 7F21 FD23 2244 74F5

To claim this, I am signing this object: