Skip to content

Instantly share code, notes, and snippets.

View ichim-david's full-sized avatar

Ichim David ichim-david

View GitHub Profile
// Scraping Made Easy with jQuery and SelectorGadget
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga)
// by David Trejo
//
// Install node.js and npm:
// http://joyeur.com/2010/12/10/installing-node-and-npm/
// Then run
// npm install jsdom jquery http-agent
// node numresults.js
//
@ichim-david
ichim-david / alien.js
Last active December 17, 2015 02:49 — forked from avoinea/alien.js
// Top namespace
if( !window.Alien ){
var Alien = {"version": "1.0"};
}
// Constructor
Alien.Ship = function(context, options){
var self = this;
self.context = context;
#!/usr/bin/env python
import bz2
import datetime
import os
import sys
import time
import urllib2
import warnings
npm install
npm http GET https://registry.npmjs.org/grunt-contrib-jshint
npm http GET https://registry.npmjs.org/grunt-contrib-clean
npm http GET https://registry.npmjs.org/grunt-contrib-watch
npm http GET https://registry.npmjs.org/grunt-contrib-concat
npm http GET https://registry.npmjs.org/grunt
npm http 304 https://registry.npmjs.org/grunt-contrib-watch
npm http 304 https://registry.npmjs.org/grunt-contrib-clean
npm http 304 https://registry.npmjs.org/grunt-contrib-concat
npm http 200 https://registry.npmjs.org/grunt-contrib-jshint
[alias]
tree = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %Cblue%an%Creset' --abbrev-commit --date=relative
@ichim-david
ichim-david / gist:5884351
Created June 28, 2013 12:34
pycharm error
l
@ichim-david
ichim-david / configure.zcml
Last active December 25, 2015 06:19
browser view with macros property needed for version_history_form preview
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="plone">
<browser:page
for="*"
name="fiche_view"
class=".app.views.FicheView"
permission="zope2.View"

Rainbow stripe mixin with SCSS + Compass

I'm trying to make a horizontal rainbow stripe background gradient mixin, but I feel like this is way too verbose. How can it be better?

Goals:

  1. [check] Use variables for colors so they can be swapped out for different colors.
  2. [check] The widths are hard coded for 8 colors. Can it be done smarter where it adjusts to the number of colors you add? Or is that asking too much?
  3. [check] The colors are defined twice for the color starts and stops. Can this be done better?
  4. [see below] Right now I define the colors as variables at the top level, then pass them in the mixin. Should they instead be created inside the mixin and then colors are brought in as arguments? Or does that matter?
# ref: http://bit.ly/fN2ep8
# http://twitpic.com/3rr8dk
def sass_colors
engine= Sass::Engine.new(File.read("app/stylesheets/_colors.scss"), :syntax => :scss, :load_paths => ["app/stylesheets"])
environment= Sass::Environment.new
engine.to_tree.children.each do | node |
next unless node.kind_of? Sass::Tree::VariableNode
node.perform environment
end
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Design Testing</title>
<style>
body { margin: 20px; font-family: sans-serif; overflow-x: scroll; }
.wrapper { width: 6000px; }
.frame { float: left; }
h2 { margin: 0 0 5px 0; }