Skip to content

Instantly share code, notes, and snippets.

View fupslot's full-sized avatar
💭
I may be slow to respond.

Eugene Brodsky fupslot

💭
I may be slow to respond.
View GitHub Profile
@fupslot
fupslot / snippet.xml
Created November 25, 2012 21:52 — forked from JeffreyWay/snippet.xml
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@fupslot
fupslot / gist:4219524
Created December 5, 2012 21:10 — forked from JeffreyWay/gist:3185773
PHP Installation Options
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
@fupslot
fupslot / gist:4249326
Created December 10, 2012 08:23
CSS: Sexy Button
.form-wrapper .button {
float: right;
border: 1px solid #00748f;
height: 42px;
width: 100px;
padding: 0;
cursor: pointer;
font: bold 15px Arial, Helvetica;
color: #fafafa;
text-transform: none;
@fupslot
fupslot / guid
Created November 2, 2015 14:40
javascript, guid, uid, id
function guid(){
function s4() {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
@fupslot
fupslot / requestAnimFrame.js
Last active November 17, 2015 11:31 — forked from joelambert/README
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
// requestAnimationFrame() shim by Paul Irish
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
window.requestAnimFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function */ callback, /* DOMElement */ element){
window.setTimeout(callback, 1000 / 60);
@fupslot
fupslot / unique
Created October 29, 2015 13:44
javascript, unique, uniq, filtering
function unique(in_list) {
var lookup = {};
var values = [];
for (var i = 0; i < in_list.length; i++) {
if (!lookup[in_list[i]]) {
values.push(in_list[i]);
}
lookup[in_list[i]] = true;
}
return values;
@fupslot
fupslot / gist:5023373
Created February 24, 2013 10:41
javascript: rgb2hex
function rgbToHex(r, g, b) {
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}
<input type="text" class="i18n" data-labels="value#str001 placeholder#str002" />
<button class="i18n" data-labels="innerText#str003">Click Me</button>
<div class="i18n" data-labels="innerText#str004">This string will never be translated</div>
<script>
function i18n_parse (rootElement, labelAttribute, iterator) {
if (arguments.length === 1 && typeof arguments[0] === "function") {
iterator = arguments[0];
rootElement = null;
// returns total amount of the days that passed since Jan 1 2000
function getDay(aDate) {
if (typeof aDate === "string") {
aDate = new Date(aDate);
}
var zeroYear = 2000;
var totalYears = aDate.getFullYear() - zeroYear;
// calculate all days that passed
// since Jan 1 2000 till current time
var isLeapYear = (new Date(now.getFullYear, 1, 29).getMonth() == 1); // year is leap