Skip to content

Instantly share code, notes, and snippets.

View Integralist's full-sized avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@JeffreyWay
JeffreyWay / reflection.php
Created March 19, 2013 15:31
Test PHP protected/private methods with ease using Reflection.
<?php
// ...
public function testProtected()
{
$dateFormatter = new DateFormatter;
$class = new \ReflectionClass('DateFormatter');
@danscotton
danscotton / sass_spec.rb
Created March 3, 2013 14:15
custom sass directives rspec
require "sass"
# this just simplifies css comparison
class String
def format_css
self.strip.split(/\n/).select { |line| line.strip!; !line.empty? }.join('\n')
end
end
describe "Sass to CSS" do
@madrobby
madrobby / date.rb
Created February 15, 2013 17:37
`Date.parse` with some extra leeway to handle user input errors. Handles things like `2013-02-31` (parses it as `2013-02-29`) and handles things in general like users would expect.
module Freckle
module Date
class << self
def parse(string)
raw = string.to_s.strip
return nil if raw.empty?
begin
# reverse order if we encounter "European" formatting
@daneden
daneden / gist:4267775
Created December 12, 2012 13:37
[FIXED: See comments] I'm using rems for a lot of the layout for a site I'm working on—mostly font-size and margin-bottoms—and I'm having a bit of trouble mixing values. In the example below, the expected output would give a font-size value of 30px, but instead gives 30%px. Any ideas?
$base-font-size: 125%;
@mixin rem-font-size($sizeValue: 1){
font-size: ($sizeValue * (16 * ($base-font-size / 100))) + px;
font-size: $sizeValue + rem;
}
@mixin rem-margin-bottom($sizeValue: 1){
margin-bottom: ($sizeValue * (16 * ($base-font-size / 100))) + px;
margin-bottom: $sizeValue + rem;
@Integralist
Integralist / input.scss
Created November 22, 2012 07:55 — forked from kaelig/input.scss
Extending placeholder selectors within media queries
%myclass {
color: blue;
@media (min-width: 600px) {
background: red;
}
@media (min-width: 800px) {
font-size: 28px;
}
}
@oyvindkinsey
oyvindkinsey / README.md
Created November 20, 2012 22:27
Core implementation needed for ES5 to ES3 transforms using 'jspatch'

Core implementation needed for ES5 to ES3 transforms using 'jspatch'

  1. Install jsgrep
  2. Convert your source code using node spatch-cli.js es5-to-es3.spatch source.js // yields the converted source
  3. Prepare the implementation of ES5 by implemeting the missing polyfills in es5.js
  4. Concat es5.js and the converted code
  5. Wrap the result of the previous steps in a closure and export your object
@AvnerCohen
AvnerCohen / npm-cheat-sheet.md
Last active August 18, 2024 08:34
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

List of less common (however useful) NPM commands

Prepand ./bin to your $PATH

Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@gfranko
gfranko / app.build.js
Last active October 12, 2015 14:58
Backbone-Require-Boilerplate (BRB) Mobile and Desktop Build Configuration with almond.js
// Node.js - Require.js Build Script
// To run the build type the following: node app.build.js
// Loads the Require.js Optimizer
var requirejs = require('../public/js/libs/r.js');
// Sets up the basic configuration
var baseConfig = {
@sdepold
sdepold / LICENSE.txt
Created August 15, 2012 05:50 — forked from 140bytes/LICENSE.txt
140byt.es -- addObserverMethods
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Sascha Depold http://depold.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: