Skip to content

Instantly share code, notes, and snippets.


Han apricot13

View GitHub Profile
ChristopherA /
Last active May 26, 2022 — forked from idelem/titleUrlMarkdownClip.js
Copy current page title and url in Markdown format

Copy current page title and url in Markdown format

Tags: #bookmarklet #curation #markdown

Bookmarklet to copy current page title and url in Markdown format to clipboard, like title - Usual for posting links to resources in files #bookmarklet #safari #markdown #tool

Originally from:

MarcoWorms / mini-redux.js
Last active Sep 24, 2021
Redux in a nutshell
View mini-redux.js
function createStore (reducers) {
var state = reducers()
const store = {
dispatch: (action) => {
state = reducers(state, action)
getState: () => {
return state
View getClassNames.js
function *traverse(item) {
for ( var child of item.children ) {
if (child.className) {
yield* child.classList;
if (child.childElementCount !== 0) {
yield* traverse(child);
webdevilopers / ContractController.php
Last active Mar 11, 2020
Symfony Event Listener to send html mail using SwiftMailer and Twig
View ContractController.php
namespace Acme\Bundle\ContractBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ContractController extends Controller
public function eventAction(Contract $contract)
$event = new ContractEvent($contract);
apricot13 / git_feature_branch
Created Jan 8, 2015
Git: Feature branch workflow
View git_feature_branch
git checkout -b feature-branch master
git status
git add <some-file>
git commit
git push -u origin feature-branch
git push
git checkout master
willurd / Getting started with
Last active Jun 11, 2022
A short introduction to require.js
View Getting started with

This is a small collection of scripts showing how to use require.js. It's only one of several ways of setting up a require.js project, but it's enough to get started.

At its core, require.js is about three things:

  1. Dependency management
  2. Modularity
  3. Dynamic script loading

The following files show how these are achieved.

ryoppy / getQueryParams.js
Last active Mar 28, 2019
Parse query string. use Underscore.js.
View getQueryParams.js
* Parse query string.
* ?a=b&c=d to {a: b, c: d}
* @param {String} (option) queryString
* @return {Object} query params
getQueryParams: function(queryString) {
var query = (queryString ||; // delete ?
if (!query) {
return false;
isaacs /
Last active Jun 19, 2022
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at 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 | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh