Skip to content

Instantly share code, notes, and snippets.

View saneef's full-sized avatar
🐢

Saneef Ansari saneef

🐢
View GitHub Profile
@indirect
indirect / semantic_summary.rb
Created July 30, 2012 10:08 — forked from chriseppstein/semantic_summary.rb
This ruby script will summarize the html5 semantic structure of a webpage so that you can more easily ensure the page is correct.
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url = ARGV[0]
class Document < Nokogiri::XML::SAX::Document
SEMANTIC_CONTAINERS = %w(body article section nav aside hgroup header footer)
COUNT_ELEMENTS = %w(p a)
@the-bass
the-bass / application.html.erb
Last active April 15, 2020 15:01
Using Google Analytics with Rails 5 and Turbolinks 5. This code is taken from the conversation between @preetpalS and @packagethief on https://github.com/turbolinks/turbolinks/issues/73.
<%# Put this code snippet between the <head></head>-tags in your application layout and %>
<%# replace 'UA-XXXXXXXX-X' with your own unique Google Analytics Tracking ID %>
<%# ... %>
<head>
<%# ... %>
<% if Rails.env.production? %>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
// We'll use an npm module here (probably won't be possible in the Figma plugin...)
import triangulate from 'delaunay-triangulate';
// Export your generative program
export default {
props: {
// Number of points (e.g. 1D data structure)
shape: 125
},
// Here the 'vertex' shader generates random points in 2D
@MWDelaney
MWDelaney / timeAgo.js
Last active May 12, 2022 21:45
Eleventy-friendly "time ago" javascript snippet.
/**
* "Time Ago" vanilla javascript snippet
*
* Lovingly stolen from StackOverflow here: https://stackoverflow.com/a/37802747
*
* Convert elements like this:
* <time datetime="Thu May 12 2022 21:05:56 GMT+0000 (Coordinated Universal Time)">May 12th, 2022</time>
*
* To This:
* <time datetime="Thu May 12 2022 21:05:56 GMT+0000 (Coordinated Universal Time)">4 days ago</time>
@brandonkboswell
brandonkboswell / karabiner.json
Created February 20, 2022 17:08
Brandon Boswell's Karabiner Elements Config
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {

26 time management hacks I wish I'd known at 20

  1. There's always time. Time is priorities
  2. Days always fill up | "Only plan for 4-5 hours of real work per day."
  3. Work more when you're in the zone. Relax when you're not. | "It's normal to have days where you just can't work and days where you'll work 12 hours straight"
  4. Respect your time and make it respected | "Your time is $1000/hour, and you need to act accordingly"
  5. Stop multi-tasking. It merely kills your focus.
  6. Set up a work routine and stick to it. Your body will adapt
  7. We're always more focused and productive with limited time.
  8. Work is the best way to get working. Start with short tasks to get the ball rolling.
@sparkalow
sparkalow / find-wide-dom-elements.js
Created April 27, 2016 16:31
Useful JS snippet for finding DOM elements wider than current viewport. Only tested in Chrome.
var els = document.querySelectorAll('*');
var l = els.length;
var maxWidth = window.innerWidth;
console.log('Elements wider than ' + maxWidth);
for(var i = 0 ; i < l; i ++){
var e = els[i];
var width =e.offsetWidth;
rect = e.getBoundingClientRect();
if(rect.width > maxWidth){
@Nzen
Nzen / readme.md
Last active December 7, 2022 22:10
JavaDoc dark theme

What is this?

A css to replace the light version that Oracle serves. I like dark themes for the webpages that I read. All that must be done is change the stylesheet link in the pages you use or to nest the pages at the appropriate level.

@IainIsCreative
IainIsCreative / _baseline.scss
Created November 26, 2014 14:02
A very simple Baseline SCSS mixin for providing a visual baseline in your project, in CSS.
// Set up line-height and colour defaults for this mixin.
$line-height: 20px!default;
$line-color: #94d4ff!default;
/**
*
* Baseline Mixin
* Handy dandy mixin to provide a baseline for your typography.
*
* The mixin carries two arguments — the $baseline, which should match your line-height, and $baseline-color, the colour you want the lines to be.
1. Highlight a recommended option,

2. Allow users to switch currency (€/$/£)

3. Allow users to switch pricing monthly/yearly

4. Keep the entire pricing plan area clickable

5. Use slider to calculate how much a user would save

6. Provide free first month for good engagement

7. Prominently highlight testimonials prominently

8. Repeating call to action on top and bottom

9. Sell benefits instead of features

10. Indicate that users can cancel any time