Skip to content

Instantly share code, notes, and snippets.

View koraysels's full-sized avatar

Koray S. koraysels

View GitHub Profile
@yratof
yratof / plotting.md
Created August 8, 2019 07:24
HPGL Plotting
@sixhat
sixhat / sketch.js
Last active November 26, 2022 07:56
Webgl 3D Picking in P5js with Colour Buffer
/*
Webgl 3D Picking in P5js with Colour Buffer
18 May 2017
David R. <david at the domain of sixhat dot net>
*/
var pg;
var img;
function preload() {
img = loadImage('cat.jpg');
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@aendra-rininsland
aendra-rininsland / activate_plugin.php
Created August 13, 2014 00:42
Install Bower dependencies on WordPress plugin activation
<?php
register_activation_hook(__FILE__, 'activate_my_plugin');
function activate_my_plugin() {
// Some basic securifying
if ( ! current_user_can( 'activate_plugins' ) )
return;
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : '';
check_admin_referer( "activate-plugin_{$plugin}" );
@sandcastle
sandcastle / iptables.sh
Last active April 30, 2018 12:55
Default firewall configuration using iptables for a fresh Ubuntu 14.04 server.
#!/bin/sh -x
# ==================================
# iptables default configuration script
#
# - this locks down our servers port access
# ==================================
# install fail2ban
sudo apt-get update
@JedWatson
JedWatson / KeystoneApiExample.md
Last active July 26, 2021 11:29
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ 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 http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh