Skip to content

Instantly share code, notes, and snippets.

View nqthqn's full-sized avatar
🍐
pear programming

Nate nqthqn

🍐
pear programming
View GitHub Profile
@nqthqn
nqthqn / gist:7297698
Last active December 27, 2015 08:39
PHP: PDO Database CRUD
<?php
// CREATE
try {
$pdo = new PDO('mysql:host=localhost;dbname=someDatabase', $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->prepare('INSERT INTO someTable VALUES(:name)');
$stmt->execute(array(
':name' => 'Justin Bieber'
@nqthqn
nqthqn / gist:7323959
Created November 5, 2013 18:46
Foundation: TopBar
<nav class="top-bar">
<ul class="title-area">
<!-- Title Area -->
<li class="name">
<h1><a href="#">The Title</a></h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>
@nqthqn
nqthqn / gist:7365514
Created November 8, 2013 02:47
HTML: Doctype
<!DOCTYPE html>
<html>
<head>
<title>PHP Markdown Lib - Readme</title>
</head>
<body>
<?php
# Put HTML content in the document
echo $html;
?>
@nqthqn
nqthqn / auth.py
Created August 28, 2014 20:14 — forked from ibeex/auth.py
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%s@xxx.xx' % username
@nqthqn
nqthqn / gist:853ad6f56cb88c57184b
Created September 7, 2014 01:34
cat /Users/nathann/code/ipals/env/bin/grunt#!/Users/nathann/code/ipals/env/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'grunt==0.1.1','console_scripts','grunt'
__requires__ = 'grunt==0.1.1'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('grunt==0.1.1', 'console_scripts', 'grunt')()
)
@nqthqn
nqthqn / bahumbug
Created September 7, 2014 02:36
for aaron
{
"_index": "logstash-2014.09.07",
"_type": "apachelog",
"_id": "ol9eYzadQ7OO__H_NCDuWw",
"_score": 1.3266282,
"_source": {
"message": "98.234.57.119 - - [06/Sep/2014:19:34:02 -0700] \"GET /video/upload/ HTTP/1.1\" 418 789 \"-\" \"videoUploader/.01 (iPad; iOS 7.1; Scale/1.00)\"",
"@version": "1",
"@timestamp": "2014-09-07T02:34:03.284Z",
"type": "apachelog",
@nqthqn
nqthqn / howto.md
Created September 7, 2014 16:31
fork, upstream, remotes oh my!

#How to fork & clone

Go here and click "fork". This will basically make a copy of the repo for you. Then you can work completely in your own version.

git clone https://github.com/<username>/ipals.git

From there you can edit, add, commit, push, branch, etc.

#How to stay up to date with upstream

@nqthqn
nqthqn / render_leaves.js
Created September 10, 2014 22:38
an idea
function Leaf(){
this.type; // 'active', 'seen', 'unseen'
this.position; // [300,2311,45] (x,y,degree) degree in range 0...360
this.link; // '/program/page/13'
this.num; // 4
}
var l1 = new Leaf();
l1.type = 'active';
l1.position = [200,400,45];
@nqthqn
nqthqn / rosettaRecall.md
Last active August 29, 2015 14:06
Language translation

Steps

  • pip install django-rosetta and add to apps in settings
  • Add the url:
    if 'rosetta' in settings.INSTALLED_APPS:
        urlpatterns += patterns('',
            url(r'^rosetta/', include('rosetta.urls')),
        )
@nqthqn
nqthqn / githubdeploy.md
Last active August 29, 2015 14:06
public/private key generation
  • ls -la ~/.ssh/
  • ssh-keygen -t rsa -C "your_email@example.com"
  • cat ~/.ssh/id_rsa.pub

Copy that public key to github here

  • git clone git@github.com:<owner>/<repo>.git

Learn more here