Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<script src="http://jashkenas.github.io/underscore/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
@jacobroufa
jacobroufa / keybase.md
Created June 15, 2015 21:42
keybase.md

Keybase proof

I hereby claim:

  • I am jacobroufa on github.
  • I am jroufa (https://keybase.io/jroufa) on keybase.
  • I have a public key whose fingerprint is FB49 B12B 4FC5 1F6B C0A6 B029 7003 E302 3ABF 29BC

To claim this, I am signing this object:

@jacobroufa
jacobroufa / element-selection-noscript.html
Created September 13, 2015 16:22
DOM Element selection without jQuery
<html>
<body>
<header>
<h1>My Page</h1>
</header>
<section id="content">
<h2>Look at my web page!</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus et lobortis turpis. Nam et tellus quis odio vehicula lobortis. In semper augue sem, at vehicula sem convallis a. Donec ac tristique quam. Proin mattis sit amet mi in ultricies. Pellentesque rutrum iaculis odio et tincidunt. Quisque odio augue, egestas quis ex non, fermentum tempor ipsum. Cras efficitur et nunc ac venenatis. Ut vel ultrices lorem, et gravida nibh. Aenean et ornare diam. Pellentesque dapibus nisl dui, a interdum mauris efficitur quis. Mauris sed magna nec sapien venenatis scelerisque consectetur eu erat.</p>
<p>Etiam at fringilla turpis. Quisque vel risus nisi. Nunc efficitur erat eu sagittis hendrerit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tincidunt nunc odio, quis lobortis nunc molestie sed. Vestibulum molestie est iaculis urna pulvinar lobortis. Quisque te
@jacobroufa
jacobroufa / newbie.html
Last active September 15, 2015 14:48
Beginning of a simple quiz app
<!doctype html>
<html>
<head>
<title>Sample Quiz App</title>
</head>
<body style="text-align: center;">
<h2 id="question"></h2>
<div id="choices"></div>
<strong id="response"></strong>
# .bash_profile
umask 002
# Add git completion
if [ -f ~/git-completion.bash ]; then
source ~/git-completion.bash
fi
# Add __git_ps1
@jacobroufa
jacobroufa / gist:2315842
Created April 6, 2012 01:37
EFQ Randomized nodes by term
<?php
$results = array();
$terms = array(1, 2);
foreach ($terms as $tid) {
$result = NULL;
$query = new EntityFieldQuery;
$query
@jacobroufa
jacobroufa / FeedsYoutubeParser.php
Created April 18, 2012 01:18
Atom Parser to which I added playlist support logic
201 /**
202 * Parse Atom feed
203 *
204 * @param SimpleXMLElement $sxml
205 * @param FeedsFetcherResult $fetcher_result
206 * @param FeedsSource $source
207 */
208 private function parseAtom(SimpleXMLElement $sxml, FeedsSource $source, FeedsFetcher Result $fetcher_result) {
209
210
@jacobroufa
jacobroufa / gist:3281520
Created August 7, 2012 04:20
iterate over a tag, matching only certain attributes
39 // Iterate over each <category> tag, picking out only ones who's domain at
tribute matches post_tag
40 $tags = array();
41 foreach($post->category as $categories) {
42 if($categories['domain'] == 'post_tag') {
43 $tags[] = $categories;
44 }
45 }
46 // Does this even work??
47 echo implode(', ',$tags);
@jacobroufa
jacobroufa / editReadOnlyInputs.bookmarklet.js
Last active October 9, 2015 21:42
This is a bookmarklet for editing the value of inputs marked with the readonly attribute.
javascript:(function(){!function(){"use strict";function a(a){return a.attributes.readonly}function b(a){a.addEventListener("click",c)}function c(a){a.target.value=prompt("enter new value")}var d=document.getElementsByTagName("input"),e=Array.prototype.slice.call(d),f=e.filter(a);f.forEach(b)}();})();
@jacobroufa
jacobroufa / peoplecontroller_addstep.php
Last active December 11, 2015 06:19
add_setup and add_step methods for gtkm PeopleController.php
<?php
define('TMPDIR', WWW_ROOT . '/img/tmp/');
/**
* add_setup
*/
public function add_setup() {
$this->Session->delete('form');
App::uses('Folder', 'Utility');