Skip to content

Instantly share code, notes, and snippets.

@jjcodes78
jjcodes78 / nextjs-deploy.md
Last active January 2, 2025 15:03
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@ziadoz
ziadoz / halt_compiler.php
Last active April 23, 2024 17:55
Using PHP Halt Compiler
<?php
/**
* The __halt_compiler() function will stop the PHP compiler when called.
* You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt.
* In this example a PHP template is stored after the halt, to allow simple separation of logic from templating.
* The template is stored in a temporary file so it can be included and parsed.
*
* See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php
* http://php.net/manual/en/function.halt-compiler.php
*/
@adamgit
adamgit / .gitignore
Last active March 20, 2025 10:01
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@oodavid
oodavid / README.md
Last active March 11, 2025 21:41 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@philsturgeon
philsturgeon / gearman-workers.sh
Created January 16, 2012 01:53 — forked from fabriziomachado/gearman-workers.sh
/etc/init.d/gearman-workers
#!/bin/bash
#
# /etc/init.d/gearman-workers
### BEGIN INIT INFO
# Provides: gearman-workers
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@alkemann
alkemann / tests.php
Created October 4, 2011 14:04
Run PHPUnit tests in browser for ease of reading, running subsets or debuggin.
<?php
/**
* Place this file in the webroot of your project,
* access it through http://project.dev/tests.php or http://localhost/project/webroot/tests.php
*
* Assuming you have defined a BASEPATH to the root of your project and
*/
define('BASEPATH', __DIR__.'/..'); // root of project, this one assumes /project/webroot/tests.php
define('LOCATION', BASEPATH .'/app'); // in a SF2 project, this is where the phpunit.xml file is
* GET /posts {"controller":"posts","action":"index"}
* GET /posts/{:id:\d+} {"controller":"posts","action":"show"}
* GET /posts/add {"controller":"posts","action":"add"}
* PUT /posts {"controller":"posts","action":"create"}
* GET /posts/{:id:\d+}/edit {"controller":"posts","action":"edit"}
* POST /posts/{:id:\d+} {"controller":"posts","action":"update"}
* DELETE /posts/{:id:\d+} {"controller":"posts","action":"delete"}
@bdunogier
bdunogier / curl_progress.php
Created June 16, 2011 22:31
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@huacnlee
huacnlee / install-php.sh
Created March 8, 2011 03:13
Ubuntu 10.10 install PHP Apache2 from source
sudo apt-get install libjpeg8-dev libmysqlclient-dev
curl -O http://www.php.net/get/php-5.3.5.tar.gz/from/a/mirror
curl -O http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.17.tar.gz
tar zxf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/etc/apache2 --enable-so --enable-cgi --enable-info --enable-rewrite \
--enable-speling --enable-usertrack --enable-deflate --enable-ssl --enable-mime-magic \
--enable-dav --enable-vhost-alias --enable-proxy --enable-expires --enable-headers
make && sudo make install
@foxzool
foxzool / rails3template.rb
Created January 13, 2011 10:24
my rails3 template
require "thor/shell"
say("Modifying a new Rails app ...", :yellow)
#----------------------------------------------------------------------------
# Configure
#----------------------------------------------------------------------------
=begin
unless options[:database] == 'sqlite3'
username = ask("What's your database username[root]")
username = 'root' if username.blank?