Skip to content

Instantly share code, notes, and snippets.

View kenng's full-sized avatar
💭
calm

Ken Ng kenng

💭
calm
View GitHub Profile
anonymous
anonymous / markdown-folding.vim
Created November 26, 2012 18:41
A simple demo of how a foldexpr works in Vim. See http://vimcasts.org/e/28 for full explanation.
function! MarkdownFolds()
let thisline = getline(v:lnum)
if match(thisline, '^##') >= 0
return ">2"
elseif match(thisline, '^#') >= 0
return ">1"
else
return "="
endif
endfunction
@jentanbernardus
jentanbernardus / index.html
Created February 6, 2013 17:27
A CodePen by Jentan Bernardus. jQuery Countdown
<!-- Countdown dashboard start -->
<div id="countdown_dashboard">
<!--<h1>jQuery Countdown</h1>-->
<hr class="light">
<div class="dash weeks_dash">
<span class="dash_title">weeks</span>
<div class="digit">4</div>
<div class="digit">6</div>
</div>
@drewolson
drewolson / reflection.go
Last active November 21, 2024 15:11
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@jshaw
jshaw / byobuCommands
Last active April 25, 2025 06:20
Byobu Commands
Byobu Commands
==============
byobu Screen manager
Level 0 Commands (Quick Start)
------------------------------
<F2> Create a new window
@johan
johan / README.md
Last active November 6, 2021 14:09 — forked from NV/Readme.md
JS debug breakpoint / log snippets

stopBefore.js

2min screencast

These tools inject a breakpoint, console.log or console.count in any function you want to spy on via stopBefore('Element.prototype.removeChild') or ditto stopAfter, logBefore / logAfter / logAround / logCount.

Works in Chrome DevTools and Safari Inspector; Firefox dev tools reportedly less so.

@msurguy
msurguy / eloquent.md
Last active February 8, 2022 03:13
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active April 20, 2025 17:02
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@itsderek23
itsderek23 / mariadb-galera.markdown
Last active May 16, 2016 11:01
The High Availability Switch: from MySQL+MMM to MariaDB+Galera Cluster

The High Availability Switch: from MySQL+MMM to MariaDB+Galera Cluster

Kevin Lawver, President @ [Rails Machine](https://railsmachine.com), is our guest author for this post.

Few things feel worst than rolling out a High Availability (HA) system, then regularly seeing that system collapse. For our team at Rails Machine, this failing HA system was MySQL Multi-Master Replication Manager (MMM).

We've been searching for a MMM replacement for a while, and a few months ago, we made the switch to MariaDB + Galera Cluster for High Availability MySQL. What's wrong with MySQL MMM? What's special about Galera Cluster? Read on!

@plentz
plentz / nginx.conf
Last active April 30, 2025 08:40
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@JeffreyWay
JeffreyWay / .vimrc
Last active November 1, 2024 18:35
My .vimrc file
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15