Skip to content

Instantly share code, notes, and snippets.

View ryngonzalez's full-sized avatar

✨ Kathryn Gonzalez ✨ ryngonzalez

View GitHub Profile
namespace :db do
desc "load data from csv"
task :load_csv_data => :environment do
require 'fastercsv'
FasterCSV.foreach("importdata/tarife.csv", :headers => true, :col_sep => ',') do |row|
Anbieter.find_or_create_by_name(
:name => row['Anbieter_Name']
:hotline => row['Hotline'],
:email => row['Email']
@ryngonzalez
ryngonzalez / database.yml
Created July 18, 2011 15:14 — forked from amw/database.yml
Standard rails database.yml with additional definition of live database
development:
adapter: mysql2 # must =~ /mysql/
database: adamDb # required
username: your_user
password: keep_secret
live:
ssh_user: # optional, use if live system user differs from your dev user
host: example.com # required, can be IP
adapter: mysql2 # must =~ /mysql/
@ryngonzalez
ryngonzalez / functions.coffee
Created March 30, 2012 00:18
Functional Programming: simulating sine with an (approximate) infinite series…
apply = (f) ->
args = Array.prototype.slice.call(arguments, 1)
(x) ->
f.apply null, args.concat x
factorial = (n) ->
if n
factorial(n-1)*n
else
@ryngonzalez
ryngonzalez / gist:3806173
Created September 30, 2012 07:37
Foursquare ruby implementations
client = Foursquare.new(:oauthToken => "", :oauthSecret => "")
categories = client.categories()
goodCategories = []
categories.each do |category|
if category.name != "food" || category.name != "nightlife"
goodCategories.push(categoryId)
end
#include "../unit-test-framework/unit_test_framework.h"
#include "../dlist.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
/********************************************************
@ryngonzalez
ryngonzalez / director.js
Created December 15, 2012 02:19
A small library for HTML5 Audio that executes a given function at particular time during playback.
/**
* Copyright 2012 - Ryan Gonzalez - @ryngonzalez - ryan@ionizedmedia.com
*
* Director.js
*
* Takes an audio element and an
* object of functions and corresponding
* times to execute them during
* audio playback.
*
@ryngonzalez
ryngonzalez / toggleData.js
Created June 12, 2013 22:10
Toggle your data-attributes, yo.
(function(jQuery){
$.fn.toggleData = function(dataAttr, onState, offState) {
this.attr(dataAttr, this.attr(dataAttr) === onState ? offState : onState)
};
})($);
@ryngonzalez
ryngonzalez / angular-textarea-autoresize.js
Created July 22, 2013 21:34
A small, performant way of automatically expanding a textarea in Angular.
// Ryan Gonzalez 7/2013
// Adapted from the blog post
// http://phaistonian.pblogs.gr/expanding-textareas-the-easy-and-clean-way.html
angular.module('autoresize', []);
angular.module('autoresize')
.directive('autoresize', function($window){
'use strict';
return {
angular.module('$app.directives')
.directive 'showAfterEvent', ['$timeout', ($timeout)->
return {
link: (scope, element, attrs) ->
eventName = attrs.showAfterEvent
element.css 'opacity', 0
element.bind eventName, (e) ->
@ryngonzalez
ryngonzalez / divider.scss
Created November 19, 2013 23:21
CSS divider using :after and :before pseudo elements.
%divider {
&:after, &:before {
display: block;
position: absolute;
}
&:after {
text-transform: none;
text-shadow: none;
@include rem(font-size, 12px);
text-align: center;