Skip to content

Instantly share code, notes, and snippets.

View dyaa's full-sized avatar

Dyaa dyaa

View GitHub Profile
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi
@dyaa
dyaa / Favico Ctrl.js
Created February 17, 2015 15:58
Using favico.js with AngularJS - Working demo is on http://lab.ejci.net/favico.js/example-angular/.
angular.module('app.controllers', ['favico.service']).controller('homeCtrl', ['$scope', 'favicoService', /**
* Home view controller
* @param {Object} $scope
*/
function($scope, favicoService) {
//initial value
$scope.count = 3;
//badge +1
$scope.plusOne = function() {
$scope.count = $scope.count + 1;
@dyaa
dyaa / directive
Last active August 29, 2015 14:16 — forked from SelrahcD/gist:7042692
Using PrismJs with AngularJs
angular.module('Prism', []).
directive('prism', [function() {
return {
restrict: 'A',
link: function ($scope, element, attrs) {
element.ready(function() {
Prism.highlightElement(element[0]);
});
}
}
@dyaa
dyaa / addroute
Created September 22, 2015 15:18 — forked from kunal732/addroute
Adding Route to Meteor
Meteor.Router.add({
'/inbound': function() {
post = this.request.body;
color = post.subject;
Colors.update({pos: 1},{ $set: { "name": color } } );
return [200, "Success"]
}
});
@dyaa
dyaa / client.js
Last active October 4, 2015 13:15
Connect service to existing meteor account
var addUserService;
addUserService = function(service) {
if (service === "email") {
} else {
switch (service) {
case "facebook":
return Facebook.requestCredential({
requestPermissions: ["email", "user_friends", "manage_notifications"]
@dyaa
dyaa / read_time.js
Last active October 12, 2015 12:54
Medium-like Estimated Reading Time The code is pretty simple. It assumes you read at 200 words per minute. If the text is under 200 words, it’ll just say it’s a one minute read.
var readTime = function(text){
var regex = /(<([^>]+)>)/ig;
var minutes = Math.floor(text.trim().replace(regex, ' ').split(' ').length / 200 )
if(minutes === 0) minutes = 1
return minutes + ' min read'
}
Tags: Sublime Text 2 License Key, Sublime Text 3 License Key, Sublime Text Full Version, Sublime Text 3 version 3103.
Go to menu Help > Enter License.
—– BEGIN LICENSE —–
Michael Barnes
Single User License
@dyaa
dyaa / u2f
Created January 26, 2017 16:42
install some rules for Linux’s device manager so it can deal with the U2F keys
sudo wget -O /etc/udev/rules.d/70-u2f.rules https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-u2f.rules
let newKey = new Date().getTime();
let list = af.database.object(`/items/${newKey}`).set({ name: 'Test' });
@dyaa
dyaa / favComp.vue
Created May 21, 2017 09:17
Favourite Button component for Vue JS
<template>
<button class="btn btn-sm btn-primary" v-on:click="togglefav" ><i v-bind:class="[is_fav ? 'fa-heart' : 'fa-heart-o', 'fa']" aria-hidden="true"></i></button>
</template>
<script>
export default {
props:['is_fav'],
methods:{
togglefav:function(){
this.$emit('togglefav',!this.is_fav);