Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Custom configuration bootstrap file for ExpressionEngine
*
* Place config.php in your site root
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php
* If you have moved your site root you'll need to update the require_once path
*
@jokull
jokull / index.html
Created September 3, 2011 20:00
CoffeeScript Backbone Tumblr with JSONP
<html>
<head>
<script type="text/template" id="tpl-tumblr-post">
<% if(title){ %>
<h2 class="title">
<a href="<%= post_url %>"><%= title %></a>
</h2>
<% } %>
<%= body %>
@dux
dux / db-pull
Created November 13, 2011 00:04
MYSQL database pull from remote server (heroku like)
#!/bin/bash
FILE="/var/www/${1}.sql"
echo "Delete remote dump [${FILE}]"
ssh root@178.79.163.176 "rm -rf ${FILE}"
echo "Remote database dump"
ssh root@178.79.163.176 "mysqldump --user=root --password=XYZ ${1} > ${FILE}"
@desandro
desandro / requestanimationframe.js
Created February 19, 2012 23:29 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
/**
* requestAnimationFrame polyfill by Erik Möller & Paul Irish et. al.
* https://gist.github.com/1866474
*
* http://paulirish.com/2011/requestanimationframe-for-smart-animating/
* http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
**/
/*jshint asi: false, browser: true, curly: true, eqeqeq: true, forin: false, newcap: true, noempty: true, strict: true, undef: true */
@doitian
doitian / specs.js.coffee
Created March 12, 2012 19:33
3 ways to test ajax requests or other asynchronouse lib based on jquery deferred
# The second way is recommended, which is flexible, and also work for non jQuery ajax library.
# Setup sinon sandbox
beforeEach ->
@sinon = sinon.sandbox.create()
afterEach ->
@sinon.restore()
require 'resque/errors'
class DatabaseBackupJob
def self.perform(id, foo, bar)
# do backup work
rescue Resque::TermException
# write failure to database
# re-enqueue the job so the job won't be lost when scaling down.
Resque.enqueue(DatabaseBackupJob, id, foo, bar)
@desandro
desandro / jquery-layout-review.md
Created January 28, 2013 18:13
layout thrashing in jQuery
#http://stackoverflow.com/questions/4655194/simple-filtering-out-of-common-words-from-a-text-description
common = {}
STOPWORDS.each{|w| common[w] = true}
stopped = q.gsub(/\b\w+\b/){|word| common[word.downcase] ? '': word}.squeeze(' ')
return stopped
STOPWORDS = %w{ a
able
about
above
@sgnl
sgnl / _notes.md
Last active August 26, 2022 03:03
AJAX with Vanilla Javascript. (XMLHttpRequest)

Short XHR Examples

Examples shown are bare minimum needed to achieve a simple goal.

Resources

  • Google Chrome's Dev Tools' Network Panel c-c-c-c-c-ULTIMATE c-c-c-COMBO!!!
  • requestb.in enpoints for your HTTP Requests as a free service.
@benbabics
benbabics / route-test.js
Created September 13, 2016 00:04
Ember Mock Service
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
let mockSession = Ember.Service.extend({
isAuthenticated: true,
currentUser: Ember.computed('isAuthenticated', function() {
return Ember.RSVP.Promise(function(resolve) {
resolve( Ember.Object.create({ accounts: [] }) );
});
})