Skip to content

Instantly share code, notes, and snippets.

View gayanvirajith's full-sized avatar
:octocat:

Gayan Virajith gayanvirajith

:octocat:
View GitHub Profile
@james2doyle
james2doyle / circle-image.svg
Created May 8, 2014 18:31
a simple example of an image inside of a SVG element
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ajtowf
ajtowf / css
Created May 10, 2014 10:53
AngularJS ng-cloak example
.splash {
display: none;
}
[ng-cloak].splash {
display: block !important;
}
.splash {
position: absolute;
@sergejmueller
sergejmueller / index.html
Created September 9, 2014 08:20
Prevent animation flickering on CSS3 Transitions/Transforms in Safari
<!DOCTYPE html>
<html>
<style>
html {
-webkit-font-smoothing: antialiased;
}
</style>
@flovntp
flovntp / LanguageSwitcherController.php
Last active August 29, 2015 14:06
Language switcher
<?php
namespace My\DesignBundle\Controller;
use eZ\Bundle\EzPublishCoreBundle\Controller;
use eZ\Publish\Core\MVC\Symfony\Routing\RouteReference;
class LanguageSwitcherController extends Controller
{
public function languagesAction( RouteReference $routeReference )
{
{
"title": "Tweets Search",
"rows": [
{
"title": "Options",
"height": "50px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [
@amineeg
amineeg / app.js
Created February 27, 2014 22:01
Get started angularJs, send data from angularJs to Php, decode json data in php, best practice
'use strict';
// Declare app level module which depends on filters, and services
var app= angular.module('myApp', ['ngRoute']);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'loginCtrl'});
$routeProvider.otherwise({redirectTo: '/login'});
}]);
@katowulf
katowulf / app.js
Last active September 15, 2017 01:22
Simple infinite scroll example in AngularFire with Firebase.util (http://firebase.github.io/firebase-util/)
var app = angular.module('app', ['firebase']);
app.controller('ctrl', function($scope) {
var ref = new Firebase('https://fbutil.firebaseio.com/paginate');
$scope.scrollItems = $scrollArray(ref, 'number');
});
app.factory('$scrollArray', function($firebaseArray) {
return function(ref, field) {
// create a special scroll ref
@alexkingorg
alexkingorg / hex_color_mod.php
Created September 3, 2011 23:42
Change the brightness of the passed in hex color in PHP
<?php
/**
* Change the brightness of the passed in color
*
* $diff should be negative to go darker, positive to go lighter and
* is subtracted from the decimal (0-255) value of the color
*
* @param string $hex color to be modified
* @param string $diff amount to change the color
// Usage:
// OfflineListener.init(true);
define(['angular', 'core'], function(angular){
// Some concepts from: https://github.com/HubSpot/offline
var module = angular.module('utils.offline', []);
module.service('OfflineListener', function ($rootScope, $window, $alert) {
var offlineAlert;
@katowulf
katowulf / inc_id_rules.js
Last active June 24, 2018 17:08
Security rules for creating an incremental, numeric ID in Firebase. See http://jsfiddle.net/firebase/xLq7grcc/
{
"rules": {
".read": true,
".write": false,
"incid": {
"counter": {
// this counter is set using a transaction and can only be incremented by 1
// the total number of records must be less than 10,000 simply for demo purposes
".write": "newData.isNumber() && ((!data.exists() && newData.val() === 1) || newData.val() === data.val()+1) && newData.val() <= 10000"
},