Skip to content

Instantly share code, notes, and snippets.

View thinklinux's full-sized avatar

Tihomir Valkanov thinklinux

  • Sofia, Bulgaria
View GitHub Profile
@TheWaWaR
TheWaWaR / arch_install.sh
Last active December 10, 2015 01:48 — forked from anonymous/arch_install
Arch install Script
passwd
systemctl enable sshd.service
systemctl start sshd.service
parted -s /dev/sda mklabel gpt
parted -s /dev/sda mkpart "primary" "fat16" "50MB" "60MB"
parted -s /dev/sda mkpart "primary" "ext4" "1%" "99%"
parted -s /dev/sda set 1 bios_grub on
mkfs.ext4 /dev/sda2
@ragingprodigy
ragingprodigy / select2_angularjs.coffee
Created December 11, 2014 12:17
Select2 AngularJs directive example with custom query call to append data to the request. Note: Providing ajax settings is not needed (and not used) when query is provided. Left here as a full example.
# The "query" configuration is adapted from this gist: https://gist.github.com/techniq/4609063
.directive 'remoteSelectPlugin', ['$http', ($http) ->
{
restrict: 'A'
link: (scope, elem, attr) ->
angular.element(elem).select2({
placeholder: attr.remoteSelectPlugin
minimumInputLength: 1
query: (options) ->
@SachaG
SachaG / AsynchronousFunctionWithinMeteorMethod.js
Last active November 17, 2016 09:32
Call an asynchronous function and use its returned value from within a Meteor method using Future.
if(Meteor.isServer){
Meteor.methods({
myMeteorMethod: function() {
// load Future
Future = Npm.require('fibers/future');
var myFuture = new Future();
// call the function and store its result
SomeAsynchronousFunction("foo", function (error,results){
@sagivf
sagivf / RethinkDB count issue and solutions.md
Last active March 18, 2017 22:00
RethinkDB count issue and solutions
@techniq
techniq / select2_ajax.js
Created January 23, 2013 16:24
Select2 ajax example with custom query call to append data to the request. Note: Providing ajax settings is not needed (and not used) when query is provided. Left here as a full example.
$("[data-provide='select2']").each(function () {
var $element = $(this);
$element.select2({
placeholder: $element.data("placeholder"),
minimumInputLength: 0,
allowClear: true,
initSelection: function (element, callback) {
callback({
id: $(element).val(),
@stowball
stowball / convert-svgs.js
Created October 24, 2017 09:40
A node script to convert a a folder of SVGs in to React Native SVGs for https://github.com/stowball/react-native-svg-icon
/*
Usage: npm run convert-svgs <type:icons|logos>
*/
/* eslint-disable no-console, no-shadow */
const exec = require('child_process').exec;
const fs = require('fs');
const type = process.argv[2] || 'icons';
const path = `./src/assets/svg/${type}`;
@markerikson
markerikson / dispatching-action-creators.js
Last active May 2, 2020 14:27
Dispatching action creators comparison
// approach 1: define action object in the component
this.props.dispatch({
type : "EDIT_ITEM_ATTRIBUTES",
payload : {
item : {itemID, itemType},
newAttributes : newValue,
}
});
// approach 2: use an action creator function
// http://www.html5rocks.com/en/tutorials/es6/promises/
function get(url) {
// Return a new promise.
return new Promise(function(resolve, reject) {
// Do the usual XHR stuff
var req = new XMLHttpRequest();
req.open('GET', url);
req.onload = function() {
@Jpoliachik
Jpoliachik / index.ios.js
Last active August 17, 2021 10:27
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@coffeemug
coffeemug / rethinkdb-getall.md
Last active March 2, 2022 07:29
Using the `getAll` command to query multiple keys in RethinkDB 1.7.

Querying by multiple keys

The previous releases of RethinkDB allowed querying indexes as follows:

// Three ways to get the user with primary key 5
r.table('users').get(5)
r.table('users').getAll(5)
r.table('users').getAll(5, {index: 'id'})