Skip to content

Instantly share code, notes, and snippets.

View sirkitree's full-sized avatar

Jerad Bitner sirkitree

View GitHub Profile
@sirkitree
sirkitree / 1.readme.md
Created February 26, 2013 19:44
Quickly incorporate AngularJS into Drupal. This example pulls in the top posts from reddit and spits out the titles in a list.
  1. Download Angular lib from http://angularjs.org/ and place in your theme's js folder.
  2. Create a controller.js file in your theme's js folder.
  3. Place the controller code included in this gist.
  4. Include the angular lib and the controll file into your theme using the theme's .info file.
  5. Modify your html.tpl.php by including the ng-app property to your <html> tag.
  6. Modify your page.tpl.php by including the ng-controller="TopPostCtrl" to your main <div> tag.
  7. Check out the example page.tpl.php in this gist to see a simple example of iterating over our list.
@sirkitree
sirkitree / app.js
Created January 26, 2013 15:45
Quick node script to import issues into GitHub. You'll want to `npm install github` first, which grabs http://github.com/ajaxorg/node-github
var path = require('path')
, PATH_CONFIG = path.join(__dirname, '/source.json')
, fs = require('fs')
, source = JSON.parse(fs.readFileSync(PATH_CONFIG, "utf8"))
, GitHubApi = require("github")
, github = new GitHubApi({version: "3.0.0"})
, auth-user = ""
, auth-pass = ""
, user = 'otcshare'
, repo = 'tizen.org'
@sirkitree
sirkitree / api.js
Created January 22, 2013 02:16
Sample code for validating captcha using express.session() and the captchagen module.
// POST
exports.addPost = function(req, res, next) {
// the user's answer
var theirCaptcha = req.body.captcha;
if (!theirCaptcha) {
return next("Missing captcha input");
}
if (theirCaptcha == req.session.captcha) {
// valid human
delete req.session.captcha;
@sirkitree
sirkitree / indexer.js
Created January 15, 2013 03:23
Simple indexing script. Run with node indexer > output.file
var Crawler = require("simplecrawler").Crawler;
// var myCrawler = new Crawler("jeradbitner.com");
var myCrawler = new Crawler("www.grammy.com");
// myCrawler.domain = "www.grammy.com";
myCrawler.supportedMimeTypes = [
/^text\//i
];
myCrawler.scanSubdomains = false;
myCrawler.ignoreWWWDomain = true;
// myCrawler.discoverResources = false;
@sirkitree
sirkitree / _breakpoints.scss
Created January 7, 2013 21:45
breakpoint mixins
/**
* This file contains breakpoints used for all browsers except IE7/8.
*/
@mixin breakpoint($point) {
@if $point == tall {
@media only screen and (min-width: 480px) {
$zen-column-count: 1;
$zen-gutter-width: 0;
@content;
}
@sirkitree
sirkitree / index.html
Created December 4, 2012 20:54
giframe
<html>
<body>
<script>
var D = document;
var w = Math.max(
Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
Math.max(D.body.clientWidth, D.documentElement.clientWidth)
);
@sirkitree
sirkitree / drushrc.php
Created November 6, 2012 12:36
Don't allow yourself to screw up with sql-sync to the production environment.
<?php
$options['shell-aliases']['syncdb'] = '!drush --verbose --yes sql-sync --create-db @pac12.prod @self';
@sirkitree
sirkitree / gist:3341061
Created August 13, 2012 14:06 — forked from deviantintegral/gist:3340625
Bookmarklet to show Yammer postings in chronological order
<a href="javascript:(function(){ul=jQuery('.yj-feed-messages');ul.children().each(function(i,li){ul.prepend(li)})})();">drag</a>
@sirkitree
sirkitree / gist:3290480
Created August 7, 2012 23:21
npm error installing jitsu
$ sudo npm install jitsu -g 1 ↵ ⚡(master*)
Password:
npm http GET https://registry.npmjs.org/jitsu
npm http 200 https://registry.npmjs.org/jitsu
npm http GET https://registry.npmjs.org/jitsu/-/jitsu-0.9.6.tgz
npm http 200 https://registry.npmjs.org/jitsu/-/jitsu-0.9.6.tgz
npm http GET https://registry.npmjs.org/complete/0.3.1
npm http GET https://registry.npmjs.org/dateformat/1.0.2-1.2.3
npm http GET https://registry.npmjs.org/colors/0.6.0-1
npm http GET https://registry.npmjs.org/flatiron-cli-config/0.1.3
@sirkitree
sirkitree / reset.sh
Created August 3, 2012 13:53
reset.sh
drush site-install lagra -y
drush upwd admin --password="admin"
drush fra --force -y
drush dis overlay -y
drush cc all
# Migrate taxonomy terms
drush lmi tag
drush lmi genre
drush lmi award