Skip to content

Instantly share code, notes, and snippets.

@linuslundahl
linuslundahl / dabblet.css
Created July 16, 2014 17:22 — forked from LeaVerou/dabblet.css
Scoop corners with only one gradient
/**
* Scoop corners with only one gradient
* Caveats: backdrop must be a solid color,
* dimensions need to be known
* For more flexibility, see: http://lea.verou.me/2011/03/beveled-corners-negative-border-radius-with-css3-gradients/
*/
div {
width: 400px;
height: 300px;
@linuslundahl
linuslundahl / .inputrc
Created February 9, 2010 20:52
Bash key shortcuts
"\e[1~": beginning-of-line # Home key
"\e[4~": end-of-line # End key
"\e[3~": delete-char # Delete key
"\e[5C": forward-word # Ctrl+right
"\e[5D": backward-word # Ctrl+left
"\e\e[C": forward-word # Alt+right
"\e\e[D": backward-word # Alt+left
"\C-K": unix-line-discard # Ctrl+K
"\e\"": "@{}\e[D" # Insert @{} move cursor into braces
@linuslundahl
linuslundahl / move_wordpress_blog.php
Created February 11, 2011 10:32
Change wordpress url in code, when there's no access to phpMyAdmin.
global $wpdb;
$query = "UPDATE $wpdb->posts SET post_content = REPLACE (
post_content,
'http://old.com',
'http://new.com')";
$wpdb->query($query);
$query = "UPDATE $wpdb->posts SET guid = REPLACE (
@linuslundahl
linuslundahl / services-resource.php
Created April 11, 2012 10:04
Services resource definition
$resources['ur_segment'] = array(
'operations' => array(
'create' => array(
'callback' => '_ur_segment_create',
'help' => t('Creates a segment.'),
'args' => array(
array(
'name' => 'segment',
'optional' => FALSE,
'source' => 'data',
@linuslundahl
linuslundahl / sass-button.sass
Created May 22, 2012 08:16
SASS with Compass button style
@mixin button($bg, $color)
background: $orange
@include background-image(linear-gradient(($bg*1.6), $bg 40%, $bg))
@include box-shadow(($bg*2) 0 1px 1px 0 inset)
@include border-radius(5px)
border: 1px solid ($bg/1.2)
color: $color
font: normal normal 300 1em/150% "Helvetica Neue", Arial, sans-serif
margin: 0 10px 0 0
padding: 5px 10px
@linuslundahl
linuslundahl / siteup
Created August 31, 2012 11:53
Linode vhost script
#! /bin/bash
#
# =======================
# Linode vhost script
# =======================
function make_vhost
{
cat <<- _EOF_
<VirtualHost *:80>
@linuslundahl
linuslundahl / error_log
Created August 31, 2012 12:23
Send php error_log to OS X console.
$ mate /etc/php.ini
Add: error_log = /Users/USERNAME/Library/Logs/php.log
$ sudo chmod 755 ~/Library/ && sudo chmod 755 ~/Library/Logs && sudo touch ~/Library/Logs/php.log && sudo chmod 777 ~/Library/Logs/php.log
@linuslundahl
linuslundahl / drupal_table_pager.php
Created October 10, 2012 06:42 — forked from simme/drupal_table_pager.php
Drupal table with pager from db_select()
<?php
/**
* Display point award report.
*
* Generates a list of awarded points.
*
* @return array $content
*/
function game_report_page_points() {
@linuslundahl
linuslundahl / _mixins.sass
Last active October 27, 2015 09:37 — forked from simme/_mixins.sass
SASS Mixins and Functions
// Rounds all the corners of a box
@mixin vector-bg-with-fallback($name) {
background-image: image-url('#{$name}.png');
background-image: none, image-url('#{$name}.svg');
}
@mixin border-radius($radius, $clip: padding-box)
-webkit-border-radius: $radius
-moz-border-radius: $radius
-o-border-radius: $radius
@linuslundahl
linuslundahl / dabblet.css
Created December 2, 2013 08:38 — forked from LeaVerou/dabblet.css
(C)Leanest CSS spinner ever
/**
* (C)Leanest CSS spinner ever
*/
@keyframes spin {
to { transform: rotate(1turn); }
}
.progress {
position: relative;