Skip to content

Instantly share code, notes, and snippets.

View lefnire's full-sized avatar

Tyler Renelle lefnire

View GitHub Profile
@hedgehog
hedgehog / api_wrapper_spec.rb
Created November 29, 2011 20:30 — forked from mrchrisadams/api_wrapper_spec.rb
Using webmock and VCR together
describe ApiWrapper::Connection, "with retry enabled" do
before(:each) do
# connect to api
# the @api_wrapper object persists, across all the responses, and we set the number of retries
# on the ApiWrapper::Connection#get method here too, for when we call it further down in the spec.
@api_wrapper = ApiWrapper::Connection.new('stage.api_wrapper.com', APIWRAPPER_V2_API_KEY, APIWRAPPER_V2_PASSWORD, :retries => 2)
VCR.use_cassette("ApiWrapper_Connection/v2/raising unhandled errors") do
@lefnire
lefnire / gist:1854789
Created February 17, 2012 18:45
InsertNode 7 Snippet (requires token_filter)
<?php
/**
* Implements hook_tokens().
* This is used to insert nodes or node-tokens into content with token_filter,
* @see http://drupal.org/node/902244#comment-5616694
*/
function sharpe_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
@jeserkin
jeserkin / gist:1953801
Created March 1, 2012 22:50
Twitter Bootstrap Fluid-Sticky example. Modified martinbean example.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="../assets/css/bootstrap.css" rel="stylesheet">
<style type="text/css">
@simenbrekken
simenbrekken / README.md
Created March 8, 2012 06:39
Super simple Backbone + Express + MongoDB REST backend application

Requirements:

If you're on OSX you're probably best off using Homebrew to install this stuff:

$ brew install node mongodb

Usage:

@vidoss
vidoss / gist:2178987
Created March 24, 2012 06:20
Using underscore.js while scripting mongodb shell.
MongoDB provides a Javascript shell. But Javascript is no fun without underscore.js
Turned out its straight forward to use underscore.js while scripting mongodb.
Here are the steps.
1) Use underscore to write your db script file (say my_commands.js)
E.g: _.each(db.dbname.find().toArray(), function(itm) { ... })
@basicallydan
basicallydan / gulpfile.js
Created February 12, 2014 07:06
Gulpfile for PhoneGap App on Ripple using Browserify
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var styl = require('gulp-styl');
var path = require('path');
var o = require('open');
var ripple = require('ripple-emulator');
var webPath = function (p) { return path.join('./www/', p); };
// Builds the scripts based on a single entry point using browserify
@denji
denji / README.md
Last active August 26, 2024 23:22 — forked from istepanov/gist:3950977
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
@jeffwhelpley
jeffwhelpley / gist:10041806
Last active August 29, 2015 13:58
Isomorphic JavaScript Templates

I am in the process of building an isomorphic JavaScript framework and I need some help deciding between two options for our templates.

I have two different strategies I am trying to choose between. I have both working and functionally either will be fine, but thing in particular I am trying to think about now is which one would be easier to grok and more accepted by developers/contractors we hire or community members we get to help out on open source pieces.

Note: both options using our jeff.js templating lib which is essentially JavaScript/JSON instead of HTML.

Option 1 - Node Style

The basic idea here is to have Node functions that are used to either bind data on the server side or generate HTML for the client side. For ex:

@keeth
keeth / Select.js
Last active December 29, 2017 11:38
A formsy-react wrapper around React Select (ES6)
import React from 'react';
import Formsy from 'formsy-react';
import ReactSelect from 'react-select';
import './Select.less';
const Select = React.createClass({
mixins: [Formsy.Mixin],