Skip to content

Instantly share code, notes, and snippets.

View dimkir's full-sized avatar
🎯
Focusing

dimkir

🎯
Focusing
View GitHub Profile
@hjr3
hjr3 / data.php
Created December 15, 2011 21:59
SPL FilterIterator example
$items = array(
array(
'name' => 'Pants',
'available' => 1,
'sold' => 1,
),
array(
'name' => 'Shoes',
'available' => 1,
'sold' => 0,
[core]
excludesfile = ~/.gitignore_global
pager = diff-so-fancy | less --tabs=4 -RFX
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[alias]
aa = add --all
@sintaxi
sintaxi / hosting-an-event-on-surge.md
Last active December 8, 2017 17:29
Instructions for hosting an event on surge.sh

Hosting a competition on surge.sh

...by adding an EVENT.json file to the root of your project.

Hosting an event on surge is very simple. It's three easy steps.

  1. Publish a project to Surge to your root domain (eg. surge ./myproject superevent.io)
  2. Point superevent.io and *.superevent.io DNS records to surges servers.
  3. Add EVENT.json file with the following properties...
function getCognitoCreds() {
console.log("starting function getCognitoCreds");
var cognitoUser = cognitoFactory.getCognitoUser();
cognitoUser.getSession(function(err, session) {
if (err) {
console.log(err, err.stack);
console.log("error getting the session");
} else {
if (session.isValid() === false) {
console.log("session is not valid");
@kamilZ
kamilZ / xdebug-install-php7
Created December 5, 2015 00:10
Install xdebug from sources php7.0
sudo apt-get install php7.0-dev
wget http://xdebug.org/files/xdebug-2.4.0rc2.tgz
tar -xzf xdebug-2.4.0rc2.tgz
cd xdebug-2.4.0RC2/
phpize
./configure --enable-xdebug
make
sudo cp modules/xdebug.so /usr/lib/.
#FOR FPM
sudo echo 'zend_extension="/usr/lib/xdebug.so"' > /etc/php/7.0/fpm/conf.d/20-xdebug.ini
@koenbok
koenbok / CustomDevide.coffee
Created October 20, 2014 09:34
Custom Framer Device
Framer.Device.Devices["my-device"] =
name: "My Device"
deviceType: "mobile"
deviceImage: "my-device.png"
deviceImageWidth: 472
deviceImageHeight: 806
screenWidth: 320
screenHeight: 400
@rmrfself
rmrfself / transaction.php
Created May 19, 2012 07:27
How to make transactions in Doctrine 2 using Symfony 2
<?php
// Snippet for Symfony 2 application that uses Doctrine 2 to handle transactions
// It uses the names of the objects/doctrine repositories from the Beta 4 Manual of Symfony 2.
// Get the entity manager
$em = $this->getDoctrine()->getEntityManager();
// suspend auto-commit
$em->getConnection()->beginTransaction();
@tdukart
tdukart / kebabCase.js
Last active February 2, 2020 05:53
JavaScript Kebab Case function
/**
* Given a string, converts it to kebab case (lowercase, hyphen-separated). For example,
* "makeFoo" becomes "make-foo", and "a Multi Word string" becomes "a-multi-word-string".
*
* @param {string} string Your input string.
* @returns {string} Kebab-cased string.
*/
function kebabCase(string) {
var result = string;
#!/usr/bin/env node
var program = require('commander');
var request = require('request');
var chalk = require('chalk');
program
.version('0.0.1')
.usage('[options] <keywords>')
.option('-o, --owner [name]', 'Filter by the repositories owner')
@merlinvn
merlinvn / gulp.js
Created September 18, 2016 08:46
Gulp for C++
var gulp = require('gulp');
var exec = require('child_process').exec;
var cmakeCommand = "mkdir -p build; cd build; cmake ..;";
var cleanCommand = "rm -rf build";
var testCommand = "cd build; ctest -V";
//"cmake --build ."