Skip to content

Instantly share code, notes, and snippets.

@czottmann
czottmann / wordpress-to-tumblr.rb
Created October 14, 2009 20:14
Parses a Wordpress XML export file and imports the posts into Tumblr. See http://blog.zottmann.org/post/213103984/the-big-blog-move-on-2009 for info.
#!/usr/local/bin/ruby
require "hpricot"
require "net/http"
require "uri"
TUMBLR_USER = "user@example.com"
TUMBLR_PASS = "thepasswordlol"
TUMBLR_DOMAIN = "mytumblrsubdomain.tumblr.com"
ORIGINAL_DOMAIN = "http://myoriginaldomain.example.com/"
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
@rafamvc
rafamvc / <controller_name>.js
Created February 16, 2012 16:02
How I render my page specific JS
// On the page specific file:
// "<controller_name>.js", and you import it after the init.js on your application.js
// Replace the <controller_name> with the actual name
RELASPHERE.<controller_name> = {
init: function() {
// Your shared code for the whole controller goes here
},
index: function() {
// Your code for the index page goes here
@idibidiart
idibidiart / GraphQL-Relay-HN.md
Last active February 16, 2016 02:21
GraphQL/Relay
import globalNavigation from './components/GlobalNavigation/reducer';
import tabs from './components/ApplicationTabs/reducer';
import feed from './components/Feed/reducer';
import { combineReducers } from 'redux-immutable';
const scopeNavigationReducer = (reducer, scopeName) => {
return (state, action) => {
if (action.scope && action.scope !== scopeName) {
return state;
} else {
/**
* A redux middleware for processing Meteor methods
* When an action is dispatched, it will pass through our middleware.
* if denoted a method, we will dispatch the action with readyState of loading
* The method passed in is then called, and dispatches further ready states for success/error
* The reducer shape should include { data, readyState } for use in the UI
* @returns {Function}
*/
export default function methodMiddleware() {
return (next) => {
@debprado
debprado / rails.history.js
Created January 3, 2012 19:04 — forked from nragaz/rails.history.js
Add callbacks to remote links in Rails to manage browser history using pageState and replaceState
function historySupport() {
return !!(window.history && window.history.pushState !== undefined);
}
function pushPageState(state, title, href) {
if (historySupport()) {
history.pushState(state, title, href);
}
}
@machty
machty / router-js-refactor-architecture.md
Last active July 31, 2019 18:39
Overview of the architecture and approach to the router.js refactor

router.js Architecture

Let this serve as a guide for anyone who'd like to dig into router.js's internals, understand what's going on, and hopefully contribute!

Scope of router.js (et al)

router.js is most popularly known as the routing microlib used by the Ember.js Router, though other folk have been known to use it beyond Ember, including some Angular folk who weren't satisfied with

@tkarpinski
tkarpinski / github_issues_to_csv.rb
Created April 12, 2012 18:09 — forked from henare/github_issues_to_csv.rb
Exports Github issues to CSV (API v3)
require 'octokit'
require 'csv'
require 'date'
# Github credentials to access your private project
USERNAME="USER_NAME"
PASSWORD="SEKRIT"
# Project you want to export issues from
USER="REPO_OWNER"
PROJECT="REPO_NAME"
@javan
javan / application_controller.rb
Created November 30, 2013 22:06
Prevent cross-origin js requests
class ApplicationController < ActionController::Base
before_filter :ensure_xhr
private
def ensure_xhr
if request.get? && request.format && (request.format.js? || request.format.json?)
head :forbidden unless request.xhr?
end
end
end