Skip to content

Instantly share code, notes, and snippets.

View DanielSwensson's full-sized avatar
🤔

Daniel Swensson DanielSwensson

🤔
View GitHub Profile
@DanielSwensson
DanielSwensson / DBManager.swift
Last active August 29, 2015 14:02
Generic Swift CoreData db interface
import UIKit
import CoreData
class DBManager {
let appDel:AppDelegate;
let context:NSManagedObjectContext;
init(){
self.appDel = UIApplication.sharedApplication().delegate as AppDelegate
<snippet>
<content><![CDATA[
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
@DanielSwensson
DanielSwensson / Sublime - shortcuts
Created June 4, 2013 19:23
Sublime text 2 shortcuts
[
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" },
{
"keys": ["ctrl+alt+left"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.33, 1.0],
"rows": [0.0, 1.0],
@DanielSwensson
DanielSwensson / bootstrap - login
Created June 4, 2013 16:08
Generic bootstrap login
<?= validation_errors(); ?>
<form action="<?= site_url("admin/login") ?>" method="post" class="form-signin well">
<h2 class="form-signin-heading">Logga in</h2>
<div id="#" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
@DanielSwensson
DanielSwensson / PHP - Password
Last active July 16, 2019 11:47
codeigniter class to encrypt and decrypt user passwords for authentication
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Password{
//Number of times to rehash
private $rotations = 0 ;
function encrypt_password($password, $username){
$salt = hash('sha256', uniqid(mt_rand(), true) . "somesalt" . strtolower($username));