Skip to content

Instantly share code, notes, and snippets.

@ursuleacv
ursuleacv / gist:9727867
Created March 23, 2014 18:57
Floating left fluid boxes
<div id="wrapper">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
<div class="box">6</div>
</div>
.box {
@ursuleacv
ursuleacv / gist:50104fe887eae318bc18
Last active January 6, 2018 17:30
Finding duplicate values in MySQL
SELECT nickname, COUNT(*) c FROM nickname_source GROUP BY nickname HAVING c > 1;
SELECT slugname, COUNT(*) c FROM slug GROUP BY slugname HAVING c > 1;
# duplicate campaigns
SELECT
entity_campaign_pk,
campaign_name,
offers_campaigned,
options,
@ursuleacv
ursuleacv / gist:f37bf32964cb40d1ef9a
Created May 14, 2014 22:21
Image vertically and horizontally centered in div
http://jsfiddle.net/kizu/4RPFa/74/
@ursuleacv
ursuleacv / gist:65d88b1119298f35b345
Created July 18, 2014 16:12
Lazy Loading Images
<img src="blank.gif" class="lazy" data-src="http://cdn.css-tricks.com/images/full-size.jpg" width="240" height="152">
/* lazyload.js (c) Lorenzo Giuliani
* MIT License (http://www.opensource.org/licenses/mit-license.html)
*
* expects a list of:
* `<img src="blank.gif" data-src="my_image.png" width="600" height="400" class="lazy">`
*/
!function(window){
@ursuleacv
ursuleacv / gist:20ac531649f76f123ca6
Last active August 31, 2016 06:09
JavaScript modules
//Object Literal
var app = app || {};
//object literal
app = {
init: function(){
this.cache();
this.bind();
},
@ursuleacv
ursuleacv / gist:c963b2610985989b2786
Created September 25, 2014 13:20
Page Scroll 3D effect
<div class="wrapper active-page1">
<div class="page page1">
<h2>Здравствуйте</h2>
</div>
<div class="page page2">
<h2>Листайте страницу</h2>
</div>
<div class="page page3">
<h2>Чтобы увидеть</h2>
</div>
@ursuleacv
ursuleacv / gist:80d35b6b6d13fc8760ca
Created October 14, 2014 22:20
PHP: How to generate a random, unique, alphanumeric string
$t1 = microtime();
function crypto_rand_secure($min, $max) {
$range = $max - $min;
if ($range < 0) return $min; // not so random...
$log = log($range, 2);
$bytes = (int) ($log / 8) + 1; // length in bytes
$bits = (int) $log + 1; // length in bits
$filter = (int) (1 << $bits) - 1; // set all lower bits to 1
do {
$rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes)));
http://www.eyecon.ro/datepicker/#download
<?php
// post to page
$page_post = (new FacebookRequest( $session, 'POST', '/'. $page_id .'/feed', array(
'access_token' => $access_token,
'name' => 'Facebook API: Posting As A Page using Graph API v2.x and PHP SDK 4.0.x',
'link' => 'https://www.webniraj.com/2014/08/23/facebook-api-posting-as-a-page-using-graph-api-v2-x-and-php-sdk-4-0-x/',
'caption' => 'The Facebook API lets you post to Pages you administrate via the API. This tutorial shows you how to achieve this using the Facebook PHP SDK v4.0.x and Graph API 2.x.',
'message' => 'Check out my new blog post!',
) ))->execute()->getGraphObject()->asArray();
@ursuleacv
ursuleacv / gist:72493c6e898cecca75a4
Created February 23, 2015 14:28
Twilio test credentials
5005550001 This phone number is invalid. 21211
5005550002 Twilio cannot route to this number. 21612
5005550003 Your account doesn't have the international permissions necessary to SMS this number. 21408
5005550004 This number is blacklisted for your account. 21610
5005550009 This number is incapable of receiving SMS messages. 21614
All Others Any other phone number is validated normally. Input-dependent