Skip to content

Instantly share code, notes, and snippets.

View clawfire's full-sized avatar
🐻
Being cool

Thibault Milan clawfire

🐻
Being cool
View GitHub Profile
@maximevalette
maximevalette / hardware.css
Created September 16, 2012 21:22
Hardware acceleration in WebKit
.animation {
-webkit-transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
-webkit-perspective: 1000;
}
@jcanfield
jcanfield / wp-modifydb.php
Created March 29, 2012 17:06
Serialized PHP Search and Replace
<?php
/**
*
* Safe Search and Replace on Database with Serialized Data v2.0.1
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.
@Idered
Idered / gist_shorthand.php
Created February 4, 2012 16:29
Gist shortcode for Wordpress
<?php
function gist_shortcode($atts) {
return sprintf(
'<script src="https://gist.github.com/%s.js%s"></script>',
$atts['id'],
$atts['file'] ? '?file=' . $atts['file'] : ''
);

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@khalsah
khalsah / deploy.sh
Created January 3, 2012 22:59
Experimental git sync & deploy hooks
#!/bin/sh
LOCAL_BRANCH="master"
LIVE_BRANCH="live"
REMOTE_NAME="deploy"
if [ "$(git symbolic-ref -q HEAD)" != "refs/heads/${LOCAL_BRANCH}" ]; then
echo "Not on ${LOCAL_BRANCH}, not deploying"
exit 1
else
@omarabid
omarabid / Usage
Created December 19, 2011 09:24
PayPal ExpressCheckout for WordPress
PayPal ExpressCheckout for WordPress
Usage:
1. Declare an array with all the required parameters.
2. Create a new instance of the class. Set the second parameter to true if you want to enable SandBox mode.
3. Get the redirect URL with the doExpressCheckout function.
4. Redirect the user to that URL to request permission.
5. Use the processPayment function to process the payment.
@nimbupani
nimbupani / index.html
Created December 2, 2011 05:00
Showing latest post on home page with Jekyll
---
layout: default
---
<div class="blog-index">
{% assign post = site.posts.first %}
{% assign content = post.content %}
{% include post_detail.html %}
</div>
@jed
jed / LICENSE.txt
Created August 15, 2011 16:10 — forked from 140bytes/LICENSE.txt
an animated loading DOM spinner
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@dzuelke
dzuelke / bcrypt.php
Last active March 28, 2023 13:15
How to use bcrypt in PHP to safely store passwords (PHP 5.3+ only)
<?php
// secure hashing of passwords using bcrypt, needs PHP 5.3+
// see http://codahale.com/how-to-safely-store-a-password/
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt
$salt = substr(strtr(base64_encode(openssl_random_pseudo_bytes(22)), '+', '.'), 0, 22);
// 2y is the bcrypt algorithm selector, see http://php.net/crypt
// 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt
@chriseppstein
chriseppstein / _icons.scss
Created December 5, 2010 21:48
This is an example of the generated stylesheet by compass for a set of sprites
@import "compass/utilities/sprites/base";
// General Sprite Defaults
// You can override them before you import this file.
$icon-sprite-base-class: ".icon-sprite" !default;
$icon-sprite-dimensions: false !default;
$icon-position: 0% !default;
$icon-spacing: 0 !default;
$icon-repeat: no-repeat !default;