Skip to content

Instantly share code, notes, and snippets.

View mocon's full-sized avatar

Myles O'Connor mocon

View GitHub Profile
@0xjmp
0xjmp / home_ctlr.js
Last active August 29, 2015 14:14
An example of a unit test (jasmine) of a service and controller
// You would still need to define this in a module
// for it to work in a real world environment.
this.HomeCtlr = function($scope, Project) {
$scope.search = function(query) {
$scope.projects = Project.search({query: query});
};
};
@fta2012
fta2012 / DragTransform
Last active May 1, 2024 21:15
Slightly modified compiled coffeescript from this codepen: http://codepen.io/fta/pen/ifnqH. Paste into console on a page that has jQuery to load the two dependent libraries (jquery-ui and numericjs). Then call makeTransformable('#selector-name') to make that element WYSIWYG editable. Use inspector to get the CSS for the transforms.
var selector = 'img' // Replace this with the selector for the element you want to make transformable
jQuery.getScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', function() {
jQuery.getScript('//cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js', function() {
(function() {
var $, applyTransform, getTransform, makeTransformable;
$ = jQuery;
@the-david
the-david / compile_and_install_phalcon_mamp.md
Created April 27, 2014 06:04
Compile and Install Phalcon for MAMP on OS X
  • Find the path to your MAMP PHP bin directory. This is located in the MAMP folder within the Applications directory.
/Applications/MAMP/bin/php/phpx.x.x/bin
  • Open Terminal and run the following command.
  • Note: Replace phpx.x.x with the version you're targeting (e.g. php5.5.10).
export PATH=/Applications/MAMP/bin/php/phpx.x.x/bin:$PATH
package ca.uwo.csd.cs2212.USERNAME;
public class BankAccount {
private double balance;
public BankAccount(double balance) {
this.balance = balance;
}
@jjmu15
jjmu15 / in_viewport.js
Created January 27, 2014 10:19
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@wookiecooking
wookiecooking / cheatsheet.md
Last active December 17, 2015 07:29
[WordPress] cheatsheet

WordPress Cheatsheet

Below you will find snippets to help you through developing a wordpress template, hope it helps :)

####get the home URL <?php echo get_option('home'); ?>

####display the blog description <?php bloginfo('description'); ?>

@19h
19h / reset.js
Created February 19, 2013 22:51
Node.js — Clear Terminal / Console. Reset to initial state.
console.reset = function () {
return process.stdout.write('\033c');
}