Skip to content

Instantly share code, notes, and snippets.

View .env.local.php
<?php
return array(
'encryption_key' => 'Z87H4w0Ak5mbmx56ScnUW2xeJkY2qvEG',
'mysql_user' => 'homestead',
'mysql_password' => 'secret',
'mysql_host' => 'localhost'
);
@igustafson
igustafson / reddit_ajax.js
Last active Aug 30, 2019
Reddit API AJAX Request Example Using jQuery
View reddit_ajax.js
var searchTerm = 'cats';
$.ajax(
"https://www.reddit.com/subreddits/search.json",
{
data: { q: searchTerm },
success: function(responseData) {
if (responseData.data.children.length > 0) {
console.log('# of results: ' + responseData.data.children.length);
$.each(responseData.data.children, function(idx, searchResult) {
View extend.extend.coffee
var EditView = Sagamore.Views.ModelForm.extend({
fields: [
{name: "login", label: "Username"},
{name: "password", label: "Password"}
]
}).extend(Sagamore.Lib.ModalForm)
View view.coffee
class Sagamore.Views.ModuleMenu extends Sagamore.View
initialize: (menu) ->
@menu = menu
render: ->
@igustafson
igustafson / menu.coffee
Created May 4, 2011
Menu Building Code
View menu.coffee
Menu = Sagamore.Models.Menu
Entry = Sagamore.Models.Menu.Entry
topMenu = new Menu
entries: [
new Entry title: 'Customers', url: '#/customers'
new Entry title: 'Sales', url: '#/sales'
]
moduleMenus =
@igustafson
igustafson / settings.snippet.coffee
Created May 3, 2011
Settings TableView with delete link
View settings.snippet.coffee
class TableView extends Sagamore.Views.CollectionTable
className: "settings"
fields: [
{id: 'actions', title: '', render: (options) ->
$('<a href="#" class="delete">Delete</a>').click ->
if confirm("Are you sure you want to delete user '" + options.model.get("login") + "'?")
options.model.destroy
}
{id: 'id', title: 'Name', sort: true, template: idTemplate}