Skip to content

Instantly share code, notes, and snippets.

View stnc's full-sized avatar
🎯
Focusing

TUNÇ Selman stnc

🎯
Focusing
View GitHub Profile
@uguraktas
uguraktas / jspromises.js
Last active October 17, 2019 15:11
Javascript Callback, promise and await
//Dummy data
const data = [
{ title: "Title 1", description: "Title Content 1" },
{ title: "Title 2", description: "Title Content 2" }
]
//Example Callback
function getData() {
setTimeout(() => {
data.map((item, index) => {
console.log('getData', item, index)
@jvandenaardweg
jvandenaardweg / App.jsx
Last active November 19, 2020 22:41
Use React's Context API in React Native (0.59.0) to have network connectivity status globally available. Gist for Medium article: https://medium.com/@jvandenaardweg/easily-manage-connection-status-updates-in-react-native-28c9b4b0647f
import React from 'react';
import { NetworkProvider } from './NetworkProvider';
import { ExampleComponent } from './ExampleComponent';
export default class App extends React.PureComponent {
render() {
return (
<NetworkProvider>
<ExampleComponent />
@shamimmoeen
shamimmoeen / custom-file-upload-form-in-wordpress.php
Last active October 31, 2023 10:42
Create custom file upload form in WordPress
<?php
if ( ! function_exists( 'wpcfu_output_file_upload_form' ) ) {
/**
* Output the form.
*
* @param array $atts User defined attributes in shortcode tag
*/
function wpcfu_output_file_upload_form( $atts ) {
@cagartner
cagartner / customer-checkout-magento.phtml
Created October 20, 2017 12:47
Verify if user is in checkout proccess
<?php if ($this->helper('Magento\Checkout\Helper\Data')->isContextCheckout()): ?>
<input name="context" type="hidden" value="checkout" />
<?php endif; ?>
{"_id":{"$oid":"5935accb6df2b7ad2b8b4567"},"color":"camurca/branco","color_value":"1515"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b4568"},"color":"branco/azul/rosa/lilas","color_value":"0549"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b4569"},"color":"Evora/branco","color_value":"1077"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b456a"},"color":"rosa/verde","color_value":"1926"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b456b"},"color":"couro-branco","color_value":"1243"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b456c"},"color":"pomodoro","color_value":"1739"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b456d"},"color":"ype/ebano","color_value":"1060"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b456e"},"color":"canela-rustico/amarelo","color_value":"2056"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b456f"},"color":"rovere/arena","color_value":"2046"}
{"_id":{"$oid":"5935accb6df2b7ad2b8b4570"},"color":"branco/cinza/preto","color_value":"1216"}
@wuriyanto48
wuriyanto48 / golang_reduce_map.go
Last active December 11, 2022 18:04
How to Join Map In Golang (Map Union)
package main
import (
"fmt"
)
type Item struct{
Id int
Name string
Qty int
@smontlouis
smontlouis / Component.js
Last active September 11, 2022 11:13
React Native - Fixed header/footer disappearing on scroll
import React, { PropTypes, Component } from 'react'
import {
Animated,
ScrollView,
Text,
View,
} from 'react-native'
import EStyleSheet from 'react-native-extended-stylesheet'
const styles = EStyleSheet.create({
@deinspanjer
deinspanjer / test_a_sayer.go
Created November 9, 2016 16:25 — forked from anonymous/test_a_sayer.go
Example of cross-package interfaces in golang
package a
import "fmt"
type Sayer interface {
Say() string
}
type Formal struct{}
@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@tomysmile
tomysmile / memcached_macosx.md
Created April 26, 2016 13:27
Installing memcached on Mac with Homebrew and Lunchy

Installing memcached on Mac with Homebrew and Lunchy

This is a quick guide for installing memcached on a Mac with Homebrew, and starting and stopping it with Lunchy. I hope this tutorial will get your memcached up and running in no time.

Step 1 — Install Homebrew

Installing Homebrew is super easy. Just paste this in your terminal —

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"