Skip to content

Instantly share code, notes, and snippets.

View svetlio's full-sized avatar

Svetoslav Stoyanov svetlio

View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@alexklibisz
alexklibisz / apache-reverse-proxy.conf
Created May 25, 2015 19:20
Apache Port Forward / Reverse Proxy Config
# Running some application on port 8080, want to make it
# available at subdomain.example.com
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName subdomain.example.com
ProxyPreserveHost On
# setup the proxy
<Proxy *>
Order allow,deny
@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active April 26, 2024 19:09
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@iamravenous
iamravenous / jquery.smooth-scroll-anchor-link.js
Last active April 24, 2024 03:18
Automatically detects the hash and scroll smoothly to anchor link with URL hashchange
@wizioo
wizioo / gitignore_per_git_branch.md
Last active July 22, 2024 00:18
HowTo have specific .gitignore for each git branch

How to have specific .gitignore for each git branch

Objective

My objective is to have some production files ignored on specific branches. Git doesn't allow to do it.

Solution

My solution is to make a general .gitignore file and add .gitignore.branch_name files for the branches I want to add specific file exclusion. I'll use post-checkout hook to copy those .gitignore.branch_name in place of .git/info/exclude each time I go to the branch with git checkout branch_name.

@reinis-kinkeris
reinis-kinkeris / my_module.module
Last active February 8, 2024 11:40
Drupal 8 - Example of adding dynamic js libraries which require locale
/**
* Implements hook_library_info_build().
*
* @return array
*/
function hook_library_info_build() {
$libraries = [];
/** @var \Drupal\Core\Language\LanguageManager $language_manager */
$language_manager = \Drupal::languageManager();
@keopx
keopx / settings.local.php
Last active March 25, 2024 12:22
Drupal 8 Redis settings.local.php
<?php
/**
* Set redis configuration.
*/
/** @see: https://docs.platform.sh/frameworks/drupal8/redis.html */
if (extension_loaded('redis')) {
// Set Redis as the default backend for any cache bin not otherwise specified.
// $settings['cache']['default'] = 'cache.backend.redis';
@crittermike
crittermike / import.php
Last active August 11, 2023 10:39
Importing Drupal 8 config programmatically
<?php
// Import arbitrary config from a variable.
// Assumes $data has the data you want to import for this config.
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html');
$config->setData($data)->save();
// Or, re-import the default config for a module or profile, etc.
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module');