Skip to content

Instantly share code, notes, and snippets.

s4wny / backend.php
Last active Nov 18, 2015
ajax autocomplete tutorial
View backend.php
$mysqli = new mysqli('localhost', 'test', 'test', 'test');
exit("Connect failed: %s\n". $mysqli->connect_error);
$stmt = $mysqli->prepare("SELECT name FROM states WHERE name LIKE ?");
if($stmt) {
s4wny /
Last active Oct 21, 2015
Install a ubuntu webserver
sudo apt-get update
sudo apt-get install nginx -y
s4wny / dell display manager command line documentation
Created Oct 10, 2015
dell display manager command line documentation
View dell display manager command line documentation
Dell Display Manager
Command language
A rich and flexible command language is supported via the
command-line, and command-line arguments can be combined.
Where appropriate, a specific display can be targeted by
prefacing the command with the display number, e.g.,
s4wny /
Last active Feb 14, 2016
Server setup
sudo apt-get update
## Security
# Only allow key based logins (BE SURE TO SET UP SSH KEYS BEFORE EXECUTING THIS)
sed -n 'H;${x;s/\#PasswordAuthentication yes/PasswordAuthentication no/;p;}' /etc/ssh/sshd_config > tmp_sshd_config
s4wny /
Last active Feb 8, 2017
Git hooks/post-receive
echo "Post-receive"
git --work-tree=$WORKSPACE checkout -f
s4wny / debug.php
Last active Aug 29, 2015
Debug function for PHP
View debug.php
// Source:
// Author: Mark Baker
* Skriver ut i det här formatet:
* *namnet på $var*:
* var_dump
s4wny / Haskell 99 problems.hs
Last active Aug 29, 2015
Haskell 99 problems.hs
View Haskell 99 problems.hs
import Data.List
import System.Random
import Control.Applicative
import Control.Monad.Writer
-- 1
myLast :: [a] -> a
myLast [x] = x
myLast (_:xs) = myLast xs
s4wny / haskell.sublime-build
Created Mar 29, 2015
Haskell buildsystem with error message for sublime text 3
View haskell.sublime-build
"cmd": ["runhaskell", "$file"],
"file_regex": "(\\w:[^:]+):([0-9]+):([0-9]+)",
"selector": "source.hs",
"path": "c:\\Program Files\\Haskell Platform\\2014.2.0.0\\bin\\"
s4wny / Animator.js
Last active Dec 26, 2015
Animate things without jQuery
View Animator.js
// Original code from
// Modified by Sony? aka Sawny
var Animator = {
// Uses "jQuery" style / standard style. So you can easly import easings from jQuery
// or other resources
// Format:
// percent | elapsed time | start value | end value | total duration
// x | t | b | c | d
s4wny / gist:6234637
Last active Dec 21, 2015
Sublimetext in the browser.
View gist:6234637

Copy and paste this into the browsers URL bar.

Protip: Bookmark it ;)

data:text/html,<link rel="shortcut icon" href=""/><title>:)</title><style type="text/css">#e{font-size: 16px; position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/javascript");</script>
You can’t perform that action at this time.