Skip to content

Instantly share code, notes, and snippets.

View kuldipem's full-sized avatar
:shipit:
Looking for new challenges

KULDIP PIPALIYA kuldipem

:shipit:
Looking for new challenges
View GitHub Profile
@mcnamee
mcnamee / bitbucket-pipelines.yml
Last active December 14, 2023 03:57
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add FTP_USERNAME, FTP_PASSWORD and FTP_HOST as environment variables.
# 2. Commit this file (bitbucket-pipelines.yml) to your repo (in the repo root dir)
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initialize GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (see 'Installation' above) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:deploy-all)
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
@DaRaFF
DaRaFF / ubuntu-php-development-environment.md
Last active October 13, 2023 00:16
Ubuntu php development environment

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@remojansen
remojansen / class_decorator.ts
Last active September 14, 2023 14:54
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@vojtajina
vojtajina / all-templates.html
Created August 15, 2012 00:00
AngularJS: load all templates in one file
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
@havvg
havvg / DateRange.php
Last active October 24, 2021 10:33
Symfony2: poor man's date_range form type
<?php
namespace Ormigo\Bundle\OrmigoBundle\Form\Model;
use DateTime;
class DateRange
{
/**
* @var DateTime
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@kuldipem
kuldipem / app-exit.js
Created July 12, 2016 19:36
Cordova/PhoneGap exit app after twice press back button with toast ( plugin required https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin )
var lastTimeBackPress=0;
var timePeriodToExit=2000;
function onBackKeyDown(e){
e.preventDefault();
e.stopPropagation();
if(new Date().getTime() - lastTimeBackPress < timePeriodToExit){
navigator.app.exitApp();
}else{
window.plugins.toast.showWithOptions(
@kuldipem
kuldipem / start.sh
Last active June 13, 2020 10:00
Ubuntu/Linux shell script to run using cron to confirm services status, if not running then send email and start the service
#!/bin/sh
APACHE2_STATUS="$(systemctl is-active apache2.service)"
MYSQL_STATUS="$(systemctl is-active mysql.service)"
NGINX_STATUS="$(systemctl is-active nginx.service)"
DOVECOT_STATUS="$(systemctl is-active dovecot.service)"
START_SCRIPT_DEBUG="true"
FLAG_STATUS="active"
SendEmail(){
@cultofmetatron
cultofmetatron / gist:5349630
Created April 9, 2013 21:38
passport ajax capable authenticate
app.post('/login', function(req, res) {
console.log(res);
passport.authenticate('local', function(err, user) {
if (req.xhr) {
//thanks @jkevinburton
if (err) { return res.json({ error: err.message }); }
if (!user) { return res.json({error : "Invalid Login"}); }
req.login(user, {}, function(err) {
if (err) { return res.json({error:err}); }
return res.json(