Skip to content

Instantly share code, notes, and snippets.

View lukedesu's full-sized avatar
🏠
Working from home

Luke Luo lukedesu

🏠
Working from home
  • Singapore
  • 08:49 (UTC +08:00)
View GitHub Profile
@ferenczy
ferenczy / atom-get-lost-unsaved-buffers.js
Last active May 29, 2024 21:09
Get lost unsaved buffers in Atom editor: Load text content of all unsaved buffers stored by Atom for any project and print it to Developers tools console
/**
* Get lost unsaved buffers in Atom editor
*
* Load text content of all unsaved buffers stored by Atom for any project in IndexedDB and print it to Developers tools console
*
* Author: David Ferenczy Rogožan (https://ferenczy.cz)
*
* Instructions:
*
* 1. Start Atom
@otiai10
otiai10 / golang_jwt_example.go
Last active May 25, 2021 15:47
Golang JWT Example (2017/Oct/26)
package main
import (
"log"
jwt "github.com/dgrijalva/jwt-go"
)
type User struct {
Name string `json:"name"`
@uorat
uorat / nginx-websocket-proxy.conf
Last active September 26, 2024 15:57
Nginx Reverse Proxy for WebSocket
upstream websocket {
server localhost:3000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/websocket.access.log main;
export const GoogleApi = function(opts) {
opts = opts || {}
const apiKey = opts.apiKey;
const libraries = opts.libraries || [];
const client = opts.client;
const URL = 'https://maps.googleapis.com/maps/api/js';
const googleVersion = '3.22';
let script = null;
//
// ViewController.swift
// starWarsTableViewUpdates
//
// Created by Christina Moulton on 2015-10-17.
// Copyright (c) 2015 Teak Mobile Inc. All rights reserved.
//
import UIKit
@brianmacarthur
brianmacarthur / flash-app.js
Last active September 14, 2024 17:22
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
@gubatron
gubatron / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md
Last active October 12, 2024 22:57
How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

Let's say alice is a github.com user, with 2 or more private repositories repoN. For this example we'll work with just two repositories named repo1 and repo2

https://github.com/alice/repo1

https://github.com/alice/repo2

You need to be to pull from these repositories without entering a passwords probably on a server, or on multiple servers.

@colingourlay
colingourlay / example.js
Last active October 22, 2021 15:16
Lodash / Underscore sort object keys. Like _.sortBy(), but on keys instead of values, returning an object, not an array. Defaults to alphanumeric sort.
var obj = {b: 3, c: 2, a: 1};
_.sortKeysBy(obj);
// {a: 1, b: 3, c: 2}
_.sortKeysBy(obj, function (value, key) {
return value;
});
// {a: 1, c: 2, b: 3}
@Kartones
Kartones / postgres-cheatsheet.md
Last active November 15, 2024 21:14
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)