Skip to content

Instantly share code, notes, and snippets.

View phaniram's full-sized avatar

Maturu Srinivas Phani Ram phaniram

View GitHub Profile
@lmcneel
lmcneel / remove-node-modules.md
Last active July 9, 2024 19:06
How to remove node_modules after they have been added to a repo

How to remove node_modules

Create a .gitignore file

  1. Check for an existing .gitignore file in the project directory
ls -a
@kentcdodds
kentcdodds / README.md
Last active July 29, 2017 15:37
upload-file

upload-file angular-formly type

This is my upload-file type for what I use at work. We use angular-upload for the upload service to do the actual file uploading. We also have several abstractions and use ES6 that may confuse you a little bit (sorry about that). Hopefully this gets you started though.

@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active May 11, 2024 17:43
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@OneCricketeer
OneCricketeer / main.js
Last active January 25, 2022 06:36
Targeted Push Notifications: Parse.com Cloud Code
// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:
Parse.Cloud.define("hello", function(request, response) {
response.success("Hello world!");
});
Parse.Cloud.define("userWithEmailExists", function(request, response) {
var email = request.params.email;
if (email != null && email !== "") {
email = email.trim();
@phaniram
phaniram / Cssify.java
Created March 24, 2013 07:16
Convert XPath to CSS selector
// Java function for converting simple XPath to CSS Selector.
// Used cssify.js from [cssify.js](https://gist.github.com/Dither/1909679)
// Removed log statements (as window objects aren't supported in ScriptEngine)
import java.io.FileNotFoundException;
import java.io.FileReader;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
@latortuga
latortuga / gist:4241729
Created December 8, 2012 20:13
Setup Uploadify to upload directly to S3
var uploadify_data = {
'AWSAccessKeyId': '<%= @uploadify_data[:access_key] %>',
'bucket': '<%= @uploadify_data[:bucket] %>',
'acl': 'private',
'key': '<%= @uploadify_data[:key] %>${filename}',
'signature': '<%= @uploadify_data[:signature] %>',
'policy': '<%= @uploadify_data[:policy] %>',
'success_action_status': '<%= @uploadify_data[:sas] %>',
'folder': '',
'Filename': ''
@BinaryMuse
BinaryMuse / phantom.coffee
Created April 13, 2012 18:33
Take screenshots with Phantom.js from Node.js
#!/usr/bin/env coffee
# Call the program with: coffee phantom.coffee http://url.to/screengrab
phantom = require 'phantom' # npm install phantom
child_process = require 'child_process'
url = process.argv[2]
createScreenshot = (page, filename) ->
@phaniram
phaniram / spoon.java
Created March 2, 2012 19:02
Codechef-MarchContest-SPOON-(Accepted)
package com.cyp.codechef.marcontest;
import java.io.IOException;
import java.util.Scanner;
/*
* Cypronmaya - Codechef March 2012 Contest - Problem Code : SPOON
*/
class SPOON {
@Dither
Dither / cssify.js
Created February 25, 2012 17:38
Convert XPath to CSS selector
// JavaScript function for converting simple XPath to CSS selector.
// Ported by Dither from [cssify](https://github.com/santiycr/cssify)
// Example: `cssify('//div[@id="girl"][2]/span[@class="body"]//a[contains(@class, "sexy")]//img[1]')`
var sub_regexes = {
"tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\\*)",
"attribute": "[.a-zA-Z_:][-\\w:.]*(\\(\\))?)",
"value": "\\s*[\\w/:][-/\\w\\s,:;.]*"
};
@phaniram
phaniram / Solution.java
Created December 28, 2011 18:28
Interview Street Challenges-String reduction
package interviewstreet;
import java.util.Arrays;
import java.util.Scanner;
public class Solution {
int min=1;
int val=1;
public static void main(String[] args) {