Skip to content

Instantly share code, notes, and snippets.

View oktayacikalin's full-sized avatar

Oktay Acikalin oktayacikalin

View GitHub Profile
@oktayacikalin
oktayacikalin / gist:4474247
Last active December 10, 2015 18:28
Just to make sure... :)
- return true;
+ return $response ? true : true;
@oktayacikalin
oktayacikalin / mount.py
Created October 20, 2013 07:14
How to mount a local volume using gvfs (gio) in Python 3 - quick and dirty.
#!/usr/bin/env python3
# Quick and dirty implementation of mounting a local volume using Gio.
# For people who were scratching their heads like me.
# Code below based on infos from:
# http://stackoverflow.com/questions/5709454/gio-check-if-volume-is-mounted
# http://stackoverflow.com/questions/1991206/accessing-samba-shares-with-gio-in-python/2051628#2051628
@oktayacikalin
oktayacikalin / workspace-switch-notifier.py
Created September 14, 2014 13:21
Gtk, Wnck Workspace switch notifier in Python http://pastebin.com/RVAsutaj
#!/usr/bin/env python3
from gi.repository import Wnck, Gtk, Notify
import signal, time
class Kludge:
def __init__(self):
self.first = True
signal.signal(signal.SIGINT, signal.SIG_DFL)
self.screen = Wnck.Screen.get_default()
<?php
/**
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml and
* then use this script to apply updates and refresh the config cache without
* causing a stampede on the config cache.
*
* @author Colin Mollenhour
*/
umask(0);
ini_set('memory_limit','512M');
@oktayacikalin
oktayacikalin / Block.php
Created March 25, 2015 08:31
Reusing/Sharing a frontend template in admin
public function __construct()
{
parent::__construct();
$this->setData('area','frontend');
$this->setTemplate('customer/online.phtml');
}
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@oktayacikalin
oktayacikalin / new_gist_file_0
Created May 28, 2015 06:38
How to mount a partition inside a disk image
http://ubuntuforums.org/archive/index.php/t-1576011.html
---
To mount a partition inside the disk image you need to calculate the offset of where the partition starts.
parted picked.img
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<style id="jsbin-css">
textarea{
height:150px;
}
@oktayacikalin
oktayacikalin / howto
Last active December 16, 2015 15:53
Create an initial empty commit in Git for further branching.Based on: http://kevin.deldycke.com/2010/05/initialize-git-repositories/
git commit --allow-empty -m 'Initial commit'
@oktayacikalin
oktayacikalin / Article.md
Created January 15, 2016 06:10 — forked from Warry/Article.md
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows: