Skip to content

Instantly share code, notes, and snippets.

View jongacnik's full-sized avatar

Jon jongacnik

View GitHub Profile
@jongacnik
jongacnik / regex_css
Created September 11, 2017 04:55 — forked from hekt/regex_css
RegEx for parsing CSS
(# comment )
(/\*(?:(?!\*/)[\s\S])*\*/)
(/\*(?:[^*]|\*[^/])*\*/)
(# @keyframes-rule )
(@(?:-webkit-|-moz-)?keyframes(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)+[a-zA-Z0-9_\-]+(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*{(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*(?:(?:from|to|[0-9]{1,3}%)(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*{(?:[^{}"']|/\*(?:(?!\*/)[\s\S])*\*/|'[^']*'|"[^"]*")*}(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*)+(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*})
(# ruleset )
((?:[^{}"']|'[^']*'|"[^"]*")+(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*{(?:[^{}"']|/\*(?:(?!\*/)[\s\S])*\*/|'[^']*'|"[^"]*")*})
@jongacnik
jongacnik / simple-wp-adjacent-post.php
Created July 20, 2017 00:48
Simple WP Adjacent Post
<?php
function get_adjacent_post_basic ($direction = 'prev', $date = '') {
global $wpdb, $post;
if( empty( $date ) )
$date = $post->post_date;
$operator = $direction == 'prev' ? '<' : '>';
$order = $direction == 'prev' ? 'DESC' : 'ASC';
<?php
add_action('acf/init', 'register_post_fields');
function register_post_fields () {
$location = [
[
[
'param' => 'post_type',
'operator' => '==',
var html = require('choo/html')
var choo = require('choo')
var app = choo()
app.route(mainView)
app.mount('body')
function mainView () {
return html`<body>hello world</body>`
}
var byo = require('byo')
var preact = require('preact')
var hyperx = require('hyperx')
exports.framework = function () {
return byo({
mount: function (tree, root) {
return preact.render(tree, root)
},
render: function (tree, newTree, root) {
@jongacnik
jongacnik / build-script
Created April 18, 2017 18:38
design.js
// can pipe stdout into autoprefixer, minifier, etc etc etc
node design.js > dist/bundle.css
@jongacnik
jongacnik / inferno.js
Last active April 11, 2017 23:42
choo renderers
var Inferno = require('inferno')
var hyperx = require('hyperx')
var html = hyperx(require('inferno-create-element'))
function infernoRenderer (state, emit, renderer) {
renderer.render = function (tree, newTree, root) {
return Inferno.render(newTree, root)
}
renderer.mount = function (tree, root) {
return Inferno.render(tree, root)
@jongacnik
jongacnik / example.js
Created April 9, 2017 23:35
preact + hyperx
var { h, Component } = preact;
var hx = hyperx( (tag, props, kids) => h(tag, props, ...kids) );
var App = () => hx`
<div id="app">
${h(Demo)}
</div>
`;
@jongacnik
jongacnik / FF.php
Created March 16, 2017 23:38 — forked from pimdh/FF.php
Functional PHP Framework
<?php
function route($pattern, $controller)
{
return function($query) use($pattern, $controller) {
return (($matches = route_match($pattern, $query)) === false) ?
false :
function($registry) use($matches, $controller) {
return $controller($matches, $registry);
}
;

Digital Ocean - New LAMP Instance To-Dos

  • Make a droplet using LAMP Instance

  • Add a new user (i.e. deployer)

    adduser deployer
    
  • Add the new user to sudo group