Skip to content

Instantly share code, notes, and snippets.

@viljami
viljami / AI_CODING_GUIDELINES.md
Last active June 12, 2025 08:10
Coding Guildelines for AI

AI Coding Guidelines (Generic)

🔥 SACRED PRINCIPLES: DRY & KISS

DRY (Don't Repeat Yourself): The highest pride for both human and AI programmers.

KISS (Keep it Simple Sweetheart): Simplicity is the ultimate sophistication.

Do not leave commented code behind. Always remove unused code. Code is cheap - context (cognitive load) is expensive.

@cyrilf
cyrilf / react-select-event.jsx
Created August 30, 2018 15:45
Solution to receive an event with react-select onChange method
// Issue: `react-select` `onChange` method doesn't return a proper event
//
// Solution used:
//
// The main idea is to have an hidden `select` that will trigger a real event
// When `ReactSelect` triggers it's `onChange` we set the state with the `selectedOptions`
// these `selectedOptions` will be what populate our hidden select.
// Using the callback from `setState` (it ensures that the new values are already into our hidden select),
// we then create a change event and dispatch it into our hidden select.
// This will cause the `onChange` from this select to be triggered with a proper `event`.
@dmurawsky
dmurawsky / index.js
Last active April 22, 2025 13:06
How to make a page full height in Next.js
const FullHeightPage = () => (
<div>
Hello World!
<style global jsx>{`
html,
body,
body > div:first-child,
div#__next,
div#__next > div {
height: 100%;
@jkarttunen
jkarttunen / 1_getting_started_with_dev.md
Last active August 29, 2015 14:06
Front End Learning resources

Getting started with front-end development

Books should be available in Siili library, also in dead-trees format. Some of the sites are paywalled but worth it, so prefer these over free copies. If something is missing, please have it bought.

Thinking and concepts

Workflows and tools

  • To get you started without scary tool installs and command line interface, you can use Prepros.io to play with modern web development workflow, packaged in one app.
@heikki
heikki / gist:4030954
Last active November 19, 2015 12:29
Notes for VirtualBox IE setup
https://www.virtualbox.org/wiki/Downloads
https://github.com/xdissent/ievms
For each installed VM:
- Enable copy&paste (Settings -> General -> Advanced -> Shared Clipboard -> Host To Guest)
- Add more video memory (Settings -> Display -> Video -> Video Memory -> 128 MB ?)
- Add Finnish keyboard layout as default and remove others
- Set IE homepage to about:blank
- Disable Windows key http://support.microsoft.com/kb/216893#FixItForMeAlways
- Take snapshot
@antennaio
antennaio / jquery-plugin.js
Created October 11, 2012 10:51
jQuery Plugin Boilerplate
/**
* jQuery Plugin Boilerplate
*
* Call the plugin by supplying a method and/or options:
*
* $("element").myplugin();
* $("element").myplugin({ option1: true, option2: true });
* $("element").myplugin("secondary_method");
* $("element").myplugin("secondary_method", { option1: true, option2: true });
*
@bekapod
bekapod / gist:2016527
Created March 11, 2012 13:58
CSS: Practical Font Sizing
/* Housekeeping */
*{ margin:0; padding:0; }
/* Define your base font-size here; most elements will inherit this. */
html{
font-size:1em; /* Assuming 16px... */
line-height:1.5; /* 24px (This is now our magic number; all subsequent margin-bottoms and line-heights want to be a multiple of this number in order to maintain vertical rhythm.) */
}
/* Common margin-bottom for vertical rhythm. */
<!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; }
@mklabs
mklabs / bootstrap-plugins.txt
Created December 2, 2011 11:23
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@jferris
jferris / time_formats.rb
Created November 16, 2011 17:05
Figure out what strtime characters are supported by your Ruby
#!/usr/bin/env ruby
require 'rubygems'
require 'active_support/core_ext'
chars = (('a'..'z').to_a + ('A'..'Z').to_a)
time = Time.now.beginning_of_month
twelve_hours_from_now = 12.hours.from_now
end_of_next_month = 1.month.from_now.end_of_month