Skip to content

Instantly share code, notes, and snippets.

View meftunca's full-sized avatar
🏠
Working from home

muhammed burak şentürk meftunca

🏠
Working from home
  • A developer who suffers from the disease of selectivity in learning from unnecessary real-life experience.
  • İstanbul
  • 02:51 (UTC +03:00)
View GitHub Profile
@tomotaka
tomotaka / json_matcher.rb
Created August 14, 2012 16:00
recursive regexp pattern for JSON
# coding: utf-8
# only works on 1.9+
# base idea is from:
# - http://stackoverflow.com/questions/2583472/regex-to-validate-json
# - http://www.slideshare.net/takesako/shibuyapm16-regexpjsonvalidator
module JsonMatcher
NUMBER = /-? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)?/x
BOOLEAN = /true | false | null/x
@ekrembk
ekrembk / sehir_tespiti.js
Created November 6, 2012 10:14
Kullanıcının şehrini Javascript ile otomatik tespit etme. HTML5 Geocoding API ve Reverse Geocoding için Yandex Geocoder kullanıldı.
function otomatikBul() {
// Browser desteğini kontrol et
if( ! navigator.geolocation ) {
console.log( 'Broserınız desteklemiyor. Lütfen manual seçim yapınız.' );
return;
}
// Uyarı
console.log( 'Koordinatlar alınıyor...' );
@renancouto
renancouto / color.lighten.js
Created January 30, 2013 17:58
Method to lighten / darken hex colors using Javascript.
var LightenColor = function(color, percent) {
var num = parseInt(color,16),
amt = Math.round(2.55 * percent),
R = (num >> 16) + amt,
B = (num >> 8 & 0x00FF) + amt,
G = (num & 0x0000FF) + amt;
return (0x1000000 + (R<255?R<1?0:R:255)*0x10000 + (B<255?B<1?0:B:255)*0x100 + (G<255?G<1?0:G:255)).toString(16).slice(1);
};
@jasdeepkhalsa
jasdeepkhalsa / date.format.js
Created February 1, 2013 11:23
JavaScript Date Format by Steven Levithan
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
@RSNara
RSNara / decorators.js
Last active July 7, 2019 00:24
An example of using decorators in ES5.
function memoize(object, name, descriptor) {
var fn = descriptor.value;
var memoized = function() {
memoized.cache = memoized.cache || {};
var key = JSON.stringify(arguments);
return memoized.cache[key] = memoized.cache[key]
? memoized.cache[key]
: fn.apply(this, arguments);
}
descriptor.value = memoized;
@dabit3
dabit3 / React Native Easings
Created August 1, 2016 03:38
React Native Easing animations
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
Easing,
Animated,
@tzmartin
tzmartin / embedded-file-viewer.md
Last active October 25, 2024 02:37
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@darencard
darencard / auto_git_file.md
Last active August 23, 2024 13:41
Automatic file git commit/push upon change

Please see the most up-to-date version of this protocol on my blog at https://darencard.net/blog/.

Automatically push an updated file whenever it is changed

Linux

  1. Make sure inotify-tools is installed (https://github.com/rvoicilas/inotify-tools)
  2. Configure git as usual
  3. Clone the git repository of interest from github and, if necessary, add file you want to monitor
  4. Allow username/password to be cached so you aren't asked everytime
@willkill07
willkill07 / json.cpp
Last active June 26, 2022 14:09
JSON parser in modern C++
#include "json.hpp"
namespace json {
Wrapper::Wrapper(Value const &value) : v{value} {}
Wrapper::Wrapper(Value &value) : v{value} {}
Wrapper::operator Value &() { return v; }
Wrapper::operator Value const &() const { return v; }
@ibraheem4
ibraheem4 / postgres-brew.md
Last active October 14, 2024 11:59 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update