Skip to content

Instantly share code, notes, and snippets.

View silentworks's full-sized avatar

Andrew Smith silentworks

View GitHub Profile
@weyert
weyert / Auth.js
Created March 13, 2017 19:28
Trails annotations
const Annotation = require('ecmas-annotations').Annotation
const _ = require('lodash')
/**
* @module Auth
* @description Auth annotation
*/
module.exports = class Auth extends Annotation {
constructor(data, filePath) {
@barbietunnie
barbietunnie / stop-mac-apache.sh
Created February 25, 2017 22:42
Stop Default Apache server running on Mac OS Sierra
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
@benjamminf
benjamminf / neo_create_block.php
Last active July 31, 2017 17:49
Create Neo block and save it to entry
<?php
// Get the entry model. This could really be any element model, such as a category or Craft Commerce product.
$entry = craft()->entries->getEntryById(1234);
// Get the Neo field model and the field type model.
$field = craft()->fields->getFieldByHandle('neoFieldHandle');
$fieldType = $field->getFieldType();
$fieldType->setElement($entry);
@tylerflint
tylerflint / boxfile.yml
Created December 27, 2016 23:14
Hugo with nanobox
run.config:
engine: static
cache_dirs:
- .bin
extra_path_dirs:
- /app/.bin
extra_steps:
.DS_Store
node_modules
@neckhair
neckhair / .dockerignore
Created November 15, 2016 09:48
Sample dockerignore for a Rails app
.git
.gitignore
README.md
#
# OS X
#
.DS_Store
.AppleDouble
.LSOverride
@Hendrixer
Hendrixer / editor.css
Last active February 17, 2025 15:39
VS code custom CSS for theme
.composite-title, .composite-title, .vs-dark .monaco-workbench>.activitybar>.content {
background-color: rgba(40, 44, 52, 1) !important;
}
.tabs-container, .tab, .tab.active, .title-actions, .tablist, .tabs-container, .tabs, .composite.title {
background-color: rgba(40, 44, 52, 1) !important;
}
.tab.active, .tab {
border-right: 0px !important;
@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active January 30, 2025 19:01
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active April 27, 2025 09:56
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32: