Skip to content

Instantly share code, notes, and snippets.

View n00ge's full-sized avatar
💭
Writing code at The Futures App

Chad Calhoun n00ge

💭
Writing code at The Futures App
View GitHub Profile
@n00ge
n00ge / tables.sql
Created July 11, 2024 22:27
tables.sql
"table_catalog","table_schema","table_name","table_type","self_referencing_column_name","reference_generation","user_defined_type_catalog","user_defined_type_schema","user_defined_type_name","is_insertable_into","is_typed","commit_action"
"cc_db","public","django_migrations","BASE TABLE",,,,,,"YES","NO",
"cc_db","public","core_exercise","BASE TABLE",,,,,,"YES","NO",
"cc_db","public","django_content_type","BASE TABLE",,,,,,"YES","NO",
"cc_db","public","auth_permission","BASE TABLE",,,,,,"YES","NO",
"cc_db","public","auth_group","BASE TABLE",,,,,,"YES","NO",
"cc_db","public","auth_group_permissions","BASE TABLE",,,,,,"YES","NO",
"cc_db","pg_catalog","pg_statistic","BASE TABLE",,,,,,"YES","NO",
"cc_db","pg_catalog","pg_type","BASE TABLE",,,,,,"YES","NO",
"cc_db","public","core_user_groups","BASE TABLE",,,,,,"YES","NO",
@n00ge
n00ge / sample.ts
Last active July 6, 2017 17:05
sample
import { Epic } from 'services/store';
import { Observable } from 'rxjs/Observable';
import * as api from 'services/api';
import * as apiStore from 'services/api-store';
import { getMessagesForDirectMessage } from 'services/messaging';
import * as reducer from './reducer';
function removeArchivedDirectMessages(resources: api.jsonApi.Resource<any, any>[]) {
return resources.filter(
@n00ge
n00ge / meetup_icon_count_widget.html
Last active August 29, 2015 14:12
Meetup.com icon and count widget
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="local.js"></script>
<script src="api_key.js"></script>
<script id="config" type="text/javascript" charset="utf-8">
var $parameters = {
urlname: "hgskiclub",
@n00ge
n00ge / router.rb
Created May 19, 2014 12:14
Router class for creating accessible routes from anywhere in Rails
class Router
include Rails.application.routes.url_helpers
def self.default_url_options
ActionMailer::Base.default_url_options
end
end
@n00ge
n00ge / Muukii.tmTheme
Created May 11, 2014 12:36
Muukii.tmTheme Customized
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>gutterSettings</key>
<dict>
public function push()
{
foreach ($this->builtParentAssociations as $association => $model) {
if (! $model->save) {
return false;
}
// get foreign key for association off $this association and assign $model->getKey()
}
if (! parent::push()) {
@n00ge
n00ge / convertTwoSpacesToFour.sublime-macro
Created October 8, 2013 17:17
Convert two spaces to four in sublime text
[
{
"args": null,
"command": "select_all"
},
{
"args":
{
"set_translate_tabs": true
},
@n00ge
n00ge / BaseEloquent.php
Created October 3, 2013 20:44
Dynamic relationships in Eloquent with Laravel 4
<?php
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Model as Eloquent;
abstract class BaseEloquent extends Eloquent
{
protected $associations = array();
protected static $SINGULAR_COLLECTION_TYPES = array(
@n00ge
n00ge / gist:6795818
Last active December 24, 2015 12:09
Laravel 4 dynamic relation definitions
/// SampleModel
class SampleModel extends BaseEloquent
{
protected $table = 'sample_models';
protected $associations = array(
'publishingRule' => array(
'belongsTo' => 'PublishingRule'
),
'previewImage' => array(
@n00ge
n00ge / gist:6779758
Last active December 24, 2015 09:49 — forked from JonoB/gist:6637861
A fix for unique validation when updating models in Laravel 4
<?php namespace Tmb;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Validation\Validator;
class BaseModel extends Eloquent
{
/**
* Error message bag