Skip to content

Instantly share code, notes, and snippets.

View AdamBrodzinski's full-sized avatar

Adam Brodzinski AdamBrodzinski

View GitHub Profile
@mattmccray
mattmccray / AnimationMixin.js
Created March 10, 2015 07:22
React AnimationMixin - for Animate.css
// Extracted from a live application. Known to work with latest Chrome/Firefox
// and Animate.css. (IE untested)
export let AnimationMixin= {
playAnimation( animation='pulse', speed=1000) {
if(! this.isMounted()) {
log.warn( "Trying to call .playAnimation() on an unmounted component!")
return
}
@nrrrdcore
nrrrdcore / divider.css
Created August 29, 2012 05:35
FireFox Friendly Faded Gradient Border CSS
.divider {
float: right; /* float this next to ur linkz */
display: block;
height: 47px; /* this */
width: 1px; /* where the magic happens */
margin: -7px 6px 0 10px; /* pulls the border to the top of the header */
background-image: -webkit-linear-gradient(top, rgba(0,93,131,.5) 50%, rgba(0,93,131,.22) 100%); /* good in safari & chrome */
background-image: -moz-linear-gradient(top, rgba(0,93,131,.5) 50%, rgba(0,93,131,.22) 100%); /* firefox friendly shit */
box-shadow: 1px 0 0 0 rgba(255,255,255,.1); /* white highlight on the inside of the border, ff now accepts this w/o a prefix */
@zol
zol / gist:5469228
Created April 26, 2013 18:12
WIP cordova In App Browser wrapper.
IAB = {
closed: true, //for meteor to detect closed state
open: function(url, cb, goalURL) {
var that = this;
cordova.exec(function(params) {
switch (params.type) {
case 'loadstart':
console.log('IAB: loadstart url, ' + params.url);
@zol
zol / gist:6643666
Created September 20, 2013 20:45
Restore a dumped mongodb into local meteor development db
mongorestore --port 3002 --drop --db meteor ./dump/verso/
@xpressivecode
xpressivecode / iron-router-resource.js
Last active December 24, 2015 14:38
Sample for routing resources using IronRouter
IronRouter.prototype.mapResource = function(resource){
var router = this;
var _routes = [
{ name: resource, path: '/' + resource, action: 'index' },
{ name: 'show' + resource, path: '/' + resource + '/:id', action: 'show' }
];
_.each(_routes, function(route, index){
router.map(function(){
this.route(route.name, {
@sikanhe
sikanhe / rethink_query_wrapper.ex
Created January 3, 2016 23:39
Functions to wrap commonly used rehinkdb queries with error handling
defmodule App.Query do
import App.Database, only: [run: 1]
alias RethinkDB.Query
def get(table, id) when is_bitstring(id) do
Query.table(table)
|> Query.get(id)
|> run
|> catch_errors
|> handle_get_response
# This module intentionally minimizes dependencies to mitigate breakage risk.
# Subset of Syslog's numerical severity codes (RFC 3164, Table 2)
SEVERITY =
ERROR: 3
WARN: 4
INFO: 6
DEBUG: 7
# Configuration
@thomassuckow
thomassuckow / karma.js
Last active June 18, 2017 13:26
Using karma to load requirejs tests with the .spec.js suffix. Note the base url needs the / otherwise karma-requirejs will whine about no timestamp (paths will differ) We mangle the files list to be relative, otherwise using relative paths in the form of "./bar" will fail. In my use case I have a shared config.js file that has more configuration…
var tests = Object.keys(window.__karma__.files).filter(function (file) {
return /\.spec\.js$/.test(file);
}).map(function(file){
return file.replace(/^\/base\/src\/js\/|\.js$/g,'');
});
require.config({
baseUrl: '/base/src/js',
paths: {
"lib":"../../target/js/lib"
@tlrobinson
tlrobinson / redux-devtools-separate-window.js
Last active August 20, 2019 23:54
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
// give it a name so it reuses the same window
var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no");
// reload in case it's reusing the same window with the old content
win.location.reload();
// wait a little bit for it to reload, then render
setTimeout(function() {
React.render(
<DebugPanel top right bottom left >
@kurtmilam
kurtmilam / deep_extend_javascript_objects_underscore_mixin.js
Last active October 3, 2020 14:56
Deep Extend / Merge Javascript Objects - underscore.js Mixin
/* Copyright (C) 2012-2014 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955
*
* This mixin now has its own github repository: https://github.com/kurtmilam/underscoreDeepExtend
* It's also available through npm and bower
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFR